summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2008-09-30 23:38:48 +0000
committerMichael Snyder <msnyder@specifix.com>2008-09-30 23:38:48 +0000
commitdd75ec9dc11a1f2241b85832a0a5962c26a8343f (patch)
tree548a862003c6793eeca5944b2f996a7375631cb0
parent67fdd70acf9e26076232f4d9ea6c34d4d6391d1b (diff)
downloadgdb-dd75ec9dc11a1f2241b85832a0a5962c26a8343f.tar.gz
2008-09-30 Michael Snyder <msnyder@vmware.com>
Remote interface for reverse debugging. * remote.c (remote_get_execdir, remote_set_execdir): New methods. (remote_vcont_resume): Jump out if attempting reverse execution. (remote_resume): Check for reverse exec direction, and send appropriate command to target. (remote_wait): Check target response for NO_HISTORY status. Also check for empty reply (target doesn't understand "bs" or "bc). (_initialize_remote): Add new methods to remote target vector.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/remote.c52
2 files changed, 58 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e543b726bc9..306c7105535 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -7,6 +7,15 @@
* target.c (target_get_execdir): New generic method.
(target_set_execdir): Ditto.
+ Remote interface for reverse debugging.
+ * remote.c (remote_get_execdir, remote_set_execdir): New methods.
+ (remote_vcont_resume): Jump out if attempting reverse execution.
+ (remote_resume): Check for reverse exec direction, and send
+ appropriate command to target.
+ (remote_wait): Check target response for NO_HISTORY status.
+ Also check for empty reply (target doesn't understand "bs" or "bc).
+ (_initialize_remote): Add new methods to remote target vector.
+
2008-09-30 Paul Hilfinger <hilfinger@adacore.com>
* ada-lang.c (ada_modulus): Correct to avoid sign problem with
diff --git a/gdb/remote.c b/gdb/remote.c
index 9dacd1777e6..5fe6371ece7 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3385,7 +3385,15 @@ remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
set_continue_thread (ptid);
buf = rs->buf;
- if (siggnal != TARGET_SIGNAL_0)
+ if (target_get_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);
@@ -3651,8 +3659,15 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
/* We're out of sync with the target now. Did it continue or not?
Not is more likely, so report a stop. */
warning (_("Remote failure reply: %s"), buf);
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = TARGET_SIGNAL_0;
+ if (buf[1] == '0' && buf[2] == '6')
+ {
+ status->kind = TARGET_WAITKIND_NO_HISTORY;
+ }
+ else
+ {
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_0;
+ }
goto got_status;
case 'F': /* File-I/O request. */
remote_fileio_request (buf);
@@ -7545,6 +7560,35 @@ remote_command (char *args, int from_tty)
help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
}
+/* Reverse execution.
+ TODO: set up as a capability. */
+static enum exec_direction_kind remote_execdir = EXEC_FORWARD;
+
+static enum exec_direction_kind remote_get_execdir (void)
+{
+ if (remote_debug && info_verbose)
+ printf_filtered ("remote execdir is %s\n",
+ remote_execdir == EXEC_FORWARD ? "forward" :
+ remote_execdir == EXEC_REVERSE ? "reverse" :
+ "unknown");
+ return remote_execdir;
+}
+
+static int remote_set_execdir (enum exec_direction_kind dir)
+{
+ if (remote_debug && info_verbose)
+ printf_filtered ("Set remote execdir: %s\n",
+ dir == EXEC_FORWARD ? "forward" :
+ dir == EXEC_REVERSE ? "reverse" :
+ "bad direction");
+
+ /* TODO: check target for capability. */
+ if (dir == EXEC_FORWARD || dir == EXEC_REVERSE)
+ return (remote_execdir = dir);
+ else
+ return EXEC_ERROR;
+}
+
static void
init_remote_ops (void)
{
@@ -7593,6 +7637,8 @@ Specify the serial device it is connected to\n\
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_get_execdir = remote_get_execdir;
+ remote_ops.to_set_execdir = remote_set_execdir;
remote_ops.to_magic = OPS_MAGIC;
remote_ops.to_memory_map = remote_memory_map;
remote_ops.to_flash_erase = remote_flash_erase;