aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-04 20:41:16 +0000
committerPedro Alves <palves@redhat.com>2015-03-04 20:41:16 +0000
commit1ec68e26c982a256df03d22dce072b88ab117a73 (patch)
tree55fa2034593a4191263d1ad05cd9f8dfb7752bab /gdb/gdbserver/server.c
parentfaf09f0119da40d9b408021ad5665a906e00ee59 (diff)
downloadgdb-1ec68e26c982a256df03d22dce072b88ab117a73.zip
gdb-1ec68e26c982a256df03d22dce072b88ab117a73.tar.gz
gdb-1ec68e26c982a256df03d22dce072b88ab117a73.tar.bz2
gdbserver: Support the "swbreak"/"hwbreak" stop reasons
This patch teaches the core of gdbserver about the new "swbreak" and "hwbreak" stop reasons, and adds the necessary hooks a backend needs to implement to support the feature. gdb/gdbserver/ChangeLog: 2015-03-04 Pedro Alves <palves@redhat.com> * remote-utils.c (prepare_resume_reply): Report swbreak/hbreak. * server.c (swbreak_feature, hwbreak_feature): New globals. (handle_query) <qSupported>: Handle "swbreak+" and "hwbreak+". (captured_main): Clear swbreak_feature and hwbreak_feature. * server.h (swbreak_feature, hwbreak_feature): Declare. * target.h (struct target_ops) <stopped_by_sw_breakpoint, supports_stopped_by_sw_breakpoint, stopped_by_hw_breakpoint, supports_stopped_by_hw_breakpoint>: New fields. (target_supports_stopped_by_sw_breakpoint) (target_stopped_by_sw_breakpoint) (target_supports_stopped_by_hw_breakpoint) (target_stopped_by_hw_breakpoint): Declare.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 156fcc8a..83529ff 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -58,6 +58,8 @@ int run_once;
int multi_process;
int non_stop;
+int swbreak_feature;
+int hwbreak_feature;
/* Whether we should attempt to disable the operating system's address
space randomization feature before starting an inferior. */
@@ -1977,6 +1979,21 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
/* GDB supports relocate instruction requests. */
gdb_supports_qRelocInsn = 1;
}
+ else if (strcmp (p, "swbreak+") == 0)
+ {
+ /* GDB wants us to report whether a trap is caused
+ by a software breakpoint and for us to handle PC
+ adjustment if necessary on this target. */
+ if (target_supports_stopped_by_sw_breakpoint ())
+ swbreak_feature = 1;
+ }
+ else if (strcmp (p, "hwbreak+") == 0)
+ {
+ /* GDB wants us to report whether a trap is caused
+ by a hardware breakpoint. */
+ if (target_supports_stopped_by_hw_breakpoint ())
+ hwbreak_feature = 1;
+ }
else
target_process_qsupported (p);
@@ -2061,6 +2078,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
supported_btrace_packets (own_buf);
+ if (target_supports_stopped_by_sw_breakpoint ())
+ strcat (own_buf, ";swbreak+");
+
+ if (target_supports_stopped_by_hw_breakpoint ())
+ strcat (own_buf, ";hwbreak+");
+
return;
}
@@ -3376,6 +3399,8 @@ captured_main (int argc, char *argv[])
/* Be sure we're out of tfind mode. */
current_traceframe = -1;
cont_thread = null_ptid;
+ swbreak_feature = 0;
+ hwbreak_feature = 0;
remote_open (port);