This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Resubmit reverse debug [2/5]
- From: Michael Snyder <msnyder at vmware dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 17 Oct 2008 12:42:14 -0700
- Subject: Re: [RFA] Resubmit reverse debug [2/5]
- References: <48EC183A.6000309@vmware.com>
Committed, as attached:
2008-10-17 Michael Snyder <msnyder@vmware.com>
Remote interface for reverse debugging.
* remote.c (remote_can_execute_reverse): New target method.
(remote_resume): Check for reverse exec direction, and send
appropriate command to target.
(remote_wait_as): Check target response for NO_HISTORY status.
Also check for empty reply (target doesn't understand "bs" or "bc).
(remote_vcont_resume): Jump out if attempting reverse execution.
* inferior.h (enum exec_direction_kind): New enum.
(execution_direction): Export new execution state variable.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.320
diff -u -p -r1.320 remote.c
--- remote.c 17 Oct 2008 01:08:08 -0000 1.320
+++ remote.c 17 Oct 2008 19:05:56 -0000
@@ -3443,7 +3443,15 @@ remote_resume (ptid_t ptid, int step, en
set_continue_thread (ptid);
buf = rs->buf;
- if (siggnal != TARGET_SIGNAL_0)
+ if (execution_direction == EXEC_REVERSE)
+ {
+ /* We don't pass signals to the target in reverse exec mode. */
+ if (info_verbose && siggnal != TARGET_SIGNAL_0)
+ warning (" - Can't pass signal %d to target in reverse: ignored.\n",
+ siggnal);
+ strcpy (buf, step ? "bs" : "bc");
+ }
+ else if (siggnal != TARGET_SIGNAL_0)
{
buf[0] = step ? 'S' : 'C';
buf[1] = tohex (((int) siggnal >> 4) & 0xf);
@@ -3671,6 +3679,7 @@ remote_wait_as (ptid_t ptid, struct targ
ptid_t event_ptid = null_ptid;
ULONGEST addr;
int solibs_changed = 0;
+ int replay_event = 0;
char *buf, *p;
status->kind = TARGET_WAITKIND_IGNORE;
@@ -3786,6 +3795,16 @@ Packet: '%s'\n"),
solibs_changed = 1;
p = p_temp;
}
+ else if (strncmp (p, "replaylog", p1 - p) == 0)
+ {
+ /* NO_HISTORY event.
+ p1 will indicate "begin" or "end", but
+ it makes no difference for now, so ignore it. */
+ replay_event = 1;
+ p_temp = strchr (p1 + 1, ';');
+ if (p_temp)
+ p = p_temp;
+ }
else
{
/* Silently skip unknown optional info. */
@@ -3831,6 +3850,8 @@ Packet: '%s'\n"),
case 'S': /* Old style status, just signal only. */
if (solibs_changed)
status->kind = TARGET_WAITKIND_LOADED;
+ else if (replay_event)
+ status->kind = TARGET_WAITKIND_NO_HISTORY;
else
{
status->kind = TARGET_WAITKIND_STOPPED;
@@ -7628,6 +7649,14 @@ remote_command (char *args, int from_tty
help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
}
+static int remote_target_can_reverse = 1;
+
+static int
+remote_can_execute_reverse (void)
+{
+ return remote_target_can_reverse;
+}
+
static void
init_remote_ops (void)
{
@@ -7676,6 +7705,7 @@ Specify the serial device it is connecte
remote_ops.to_has_registers = 1;
remote_ops.to_has_execution = 1;
remote_ops.to_has_thread_control = tc_schedlock; /* can lock scheduler */
+ remote_ops.to_can_execute_reverse = remote_can_execute_reverse;
remote_ops.to_magic = OPS_MAGIC;
remote_ops.to_memory_map = remote_memory_map;
remote_ops.to_flash_erase = remote_flash_erase;
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.108
diff -u -p -r1.108 inferior.h
--- inferior.h 22 Sep 2008 15:21:30 -0000 1.108
+++ inferior.h 17 Oct 2008 19:05:56 -0000
@@ -339,6 +339,16 @@ enum stop_kind
STOP_QUIETLY_NO_SIGSTOP
};
+/* Reverse execution. */
+enum exec_direction_kind
+ {
+ EXEC_FORWARD,
+ EXEC_REVERSE,
+ EXEC_ERROR
+ };
+
+extern enum exec_direction_kind execution_direction;
+
/* Nonzero if proceed is being used for a "finish" command or a similar
situation when stop_registers should be saved. */