From: Simon Marchi Date: Thu, 1 Mar 2018 15:51:21 +0000 (-0500) Subject: Propagate record_print_flags X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=0cb7c7b0bb79be910e261f3d30c58ace6b0d06d1;p=deliverable%2Fbinutils-gdb.git Propagate record_print_flags 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) : Likewise. (target_call_history_from): Likewise. (target_call_history_range): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 59265157b4..52079b4313 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2018-03-01 Simon Marchi + + * 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) : Likewise. + (target_call_history_from): Likewise. + (target_call_history_range): Likewise. + 2018-02-28 Sergio Durigan Junior Simon Marchi diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 2464672473..d9a1dc593f 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -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) diff --git a/gdb/record.c b/gdb/record.c index 9a476142e9..cd83b99a33 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -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); diff --git a/gdb/target-debug.h b/gdb/target-debug.h index d7fc001975..71d1a3f57e 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -172,6 +172,8 @@ 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) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index c7ebdbfb5b..2c5787f3c6 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -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); } diff --git a/gdb/target.c b/gdb/target.c index db7c09ba0f..197e7ff542 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -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 (¤t_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 (¤t_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 (¤t_target, begin, end, flags); } diff --git a/gdb/target.h b/gdb/target.h index e8972ca54a..de562139c7 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -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);