aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-06-26 05:35:45 +0000
committerYao Qi <yao@codesourcery.com>2013-06-26 05:35:45 +0000
commitddacd3c8e9401081d2961a397d9db58568d10344 (patch)
treea2adc2cfc435ed8de039bd5c8e4032751d1b5e8d /gdb
parent05796b355f258ee70743e4deb09ea2ad4a3a84ac (diff)
downloadgdb-ddacd3c8e9401081d2961a397d9db58568d10344.zip
gdb-ddacd3c8e9401081d2961a397d9db58568d10344.tar.gz
gdb-ddacd3c8e9401081d2961a397d9db58568d10344.tar.bz2
gdb/
2013-06-26 Pedro Alves <pedro@codesourcery.com> Yao Qi <yao@codesourcery.com> * tracepoint.c (trace_dump_command): Move code to ... (get_traceframe_location): ... here. New.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/tracepoint.c76
2 files changed, 53 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00b8cbc..1397e73 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,12 @@
2013-06-26 Pedro Alves <pedro@codesourcery.com>
Yao Qi <yao@codesourcery.com>
+ * tracepoint.c (trace_dump_command): Move code to ...
+ (get_traceframe_location): ... here. New.
+
+2013-06-26 Pedro Alves <pedro@codesourcery.com>
+ Yao Qi <yao@codesourcery.com>
+
* tracepoint.c (trace_dump_command): GDB emits an error
instead of a warning when a traceframe is not selected.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 05f51ea..61e9efa 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2933,6 +2933,48 @@ trace_dump_actions (struct command_line *action,
}
}
+/* Return bp_location of the tracepoint associated with the current
+ traceframe. Set *STEPPING_FRAME_P to 1 if the current traceframe
+ is a stepping traceframe. */
+
+static struct bp_location *
+get_traceframe_location (int *stepping_frame_p)
+{
+ struct tracepoint *t;
+ struct bp_location *tloc;
+ struct regcache *regcache;
+
+ if (tracepoint_number == -1)
+ error (_("No current trace frame."));
+
+ t = get_tracepoint (tracepoint_number);
+
+ if (t == NULL)
+ error (_("No known tracepoint matches 'current' tracepoint #%d."),
+ tracepoint_number);
+
+ /* The current frame is a trap frame if the frame PC is equal to the
+ tracepoint PC. If not, then the current frame was collected
+ during single-stepping. */
+ regcache = get_current_regcache ();
+
+ /* If the traceframe's address matches any of the tracepoint's
+ locations, assume it is a direct hit rather than a while-stepping
+ frame. (FIXME this is not reliable, should record each frame's
+ type.) */
+ for (tloc = t->base.loc; tloc; tloc = tloc->next)
+ if (tloc->address == regcache_read_pc (regcache))
+ {
+ *stepping_frame_p = 0;
+ return tloc;
+ }
+
+ /* If this is a stepping frame, we don't know which location
+ triggered. The first is as good (or bad) a guess as any... */
+ *stepping_frame_p = 1;
+ return t->base.loc;
+}
+
/* Return all the actions, including default collect, of a tracepoint
T. It constructs cleanups into the chain, and leaves the caller to
handle them (call do_cleanups). */
@@ -2973,43 +3015,19 @@ all_tracepoint_actions_and_cleanup (struct breakpoint *t)
static void
trace_dump_command (char *args, int from_tty)
{
- struct regcache *regcache;
- struct tracepoint *t;
int stepping_frame = 0;
struct bp_location *loc;
- char *default_collect_line = NULL;
- struct command_line *actions, *default_collect_action = NULL;
struct cleanup *old_chain;
+ struct command_line *actions;
- if (tracepoint_number == -1)
- error (_("No current trace frame."));
-
- old_chain = make_cleanup (null_cleanup, NULL);
- t = get_tracepoint (tracepoint_number);
-
- if (t == NULL)
- error (_("No known tracepoint matches 'current' tracepoint #%d."),
- tracepoint_number);
+ /* This throws an error is not inspecting a trace frame. */
+ loc = get_traceframe_location (&stepping_frame);
printf_filtered ("Data collected at tracepoint %d, trace frame %d:\n",
tracepoint_number, traceframe_number);
- /* The current frame is a trap frame if the frame PC is equal
- to the tracepoint PC. If not, then the current frame was
- collected during single-stepping. */
-
- regcache = get_current_regcache ();
-
- /* If the traceframe's address matches any of the tracepoint's
- locations, assume it is a direct hit rather than a while-stepping
- frame. (FIXME this is not reliable, should record each frame's
- type.) */
- stepping_frame = 1;
- for (loc = t->base.loc; loc; loc = loc->next)
- if (loc->address == regcache_read_pc (regcache))
- stepping_frame = 0;
-
- actions = all_tracepoint_actions_and_cleanup (&t->base);
+ old_chain = make_cleanup (null_cleanup, NULL);
+ actions = all_tracepoint_actions_and_cleanup (loc->owner);
trace_dump_actions (actions, 0, stepping_frame, from_tty);