From 15984c13c729e1f05eb789a3883df82994d5a593 Mon Sep 17 00:00:00 2001 From: Markus Metzger Date: Mon, 11 Mar 2013 08:50:05 +0000 Subject: [PATCH] Add command to print the function names from recorded instructions. This command provides a quick high-level overview over the recorded execution log at function granularity without having to reverse-step. gdb/ * target.c (target_call_history, target_call_history_from, target_call_history_range): New. * target.h (target_ops) : New fields. (target_call_history, target_call_history_from, target_call_history_range): New declaration. * record.c (get_call_history_modifiers, cmd_record_call_history, record_call_history_size): New. (_initialize_record): Add the "record function-call-history" command. Add "set/show record function-call-history-size" commands. * record.h (record_print_flag): New. --- gdb/ChangeLog | 14 +++++ gdb/record.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/record.h | 10 ++++ gdb/target.c | 51 +++++++++++++++++ gdb/target.h | 24 ++++++++ 5 files changed, 248 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f92757c607..7383927dd59 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2013-03-11 Markus Metzger + + * target.c (target_call_history, target_call_history_from, + target_call_history_range): New. + * target.h (target_ops) : New fields. + (target_call_history, target_call_history_from, + target_call_history_range): New declaration. + * record.c (get_call_history_modifiers, cmd_record_call_history, + record_call_history_size): New. + (_initialize_record): Add the "record function-call-history" command. + Add "set/show record function-call-history-size" commands. + * record.h (record_print_flag): New. + 2013-03-11 Markus Metzger * target.h (target_ops) beneath) + if (t->to_call_history != NULL) + { + t->to_call_history (size, flags); + return; + } + + tcomplain (); +} + +/* See target.h. */ + +void +target_call_history_from (ULONGEST begin, int size, int flags) +{ + struct target_ops *t; + + for (t = current_target.beneath; t != NULL; t = t->beneath) + if (t->to_call_history_from != NULL) + { + t->to_call_history_from (begin, size, flags); + return; + } + + tcomplain (); +} + +/* See target.h. */ + +void +target_call_history_range (ULONGEST begin, ULONGEST end, int flags) +{ + struct target_ops *t; + + for (t = current_target.beneath; t != NULL; t = t->beneath) + if (t->to_call_history_range != NULL) + { + t->to_call_history_range (begin, end, flags); + return; + } + + tcomplain (); +} + static void debug_to_prepare_to_store (struct regcache *regcache) { diff --git a/gdb/target.h b/gdb/target.h index 32c434b1e00..c030ee68b21 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -922,6 +922,21 @@ struct target_ops BEGIN (inclusive) to instruction END (exclusive). */ void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags); + /* 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) (int size, int flags); + + /* Print a function trace of the recorded execution trace starting + at function FROM. + If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print + SIZE functions after FROM. */ + void (*to_call_history_from) (ULONGEST begin, int size, int flags); + + /* Print a function trace of an execution trace section from function BEGIN + (inclusive) to function END (exclusive). */ + void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags); + int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -2022,4 +2037,13 @@ extern void target_insn_history_from (ULONGEST from, int size, int flags); /* See to_insn_history_range. */ extern void target_insn_history_range (ULONGEST begin, ULONGEST end, int flags); +/* See to_call_history. */ +extern void target_call_history (int size, int flags); + +/* See to_call_history_from. */ +extern void target_call_history_from (ULONGEST begin, int size, int flags); + +/* See to_call_history_range. */ +extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags); + #endif /* !defined (TARGET_H) */ -- 2.30.2