diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-04 20:41:16 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-04 20:41:16 +0000 |
commit | f7e6eed5283bb5c8a3598dd986dc922b9a794f58 (patch) | |
tree | a7343d12474798fc7be6fdc479527d52190bbedc /gdb/doc | |
parent | 9e8915c6cee5c37637521b424d723e990e06d597 (diff) | |
download | gdb-f7e6eed5283bb5c8a3598dd986dc922b9a794f58.zip gdb-f7e6eed5283bb5c8a3598dd986dc922b9a794f58.tar.gz gdb-f7e6eed5283bb5c8a3598dd986dc922b9a794f58.tar.bz2 |
remote+docs: software/hardware breakpoint traps
This adjusts target remote to tell the core whether a trap was caused
by a breakpoint.
To that end, the patch teaches GDB about new RSP stop reasons "T05
swbreak" and "T05 hwbreak", that remote targets report back to GDB,
similarly to how "T05 watch" indicates a stop caused by a watchpoint.
Because targets that can report these events are expected to
themselves adjust the PC after a software breakpoint, these new stop
reasons must only be reported if the stub is talking to a GDB that
understands them. Because of that, the use of the new stop reasons
needs to be handshaked on initial connection, using the qSupported
mechanism. GDB simply sends "swbreak+" in its qSupports query, and
the stub reports back "swbreak+" too.
Because these new stop reasons are required to fix a fundamental
non-stop mode problem, this commit extends the remote non-stop intro
section in the manual, documenting the events as required.
To be clear, GDB will still cope with remote targets that don't
support these new stop reasons; it will behave just like today.
Tested on x86-64 Fedora 20, native and gdbserver.
gdb/ChangeLog:
2015-03-04 Pedro Alves <palves@redhat.com>
* NEWS: Mention the new "swbreak" and "hwbreak" stop reasons.
* remote.c (struct remote_state) <remote_stopped_by_watchpoint_p>:
Delete field.
<stop_reason>: New field.
(PACKET_swbreak_feature, PACKET_hwbreak_feature): New enum values.
(packet_set_cmd_state): New function.
(remote_protocol_features): Register the "swbreak" and "hwbreak"
features.
(remote_query_supported): If not disabled with the corresponding
"set remote foo-packet" command, report support for the swbreak
and hwbreak features.
(struct stop_reply) <remote_stopped_by_watchpoint_p>: Delete
field.
<stop_reason>: New field.
(remote_parse_stop_reply): Handle "swbreak" and "hwbreak".
(remote_wait_as): Adjust.
(remote_stopped_by_sw_breakpoint)
(remote_supports_stopped_by_sw_breakpoint)
(remote_stopped_by_hw_breakpoint)
(remote_supports_stopped_by_hw_breakpoint): New functions.
(remote_stopped_by_watchpoint): New function.
(init_remote_ops): Install them.
(_initialize_remote): Register new "set/show remote
swbreak-feature-packet" and "set/show remote
swbreak-feature-packet" commands.
gdb/doc/ChangeLog:
2015-03-04 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Remote Configuration): Document the "set/show
remote swbreak-feature-packet" and "set/show remote
hwbreak-feature-packet" commands.
(Packets) <Z0>: Add cross link to the "swbreak" stop reason's
decription.
(Stop Reply Packets): Document the swbreak and hwbreak stop
reasons.
(General Query Packets): Document the swbreak and hwbreak
qSupported features.
(Remote Non-Stop): Explain that swbreak and hwbreak are required.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 80 |
2 files changed, 93 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2b2ad5a..f62b4ac6 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,16 @@ +2015-03-04 Pedro Alves <palves@redhat.com> + + * gdb.texinfo (Remote Configuration): Document the "set/show + remote swbreak-feature-packet" and "set/show remote + hwbreak-feature-packet" commands. + (Packets) <Z0>: Add cross link to the "swbreak" stop reason's + decription. + (Stop Reply Packets): Document the swbreak and hwbreak stop + reasons. + (General Query Packets): Document the swbreak and hwbreak + qSupported features. + (Remote Non-Stop): Explain that swbreak and hwbreak are required. + 2015-03-03 Philippe Proulx eeppeliteloop@gmail.com * gdb.texinfo (gdb/mi Async Records): Fix duplicate syscall-entry diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index c0a8244..4b76ce9 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -19783,6 +19783,15 @@ are: @item @code{conditional-breakpoints-packet} @tab @code{Z0 and Z1} @tab @code{Support for target-side breakpoint condition evaluation} + +@item @code{swbreak-feature} +@tab @code{swbreak stop reason} +@tab @code{break} + +@item @code{hwbreak-feature} +@tab @code{hwbreak stop reason} +@tab @code{hbreak} + @end multitable @node Remote Stub @@ -34985,6 +34994,9 @@ form that should be evaluated on the target's side. These are the conditions that should be taken into consideration when deciding if the breakpoint trigger should be reported back to @var{GDBN}. +See also the @samp{swbreak} stop reason (@pxref{swbreak stop reason}) +for how to best report a memory breakpoint event to @value{GDBN}. + The @var{cond_list} parameter is comprised of a series of expressions, concatenated without separators. Each expression has the following form: @@ -35188,6 +35200,34 @@ logged execution events, because it has reached the end (or the beginning when executing backward) of the log. The value of @var{r} will be either @samp{begin} or @samp{end}. @xref{Reverse Execution}, for more information. + +@item swbreak +@anchor{swbreak stop reason} +The packet indicates a memory breakpoint instruction was executed, +irrespective of whether it was @value{GDBN} that planted the +breakpoint or the breakpoint is hardcoded in the program. The @var{r} +part must be left empty. + +On some architectures, such as x86, at the architecture level, when a +breakpoint instruction executes the program counter points at the +breakpoint address plus an offset. On such targets, the stub is +responsible for adjusting the PC to point back at the breakpoint +address. + +This packet should not be sent by default; older @value{GDBN} versions +did not support it. @value{GDBN} requests it, by supplying an +appropriate @samp{qSupported} feature (@pxref{qSupported}). The +remote stub must also supply the appropriate @samp{qSupported} feature +indicating support. + +This packet is required for correct non-stop mode operation. + +@item hwbreak +The packet indicates the target stopped for a hardware breakpoint. +The @var{r} part must be left empty. + +The same remarks about @samp{qSupported} and non-stop mode above +apply. @end table @item W @var{AA} @@ -35772,6 +35812,14 @@ description. This feature indicates whether @value{GDBN} supports the @samp{qRelocInsn} packet (@pxref{Tracepoint Packets,,Relocate instruction reply packet}). + +@item swbreak +This feature indicates whether @value{GDBN} supports the swbreak stop +reason in stop replies. @xref{swbreak stop reason}, for details. + +@item hwbreak +This feature indicates whether @value{GDBN} supports the hwbreak stop +reason in stop replies. @xref{swbreak stop reason}, for details. @end table Stubs should ignore any unknown values for @@ -36000,6 +36048,16 @@ These are the currently defined stub features and their properties: @tab @samp{-} @tab No +@item @samp{swbreak} +@tab No +@tab @samp{-} +@tab No + +@item @samp{hwbreak} +@tab No +@tab @samp{-} +@tab No + @end multitable These are the currently defined stub features, in more detail: @@ -36180,6 +36238,14 @@ The remote stub understands the @samp{Qbtrace:bts} packet. @item Qbtrace-conf:bts:size The remote stub understands the @samp{Qbtrace-conf:bts:size} packet. +@item swbreak +The remote stub reports the @samp{swbreak} stop reason for memory +breakpoints. + +@item hwbreak +The remote stub reports the @samp{hwbreak} stop reason for hardware +breakpoints. + @end table @item qSymbol:: @@ -37565,6 +37631,20 @@ If all threads are running when the target receives the @samp{?} packet, or if the target is not attached to any process, it shall respond @samp{OK}. +If the stub supports non-stop mode, it should also support the +@samp{swbreak} stop reason if software breakpoints are supported, and +the @samp{hwbreak} stop reason if hardware breakpoints are supported +(@pxref{swbreak stop reason}). This is because given the asynchronous +nature of non-stop mode, between the time a thread hits a breakpoint +and the time the event is finally processed by @value{GDBN}, the +breakpoint may have already been removed from the target. Due to +this, @value{GDBN} needs to be able to tell whether a trap stop was +caused by a delayed breakpoint event, which should be ignored, as +opposed to a random trap signal, which should be reported to the user. +Note the @samp{swbreak} feature implies that the target is responsible +for adjusting the PC when a software breakpoint triggers, if +necessary, such as on the x86 architecture. + @node Packet Acknowledgment @section Packet Acknowledgment |