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) <target_call_history>: Likewise.
	(target_call_history_from): Likewise.
	(target_call_history_range): Likewise.
This commit is contained in:
Simon Marchi 2018-03-01 10:51:21 -05:00
parent 8305403a1f
commit 0cb7c7b0bb
7 changed files with 54 additions and 40 deletions

View 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> 2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca> Simon Marchi <simon.marchi@polymtl.ca>

View file

@ -1074,14 +1074,14 @@ btrace_call_history (struct ui_out *uiout,
/* The to_call_history method of target record-btrace. */ /* The to_call_history method of target record-btrace. */
static void 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_thread_info *btinfo;
struct btrace_call_history *history; struct btrace_call_history *history;
struct btrace_call_iterator begin, end; struct btrace_call_iterator begin, end;
struct ui_out *uiout; struct ui_out *uiout;
unsigned int context, covered; unsigned int context, covered;
record_print_flags flags = (enum record_print_flag) int_flags;
uiout = current_uiout; uiout = current_uiout;
ui_out_emit_tuple tuple_emitter (uiout, "insn history"); 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; 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 /* If we're replaying, we start at the replay position. Otherwise, we
start at the tail of the trace. */ 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; begin = history->begin;
end = history->end; 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)); btrace_call_number (&begin), btrace_call_number (&end));
if (size < 0) if (size < 0)
@ -1163,21 +1163,20 @@ record_btrace_call_history (struct target_ops *self, int size, int int_flags)
static void static void
record_btrace_call_history_range (struct target_ops *self, record_btrace_call_history_range (struct target_ops *self,
ULONGEST from, ULONGEST to, ULONGEST from, ULONGEST to,
int int_flags) record_print_flags flags)
{ {
struct btrace_thread_info *btinfo; struct btrace_thread_info *btinfo;
struct btrace_call_iterator begin, end; struct btrace_call_iterator begin, end;
struct ui_out *uiout; struct ui_out *uiout;
unsigned int low, high; unsigned int low, high;
int found; int found;
record_print_flags flags = (enum record_print_flag) int_flags;
uiout = current_uiout; uiout = current_uiout;
ui_out_emit_tuple tuple_emitter (uiout, "func history"); ui_out_emit_tuple tuple_emitter (uiout, "func history");
low = from; low = from;
high = to; 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. */ /* Check for wrap-arounds. */
if (low != from || high != to) if (low != from || high != to)
@ -1213,10 +1212,9 @@ record_btrace_call_history_range (struct target_ops *self,
static void static void
record_btrace_call_history_from (struct target_ops *self, record_btrace_call_history_from (struct target_ops *self,
ULONGEST from, int size, ULONGEST from, int size,
int int_flags) record_print_flags flags)
{ {
ULONGEST begin, end, context; ULONGEST begin, end, context;
record_print_flags flags = (enum record_print_flag) int_flags;
context = abs (size); context = abs (size);
if (context == 0) if (context == 0)

View file

@ -615,14 +615,11 @@ cmd_record_insn_history (const char *arg, int from_tty)
/* Read function-call-history modifiers from an argument string. */ /* Read function-call-history modifiers from an argument string. */
static int static record_print_flags
get_call_history_modifiers (const char **arg) get_call_history_modifiers (const char **arg)
{ {
int modifiers; record_print_flags modifiers = 0;
const char *args; const char *args = *arg;
modifiers = 0;
args = *arg;
if (args == NULL) if (args == NULL)
return modifiers; return modifiers;
@ -672,13 +669,11 @@ get_call_history_modifiers (const char **arg)
static void static void
cmd_record_call_history (const char *arg, int from_tty) cmd_record_call_history (const char *arg, int from_tty)
{ {
int flags, size;
require_record_target (); 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) if (arg == NULL || *arg == 0 || strcmp (arg, "+") == 0)
target_call_history (size, flags); target_call_history (size, flags);

View file

@ -172,6 +172,8 @@
target_debug_do_print (host_address_to_string (X.data ())) target_debug_do_print (host_address_to_string (X.data ()))
#define target_debug_print_inferior_p(inf) \ #define target_debug_print_inferior_p(inf) \
target_debug_do_print (host_address_to_string (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 static void
target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status) target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)

View file

@ -3961,20 +3961,20 @@ debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2,
} }
static void 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 = self->beneath;
self->to_call_history (self, arg1, arg2); self->to_call_history (self, arg1, arg2);
} }
static void 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 (); tcomplain ();
} }
static void 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); fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history (...)\n", debug_target.to_shortname);
debug_target.to_call_history (&debug_target, arg1, arg2); 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); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1); target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2); target_debug_print_record_print_flags (arg2);
fputs_unfiltered (")\n", gdb_stdlog); fputs_unfiltered (")\n", gdb_stdlog);
} }
static void 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 = self->beneath;
self->to_call_history_from (self, arg1, arg2, arg3); self->to_call_history_from (self, arg1, arg2, arg3);
} }
static void 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 (); tcomplain ();
} }
static void 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); 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); 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); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2); target_debug_print_int (arg2);
fputs_unfiltered (", ", gdb_stdlog); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg3); target_debug_print_record_print_flags (arg3);
fputs_unfiltered (")\n", gdb_stdlog); fputs_unfiltered (")\n", gdb_stdlog);
} }
static void 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 = self->beneath;
self->to_call_history_range (self, arg1, arg2, arg3); self->to_call_history_range (self, arg1, arg2, arg3);
} }
static void 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 (); tcomplain ();
} }
static void 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); 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); 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); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg2); target_debug_print_ULONGEST (arg2);
fputs_unfiltered (", ", gdb_stdlog); fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg3); target_debug_print_record_print_flags (arg3);
fputs_unfiltered (")\n", gdb_stdlog); fputs_unfiltered (")\n", gdb_stdlog);
} }

View file

@ -3809,7 +3809,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end,
/* See target.h. */ /* See target.h. */
void 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); current_target.to_call_history (&current_target, size, flags);
} }
@ -3817,7 +3817,7 @@ target_call_history (int size, int flags)
/* See target.h. */ /* See target.h. */
void 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); 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. */ /* See target.h. */
void 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); current_target.to_call_history_range (&current_target, begin, end, flags);
} }

View file

@ -1217,7 +1217,7 @@ struct target_ops
/* Print a function trace of the recorded execution trace. /* Print a function trace of the recorded execution trace.
If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
succeeding functions. */ 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 ()); TARGET_DEFAULT_NORETURN (tcomplain ());
/* Print a function trace of the recorded execution trace starting /* 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 If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
SIZE functions after FROM. */ SIZE functions after FROM. */
void (*to_call_history_from) (struct target_ops *, 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 ()); TARGET_DEFAULT_NORETURN (tcomplain ());
/* Print a function trace of an execution trace section from function BEGIN /* Print a function trace of an execution trace section from function BEGIN
(inclusive) to function END (inclusive). */ (inclusive) to function END (inclusive). */
void (*to_call_history_range) (struct target_ops *, 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 ()); TARGET_DEFAULT_NORETURN (tcomplain ());
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a /* 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); gdb_disassembly_flags flags);
/* See to_call_history. */ /* 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. */ /* 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. */ /* 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. */ /* See to_prepare_to_generate_core. */
extern void target_prepare_to_generate_core (void); extern void target_prepare_to_generate_core (void);