summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2010-02-24 01:06:27 +0000
committerPedro Alves <pedro@codesourcery.com>2010-02-24 01:06:27 +0000
commit8bf6105071ab1aa991a0761581fae80457f1a33d (patch)
tree09052c5e6248025ba6631407ed5d3ce9adf9f169 /gdb
parentf68240a5e33eced3032b0bfca5c00be8944fd275 (diff)
downloadgdb-8bf6105071ab1aa991a0761581fae80457f1a33d.tar.gz
* tracepoint.h (set_traceframe_number)
(cleanup_restore_current_traceframe): Declare. * tracepoint.c (set_traceframe_number): New. (struct current_traceframe_cleanup): New. (do_restore_current_traceframe_cleanup) (restore_current_traceframe_cleanup_dtor) (make_cleanup_restore_current_traceframe): New. * infrun.c: Include tracepoint.h. (fetch_inferior_event): Switch out and in of tfind mode.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/infrun.c11
-rw-r--r--gdb/tracepoint.c61
-rw-r--r--gdb/tracepoint.h3
4 files changed, 88 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2fa16f416b1..4a203971676 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,17 @@
2010-02-24 Pedro Alves <pedro@codesourcery.com>
+ Stan Shebs <stan@codesourcery.com>
+
+ * tracepoint.h (set_traceframe_number)
+ (cleanup_restore_current_traceframe): Declare.
+ * tracepoint.c (set_traceframe_number): New.
+ (struct current_traceframe_cleanup): New.
+ (do_restore_current_traceframe_cleanup)
+ (restore_current_traceframe_cleanup_dtor)
+ (make_cleanup_restore_current_traceframe): New.
+ * infrun.c: Include tracepoint.h.
+ (fetch_inferior_event): Switch out and in of tfind mode.
+
+2010-02-24 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (breakpoint_init_inferior): Also delete
bp_shlib_event breakpoints.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a715596bbf6..9a5c3a8ecc4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -51,6 +51,7 @@
#include "record.h"
#include "inline-frame.h"
#include "jit.h"
+#include "tracepoint.h"
/* Prototypes for local functions */
@@ -1761,6 +1762,16 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
"infrun: proceed (addr=%s, signal=%d, step=%d)\n",
paddress (gdbarch, addr), siggnal, step);
+ /* We're handling a live event, so make sure we're doing live
+ debugging. If we're looking at traceframes while the target is
+ running, we're going to need to get back to that mode after
+ handling the event. */
+ if (non_stop)
+ {
+ make_cleanup_restore_current_traceframe ();
+ set_traceframe_number (-1);
+ }
+
if (non_stop)
/* In non-stop, each thread is handled individually. The context
must already be set to the right thread here. */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index f38d6c1efb5..1d2785f7f78 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2538,6 +2538,67 @@ get_traceframe_number (void)
return traceframe_number;
}
+/* Make the traceframe NUM be the current trace frame. Does nothing
+ if NUM is already current. */
+
+void
+set_traceframe_number (int num)
+{
+ int newnum;
+
+ if (traceframe_number == num)
+ {
+ /* Nothing to do. */
+ return;
+ }
+
+ newnum = target_trace_find (tfind_number, num, 0, 0, NULL);
+
+ if (newnum != num)
+ warning (_("could not change traceframe"));
+
+ traceframe_number = newnum;
+
+ /* Changing the traceframe changes our view of registers and of the
+ frame chain. */
+ registers_changed ();
+}
+
+/* A cleanup used when switching away and back from tfind mode. */
+
+struct current_traceframe_cleanup
+{
+ /* The traceframe we were inspecting. */
+ int traceframe_number;
+};
+
+static void
+do_restore_current_traceframe_cleanup (void *arg)
+{
+ struct current_traceframe_cleanup *old = arg;
+
+ set_traceframe_number (old->traceframe_number);
+}
+
+static void
+restore_current_traceframe_cleanup_dtor (void *arg)
+{
+ struct current_traceframe_cleanup *old = arg;
+
+ xfree (old);
+}
+
+struct cleanup *
+make_cleanup_restore_current_traceframe (void)
+{
+ struct current_traceframe_cleanup *old;
+
+ old = xmalloc (sizeof (struct current_traceframe_cleanup));
+ old->traceframe_number = traceframe_number;
+
+ return make_cleanup_dtor (do_restore_current_traceframe_cleanup, old,
+ restore_current_traceframe_cleanup_dtor);
+}
/* Given a number and address, return an uploaded tracepoint with that
number, creating if necessary. */
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index d26c9505089..819a67a2fd9 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -140,6 +140,9 @@ extern void (*deprecated_trace_find_hook) (char *arg, int from_tty);
extern void (*deprecated_trace_start_stop_hook) (int start, int from_tty);
int get_traceframe_number (void);
+void set_traceframe_number (int);
+struct cleanup *make_cleanup_restore_current_traceframe (void);
+
void free_actions (struct breakpoint *);
enum actionline_type validate_actionline (char **, struct breakpoint *);