gdb: convert some function arguments from int to bool
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 16 Nov 2020 16:12:44 +0000 (16:12 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 19 Nov 2020 10:15:02 +0000 (10:15 +0000)
A little int to bool conversion around the 'watch' type commands.
There should be no user visible changes after this commit.

gdb/ChangeLog:

* breakpoint.c (update_watchpoint): Pass 'false' not '0'.
(watch_command_1): Update parameter types.  Convert locals to
bool.
(watch_command_wrapper): Change parameter type.
(watch_maybe_just_location): Change locals to bool.
(rwatch_command_wrapper): Update parameter type.
(awatch_command_wrapper): Update parameter type.
* breakpoint.h (watch_command_wrapper): Change parameter type.
(rwatch_command_wrapper): Update parameter type.
(awatch_command_wrapper): Update parameter type.
* eval.c (fetch_subexp_value): Change parameter type.
* ppc-linux-nat.c (ppc_linux_nat_target::check_condition): Pass
'false' not '0'.
* value.h (fetch_subexp_value): Change parameter type in
declaration.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/eval.c
gdb/mi/mi-cmd-break.c
gdb/ppc-linux-nat.c
gdb/value.h

index 46c9d399be7a7670afb704a1ea6210e578daf391..a56208ce44352c0a0cf11c20eaddd74e9b65a1d3 100644 (file)
@@ -1,3 +1,21 @@
+2020-11-19  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * breakpoint.c (update_watchpoint): Pass 'false' not '0'.
+       (watch_command_1): Update parameter types.  Convert locals to
+       bool.
+       (watch_command_wrapper): Change parameter type.
+       (watch_maybe_just_location): Change locals to bool.
+       (rwatch_command_wrapper): Update parameter type.
+       (awatch_command_wrapper): Update parameter type.
+       * breakpoint.h (watch_command_wrapper): Change parameter type.
+       (rwatch_command_wrapper): Update parameter type.
+       (awatch_command_wrapper): Update parameter type.
+       * eval.c (fetch_subexp_value): Change parameter type.
+       * ppc-linux-nat.c (ppc_linux_nat_target::check_condition): Pass
+       'false' not '0'.
+       * value.h (fetch_subexp_value): Change parameter type in
+       declaration.
+
 2020-11-19  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * printcmd.c (skip_over_slash_fmt): Make use of skip_to_space and
index 23278320d9d465943bf94ec2c35a5a1438c45f2a..a4ae8b2d8c9b99735898f70357108858d24ebd47 100644 (file)
@@ -1905,7 +1905,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
       struct value *v, *result;
       struct program_space *frame_pspace;
 
-      fetch_subexp_value (b->exp.get (), &pc, &v, &result, &val_chain, 0);
+      fetch_subexp_value (b->exp.get (), &pc, &v, &result, &val_chain, false);
 
       /* Avoid setting b->val if it's already set.  The meaning of
         b->val is 'the last value' user saw, and we should update
@@ -4969,7 +4969,7 @@ watchpoint_check (bpstat bs)
        return WP_VALUE_CHANGED;
 
       mark = value_mark ();
-      fetch_subexp_value (b->exp.get (), &pc, &new_val, NULL, NULL, 0);
+      fetch_subexp_value (b->exp.get (), &pc, &new_val, NULL, NULL, false);
 
       if (b->val_bitsize != 0)
        new_val = extract_bitfield_from_watchpoint_value (b, new_val);
@@ -10676,7 +10676,7 @@ is_masked_watchpoint (const struct breakpoint *b)
                hw_access: watch access (read or write) */
 static void
 watch_command_1 (const char *arg, int accessflag, int from_tty,
-                int just_location, int internal)
+                bool just_location, bool internal)
 {
   struct breakpoint *scope_breakpoint = NULL;
   const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
@@ -10693,7 +10693,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
   int pc = 0;
   /* Flag to indicate whether we are going to use masks for
      the hardware watchpoint.  */
-  int use_mask = 0;
+  bool use_mask = false;
   CORE_ADDR mask = 0;
 
   /* Make sure that we actually have parameters to parse.  */
@@ -10760,7 +10760,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
              if (use_mask)
                error(_("You can specify only one mask."));
 
-             use_mask = just_location = 1;
+             use_mask = just_location = true;
 
              mark = value_mark ();
              mask_value = parse_to_comma_and_eval (&value_start);
@@ -11077,7 +11077,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
 }
 
 void
-watch_command_wrapper (const char *arg, int from_tty, int internal)
+watch_command_wrapper (const char *arg, int from_tty, bool internal)
 {
   watch_command_1 (arg, hw_write, from_tty, 0, internal);
 }
@@ -11088,14 +11088,14 @@ watch_command_wrapper (const char *arg, int from_tty, int internal)
 static void
 watch_maybe_just_location (const char *arg, int accessflag, int from_tty)
 {
-  int just_location = 0;
+  bool just_location = false;
 
   if (arg
       && (check_for_argument (&arg, "-location", sizeof ("-location") - 1)
          || check_for_argument (&arg, "-l", sizeof ("-l") - 1)))
-    just_location = 1;
+    just_location = true;
 
-  watch_command_1 (arg, accessflag, from_tty, just_location, 0);
+  watch_command_1 (arg, accessflag, from_tty, just_location, false);
 }
 
 static void
@@ -11105,7 +11105,7 @@ watch_command (const char *arg, int from_tty)
 }
 
 void
-rwatch_command_wrapper (const char *arg, int from_tty, int internal)
+rwatch_command_wrapper (const char *arg, int from_tty, bool internal)
 {
   watch_command_1 (arg, hw_read, from_tty, 0, internal);
 }
@@ -11117,7 +11117,7 @@ rwatch_command (const char *arg, int from_tty)
 }
 
 void
-awatch_command_wrapper (const char *arg, int from_tty, int internal)
+awatch_command_wrapper (const char *arg, int from_tty, bool internal)
 {
   watch_command_1 (arg, hw_access, from_tty, 0, internal);
 }
index b13522e236b53169eadf94a8e8998acfb48d23fa..4a65dd2dd4397629deb9142dd0e268ae30eb6d27 100644 (file)
@@ -1300,9 +1300,9 @@ const char *bpdisp_text (enum bpdisp disp);
 
 extern void break_command (const char *, int);
 
-extern void watch_command_wrapper (const char *, int, int);
-extern void awatch_command_wrapper (const char *, int, int);
-extern void rwatch_command_wrapper (const char *, int, int);
+extern void watch_command_wrapper (const char *, int, bool);
+extern void awatch_command_wrapper (const char *, int, bool);
+extern void rwatch_command_wrapper (const char *, int, bool);
 extern void tbreak_command (const char *, int);
 
 extern struct breakpoint_ops base_breakpoint_ops;
index 308f47714822220437b363cc896c107576ed4f8b..2626ee6d8765ff07a4cbdb8b94c0e3a257171ed8 100644 (file)
@@ -183,7 +183,7 @@ void
 fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
                    struct value **resultp,
                    std::vector<value_ref_ptr> *val_chain,
-                   int preserve_errors)
+                   bool preserve_errors)
 {
   struct value *mark, *new_mark, *result;
 
index 3835c02650dd16bc61ed23631aecb917b5f99d4a..ed311a6ba33824b30e9d07450142379504d95004 100644 (file)
@@ -463,13 +463,13 @@ mi_cmd_break_watch (const char *command, char **argv, int argc)
   switch (type)
     {
     case REG_WP:
-      watch_command_wrapper (expr, FROM_TTY, 0);
+      watch_command_wrapper (expr, FROM_TTY, false);
       break;
     case READ_WP:
-      rwatch_command_wrapper (expr, FROM_TTY, 0);
+      rwatch_command_wrapper (expr, FROM_TTY, false);
       break;
     case ACCESS_WP:
-      awatch_command_wrapper (expr, FROM_TTY, 0);
+      awatch_command_wrapper (expr, FROM_TTY, false);
       break;
     default:
       error (_("-break-watch: Unknown watchpoint type."));
index 7131134c10aa864d9074d07371cbac43d99d8c07..095ed577a09cf71e7d112e3d7bc7274bb194a820 100644 (file)
@@ -2484,13 +2484,13 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
   if (cond->elts[0].opcode != BINOP_EQUAL)
     return 0;
 
-  fetch_subexp_value (cond, &pc, &left_val, NULL, &left_chain, 0);
+  fetch_subexp_value (cond, &pc, &left_val, NULL, &left_chain, false);
   num_accesses_left = num_memory_accesses (left_chain);
 
   if (left_val == NULL || num_accesses_left < 0)
     return 0;
 
-  fetch_subexp_value (cond, &pc, &right_val, NULL, &right_chain, 0);
+  fetch_subexp_value (cond, &pc, &right_val, NULL, &right_chain, false);
   num_accesses_right = num_memory_accesses (right_chain);
 
   if (right_val == NULL || num_accesses_right < 0)
index bc57f4f901290330d59c86c13116f8a7658ab30f..2bd1999dc8f5711c70da340257f70daa12189ab3 100644 (file)
@@ -928,7 +928,7 @@ extern value *eval_skip_value (expression *exp);
 extern void fetch_subexp_value (struct expression *exp, int *pc,
                                struct value **valp, struct value **resultp,
                                std::vector<value_ref_ptr> *val_chain,
-                               int preserve_errors);
+                               bool preserve_errors);
 
 extern const char *extract_field_op (struct expression *exp, int *subexp);
 
This page took 0.042117 seconds and 4 git commands to generate.