Propagate record_print_flags
authorSimon Marchi <simon.marchi@ericsson.com>
Thu, 1 Mar 2018 15:51:21 +0000 (10:51 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 1 Mar 2018 15:51:21 +0000 (10:51 -0500)
These flags are returned as an int by get_call_history_modifiers, and
get cast back to record_print_flags in the btrace code.  Instead, we can
make the arguments of that type from start to end.

gdb/ChangeLog:

* record.c (get_call_history_modifiers): Return a
record_print_flags.
(cmd_record_call_history): Adjust.
* record-btrace.c (record_btrace_call_history): Adjust.
(record_btrace_call_history_range): Adjust.
(record_btrace_call_history_from): Adjust.
* target-debug.h (target_debug_print_record_print_flags): New.
* target-delegates.c: Re-generate.
* target.c (target_call_history): Change flags type.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.
* target.h (struct target_ops) <target_call_history>: Likewise.
(target_call_history_from): Likewise.
(target_call_history_range): Likewise.

gdb/ChangeLog
gdb/record-btrace.c
gdb/record.c
gdb/target-debug.h
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 59265157b46a1224ba51d40d83cf5caa9e306472..52079b4313100e648453268494b1b4b821fe0ca6 100644 (file)
@@ -1,3 +1,20 @@
+2018-03-01  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * record.c (get_call_history_modifiers): Return a
+       record_print_flags.
+       (cmd_record_call_history): Adjust.
+       * record-btrace.c (record_btrace_call_history): Adjust.
+       (record_btrace_call_history_range): Adjust.
+       (record_btrace_call_history_from): Adjust.
+       * target-debug.h (target_debug_print_record_print_flags): New.
+       * target-delegates.c: Re-generate.
+       * target.c (target_call_history): Change flags type.
+       (target_call_history_from): Likewise.
+       (target_call_history_range): Likewise.
+       * target.h (struct target_ops) <target_call_history>: Likewise.
+       (target_call_history_from): Likewise.
+       (target_call_history_range): Likewise.
+
 2018-02-28  Sergio Durigan Junior  <sergiodj@redhat.com>
            Simon Marchi  <simon.marchi@polymtl.ca>
 
index 2464672473c358e994332a60c066df822971de5c..d9a1dc593f4908dc5c2088c9681bb0ef7b7f9f86 100644 (file)
@@ -1074,14 +1074,14 @@ btrace_call_history (struct ui_out *uiout,
 /* The to_call_history method of target record-btrace.  */
 
 static void
-record_btrace_call_history (struct target_ops *self, int size, int int_flags)
+record_btrace_call_history (struct target_ops *self, int size,
+                           record_print_flags flags)
 {
   struct btrace_thread_info *btinfo;
   struct btrace_call_history *history;
   struct btrace_call_iterator begin, end;
   struct ui_out *uiout;
   unsigned int context, covered;
-  record_print_flags flags = (enum record_print_flag) int_flags;
 
   uiout = current_uiout;
   ui_out_emit_tuple tuple_emitter (uiout, "insn history");
@@ -1095,7 +1095,7 @@ record_btrace_call_history (struct target_ops *self, int size, int int_flags)
     {
       struct btrace_insn_iterator *replay;
 
-      DEBUG ("call-history (0x%x): %d", int_flags, size);
+      DEBUG ("call-history (0x%x): %d", (int) flags, size);
 
       /* If we're replaying, we start at the replay position.  Otherwise, we
         start at the tail of the trace.  */
@@ -1130,7 +1130,7 @@ record_btrace_call_history (struct target_ops *self, int size, int int_flags)
       begin = history->begin;
       end = history->end;
 
-      DEBUG ("call-history (0x%x): %d, prev: [%u; %u)", int_flags, size,
+      DEBUG ("call-history (0x%x): %d, prev: [%u; %u)", (int) flags, size,
             btrace_call_number (&begin), btrace_call_number (&end));
 
       if (size < 0)
@@ -1163,21 +1163,20 @@ record_btrace_call_history (struct target_ops *self, int size, int int_flags)
 static void
 record_btrace_call_history_range (struct target_ops *self,
                                  ULONGEST from, ULONGEST to,
-                                 int int_flags)
+                                 record_print_flags flags)
 {
   struct btrace_thread_info *btinfo;
   struct btrace_call_iterator begin, end;
   struct ui_out *uiout;
   unsigned int low, high;
   int found;
-  record_print_flags flags = (enum record_print_flag) int_flags;
 
   uiout = current_uiout;
   ui_out_emit_tuple tuple_emitter (uiout, "func history");
   low = from;
   high = to;
 
-  DEBUG ("call-history (0x%x): [%u; %u)", int_flags, low, high);
+  DEBUG ("call-history (0x%x): [%u; %u)", (int) flags, low, high);
 
   /* Check for wrap-arounds.  */
   if (low != from || high != to)
@@ -1213,10 +1212,9 @@ record_btrace_call_history_range (struct target_ops *self,
 static void
 record_btrace_call_history_from (struct target_ops *self,
                                 ULONGEST from, int size,
-                                int int_flags)
+                                record_print_flags flags)
 {
   ULONGEST begin, end, context;
-  record_print_flags flags = (enum record_print_flag) int_flags;
 
   context = abs (size);
   if (context == 0)
index 9a476142e9d2b58dd293409e1a975eaee5153b79..cd83b99a33b3dceeb0384d15a972e0e2f4752168 100644 (file)
@@ -615,14 +615,11 @@ cmd_record_insn_history (const char *arg, int from_tty)
 
 /* Read function-call-history modifiers from an argument string.  */
 
-static int
+static record_print_flags
 get_call_history_modifiers (const char **arg)
 {
-  int modifiers;
-  const char *args;
-
-  modifiers = 0;
-  args = *arg;
+  record_print_flags modifiers = 0;
+  const char *args = *arg;
 
   if (args == NULL)
     return modifiers;
@@ -672,13 +669,11 @@ get_call_history_modifiers (const char **arg)
 static void
 cmd_record_call_history (const char *arg, int from_tty)
 {
-  int flags, size;
-
   require_record_target ();
 
-  flags = get_call_history_modifiers (&arg);
+  record_print_flags flags = get_call_history_modifiers (&arg);
 
-  size = command_size_to_target_size (record_call_history_size);
+  int size = command_size_to_target_size (record_call_history_size);
 
   if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
     target_call_history (size, flags);
index d7fc00197509ccb335e8146546396aa4e01a25d5..71d1a3f57e8f35eae1be02a66187a49495e37e55 100644 (file)
   target_debug_do_print (host_address_to_string (X.data ()))
 #define target_debug_print_inferior_p(inf) \
   target_debug_do_print (host_address_to_string (inf))
+#define target_debug_print_record_print_flags(X) \
+  target_debug_do_print (plongest (X))
 
 static void
 target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)
index c7ebdbfb5b797d20b9ea569c6d86289c55f07d9b..2c5787f3c640ff59d54d6dcd9eebfe3a5d8fd1f7 100644 (file)
@@ -3961,20 +3961,20 @@ debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2,
 }
 
 static void
-delegate_call_history (struct target_ops *self, int arg1, int arg2)
+delegate_call_history (struct target_ops *self, int arg1, record_print_flags arg2)
 {
   self = self->beneath;
   self->to_call_history (self, arg1, arg2);
 }
 
 static void
-tdefault_call_history (struct target_ops *self, int arg1, int arg2)
+tdefault_call_history (struct target_ops *self, int arg1, record_print_flags arg2)
 {
   tcomplain ();
 }
 
 static void
-debug_call_history (struct target_ops *self, int arg1, int arg2)
+debug_call_history (struct target_ops *self, int arg1, record_print_flags arg2)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history (...)\n", debug_target.to_shortname);
   debug_target.to_call_history (&debug_target, arg1, arg2);
@@ -3983,25 +3983,25 @@ debug_call_history (struct target_ops *self, int arg1, int arg2)
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_int (arg1);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  target_debug_print_record_print_flags (arg2);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
 static void
-delegate_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+delegate_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, record_print_flags arg3)
 {
   self = self->beneath;
   self->to_call_history_from (self, arg1, arg2, arg3);
 }
 
 static void
-tdefault_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+tdefault_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, record_print_flags arg3)
 {
   tcomplain ();
 }
 
 static void
-debug_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+debug_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, record_print_flags arg3)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history_from (...)\n", debug_target.to_shortname);
   debug_target.to_call_history_from (&debug_target, arg1, arg2, arg3);
@@ -4012,25 +4012,25 @@ debug_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int a
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_int (arg2);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_int (arg3);
+  target_debug_print_record_print_flags (arg3);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
 static void
-delegate_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+delegate_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, record_print_flags arg3)
 {
   self = self->beneath;
   self->to_call_history_range (self, arg1, arg2, arg3);
 }
 
 static void
-tdefault_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+tdefault_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, record_print_flags arg3)
 {
   tcomplain ();
 }
 
 static void
-debug_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+debug_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, record_print_flags arg3)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history_range (...)\n", debug_target.to_shortname);
   debug_target.to_call_history_range (&debug_target, arg1, arg2, arg3);
@@ -4041,7 +4041,7 @@ debug_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2,
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_ULONGEST (arg2);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_int (arg3);
+  target_debug_print_record_print_flags (arg3);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
index db7c09ba0f3b0ed3996cc8ecc79764eff6ddfdf8..197e7ff5420e63e04e70495b903595be45381c7d 100644 (file)
@@ -3809,7 +3809,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end,
 /* See target.h.  */
 
 void
-target_call_history (int size, int flags)
+target_call_history (int size, record_print_flags flags)
 {
   current_target.to_call_history (&current_target, size, flags);
 }
@@ -3817,7 +3817,7 @@ target_call_history (int size, int flags)
 /* See target.h.  */
 
 void
-target_call_history_from (ULONGEST begin, int size, int flags)
+target_call_history_from (ULONGEST begin, int size, record_print_flags flags)
 {
   current_target.to_call_history_from (&current_target, begin, size, flags);
 }
@@ -3825,7 +3825,7 @@ target_call_history_from (ULONGEST begin, int size, int flags)
 /* See target.h.  */
 
 void
-target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
+target_call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
 {
   current_target.to_call_history_range (&current_target, begin, end, flags);
 }
index e8972ca54a111a972daaa76da6fa664ef0f9b61d..de562139c74b44648eb58754cf42956716e92d23 100644 (file)
@@ -1217,7 +1217,7 @@ struct target_ops
     /* Print a function trace of the recorded execution trace.
        If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
        succeeding functions.  */
-    void (*to_call_history) (struct target_ops *, int size, int flags)
+    void (*to_call_history) (struct target_ops *, int size, record_print_flags flags)
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Print a function trace of the recorded execution trace starting
@@ -1225,13 +1225,13 @@ struct target_ops
        If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
        SIZE functions after FROM.  */
     void (*to_call_history_from) (struct target_ops *,
-                                 ULONGEST begin, int size, int flags)
+                                 ULONGEST begin, int size, record_print_flags flags)
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Print a function trace of an execution trace section from function BEGIN
        (inclusive) to function END (inclusive).  */
     void (*to_call_history_range) (struct target_ops *,
-                                  ULONGEST begin, ULONGEST end, int flags)
+                                  ULONGEST begin, ULONGEST end, record_print_flags flags)
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
@@ -2492,13 +2492,15 @@ extern void target_insn_history_range (ULONGEST begin, ULONGEST end,
                                       gdb_disassembly_flags flags);
 
 /* See to_call_history.  */
-extern void target_call_history (int size, int flags);
+extern void target_call_history (int size, record_print_flags flags);
 
 /* See to_call_history_from.  */
-extern void target_call_history_from (ULONGEST begin, int size, int flags);
+extern void target_call_history_from (ULONGEST begin, int size,
+                                     record_print_flags flags);
 
 /* See to_call_history_range.  */
-extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags);
+extern void target_call_history_range (ULONGEST begin, ULONGEST end,
+                                      record_print_flags flags);
 
 /* See to_prepare_to_generate_core.  */
 extern void target_prepare_to_generate_core (void);
This page took 0.03562 seconds and 4 git commands to generate.