summaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-05-23 17:17:50 +0000
committerPedro Alves <palves@redhat.com>2013-05-23 17:17:50 +0000
commitc2d6af84da44465f30e3bb487721128dfe03d0e4 (patch)
tree6d1037aa6d79b5fcebf8e353c5f013128e1ca8a4 /gdb/gdbserver/server.c
parentc1e36e3e919994da4fa0da232b173939f3e44bb8 (diff)
downloadbinutils-gdb-c2d6af84da44465f30e3bb487721128dfe03d0e4.tar.gz
range stepping: gdbserver (x86 GNU/Linux)
This patch adds support for range stepping to GDBserver, teaching it about vCont;r. It'd be easy to enable this for all hardware single-step targets without needing the linux_target_ops hook, however, at least PPC needs special care, due to the fact that PPC atomic sequences can't be hardware single-stepped through, a thing which GDBserver doesn't know about. So this leaves the support limited to x86/x86_64. gdb/ 2013-05-23 Pedro Alves <palves@redhat.com> * NEWS: Mention GDBserver range stepping support. gdb/gdbserver/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * linux-low.c (lwp_in_step_range): New function. (linux_wait_1): If the thread was range stepping and stopped outside the stepping range, report the stop to GDB. Otherwise, continue stepping. Add range stepping debug output. (linux_set_resume_request): Copy the step range from the resume request to the lwp. (linux_supports_range_stepping): New. (linux_target_ops) <supports_range_stepping>: Set to linux_supports_range_stepping. * linux-low.h (struct linux_target_ops) <supports_range_stepping>: New field. (struct lwp_info) <step_range_start, step_range_end>: New fields. * linux-x86-low.c (x86_supports_range_stepping): New. (the_low_target) <supports_range_stepping>: Set to x86_supports_range_stepping. * server.c (handle_v_cont): Handle 'r' action. (handle_v_requests): Append ";r" if the target supports range stepping. * target.h (struct thread_resume) <step_range_start, step_range_end>: New fields. (struct target_ops) <supports_range_stepping>: New field. (target_supports_range_stepping): New macro.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 6bb36d87c37..1083aa9e56e 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2042,8 +2042,12 @@ handle_v_cont (char *own_buf)
{
p++;
+ memset (&resume_info[i], 0, sizeof resume_info[i]);
+
if (p[0] == 's' || p[0] == 'S')
resume_info[i].kind = resume_step;
+ else if (p[0] == 'r')
+ resume_info[i].kind = resume_step;
else if (p[0] == 'c' || p[0] == 'C')
resume_info[i].kind = resume_continue;
else if (p[0] == 't')
@@ -2063,9 +2067,22 @@ handle_v_cont (char *own_buf)
goto err;
resume_info[i].sig = gdb_signal_to_host (sig);
}
+ else if (p[0] == 'r')
+ {
+ char *p1;
+
+ p = p + 1;
+ p1 = strchr (p, ',');
+ decode_address (&resume_info[i].step_range_start, p, p1 - p);
+
+ p = p1 + 1;
+ p1 = strchr (p, ':');
+ decode_address (&resume_info[i].step_range_end, p, p1 - p);
+
+ p = p1;
+ }
else
{
- resume_info[i].sig = 0;
p = p + 1;
}
@@ -2311,6 +2328,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
if (strncmp (own_buf, "vCont?", 6) == 0)
{
strcpy (own_buf, "vCont;c;C;s;S;t");
+ if (target_supports_range_stepping ())
+ {
+ own_buf = own_buf + strlen (own_buf);
+ strcpy (own_buf, ";r");
+ }
return;
}
}