diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2019-03-13 15:13:03 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2019-03-13 15:14:36 -0400 |
commit | b4be1b0648608a2578bbed39841c8ee411773edd (patch) | |
tree | e1ed7575ff16e451a9076c7cabcf057c17d43b51 /gdb/doc | |
parent | 8e5e5494f8653dd83ce1413d141e26c09dddab7b (diff) | |
download | binutils-gdb-b4be1b0648608a2578bbed39841c8ee411773edd.tar.gz |
Fix MI output for multi-location breakpoints
New in v2:
- Addressed comments about doc, updated the MI version table
- New doc for the Breakpoint information format
- New -fix-multi-location-breakpoint-output command, with associated
doc, test and NEWS updated accordingly
- Fixed the output, the locations list is now actually in the tuple
representing the breakpoint.
Various MI commands or events related to breakpoints output invalid MI
records when printing information about a multi-location breakpoint.
For example:
-break-insert allo
^done,bkpt={...,addr="<MULTIPLE>",...},{number="1.1",...},{number="1.2",...}
The problem is that according to the syntax [1], the top-level elements
are of type "result" and should be of the form "variable=value".
This patch changes the output to wrap the locations in a list:
^done,bkpt={...,addr="<MULTIPLE>",locations=[{number="1.1",...},{number="1.2",...}]}
The events =breakpoint-created, =breakpoint-modified, as well as the
-break-info command also suffer from this (and maybe others I didn't
find).
Since this is a breaking change for MI, we have to deal somehow with
backwards compatibility. The approach taken by this patch is to bump
the MI version, use the new syntax in MI3 while retaining the old syntax
in MI2. Frontends are expected to use a precise MI version (-i=mi2), so
if they do that they should be unaffected.
The patch also adds the command -fix-multi-location-breakpoint-output,
which front ends can use to enable this behavior with MI <= 2.
[1] https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax
gdb/ChangeLog:
* NEWS: Mention that the new default MI version is 3. Mention
changes to the output of commands and events that deal with
multi-location breakpoints.
* breakpoint.c: Include "mi/mi-out.h".
(print_one_breakpoint): Change output syntax if using MI version
>= 3.
* mi/mi-main.h (mi_cmd_fix_multi_location_breakpoint_output):
New.
(mi_multi_location_breakpoint_output_fixed): New.
* mi/mi-main.c (fix_multi_location_breakpoint_output): New.
(mi_cmd_fix_multi_location_breakpoint_output): New.
(mi_multi_location_breakpoint_output_fixed): New.
* mi/mi-cmds.c (mi_cmds): Register command
-fix-multi-location-breakpoint-output.
* mi/mi-out.c (mi_out_new): Instantiate version 3 when using
interpreter "mi".
gdb/testsuite/ChangeLog:
* mi-breakpoint-location-ena-dis.exp: Rename to ...
* mi-breakpoint-multiple-locations.exp: ... this.
(make_breakpoints_pattern): New proc.
(do_test): Add mi_version parameter, test -break-insert,
-break-info and =breakpoint-created.
gdb/doc/ChangeLog:
* gdb.texinfo (Mode Options): Mention mi3.
(Interpreters): Likewise.
(GDB/MI Development and Front Ends): Add entry for MI 3 in
version table. Document -fix-multi-location-breakpoint-output.
(GDB/MI Breakpoint Information): Document format of breakpoint
location output.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 100 |
2 files changed, 97 insertions, 12 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 0380322dfee..81512fa98c9 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,12 @@ +2019-03-13 Simon Marchi <simon.marchi@ericsson.com> + + * gdb.texinfo (Mode Options): Mention mi3. + (Interpreters): Likewise. + (GDB/MI Development and Front Ends): Add entry for MI 3 in + version table. Document -fix-multi-location-breakpoint-output. + (GDB/MI Breakpoint Information): Document format of breakpoint + location output. + 2019-03-05 Simon Marchi <simon.marchi@efficios.com> * python.texi (Values From Inferior): Change synopsys of the diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f2028f86b0d..20f6122ce1b 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -1268,12 +1268,12 @@ program or device. This option is meant to be set by programs which communicate with @value{GDBN} using it as a back end. @xref{Interpreters, , Command Interpreters}. -@samp{--interpreter=mi} (or @samp{--interpreter=mi2}) causes -@value{GDBN} to use the @dfn{@sc{gdb/mi} interface} (@pxref{GDB/MI, , -The @sc{gdb/mi} Interface}) included since @value{GDBN} version 6.0. The -previous @sc{gdb/mi} interface, included in @value{GDBN} version 5.3 and -selected with @samp{--interpreter=mi1}, is deprecated. Earlier -@sc{gdb/mi} interfaces are no longer supported. +@samp{--interpreter=mi} (or @samp{--interpreter=mi3}) causes +@value{GDBN} to use the @dfn{@sc{gdb/mi} interface} version 3 (@pxref{GDB/MI, , +The @sc{gdb/mi} Interface}) included since @value{GDBN} version 9.1. @sc{gdb/mi} +version 2 (@code{mi2}), included in @value{GDBN} 6.0 and version 1 (@code{mi1}), +included in @value{GDBN} 5.3, are also available. Earlier @sc{gdb/mi} +interfaces are no longer supported. @item -write @cindex @code{--write} @@ -26506,18 +26506,22 @@ used interpreter with @value{GDBN}. With no interpreter specified at runtime, @item mi @cindex mi interpreter -The newest @sc{gdb/mi} interface (currently @code{mi2}). Used primarily +The newest @sc{gdb/mi} interface (currently @code{mi3}). Used primarily by programs wishing to use @value{GDBN} as a backend for a debugger GUI or an IDE. For more information, see @ref{GDB/MI, ,The @sc{gdb/mi} Interface}. +@item mi3 +@cindex mi3 interpreter +The @sc{gdb/mi} interface introduced in @value{GDBN} 9.1. + @item mi2 @cindex mi2 interpreter -The current @sc{gdb/mi} interface. +The @sc{gdb/mi} interface introduced in @value{GDBN} 6.0. @item mi1 @cindex mi1 interpreter -The @sc{gdb/mi} interface included in @value{GDBN} 5.1, 5.2, and 5.3. +The @sc{gdb/mi} interface introduced in @value{GDBN} 5.1. @end table @@ -27839,8 +27843,36 @@ than a tuple. a tuple. @end itemize +@item +@center 3 +@tab +@center 9.1 +@tab + +@itemize +@item +The output of information about multi-location breakpoints has changed in the +responses to the @code{-break-insert} and @code{-break-info} commands, as well +as in the @code{=breakpoint-created} and @code{=breakpoint-modified} events. +The multiple locations are now placed in a @code{locations} field, whose value +is a list. +@end itemize + @end multitable +If your front end cannot yet migrate to a more recent version of the +MI protocol, you can nevertheless selectively enable specific features +available in those recent MI versions, using the following commands: + +@table @code + +@item -fix-multi-location-breakpoint-output +Use the output for multi-location breakpoints which was introduced by +MI 3, even when using MI versions 2 or 1. This command has no +effect when using MI version 3 or later. + +@end @table + The best way to avoid unexpected changes in MI that might break your front end is to make your project known to @value{GDBN} developers and follow development on @email{gdb@@sourceware.org} and @@ -28169,9 +28201,7 @@ following fields: @table @code @item number -The breakpoint number. For a breakpoint that represents one location -of a multi-location breakpoint, this will be a dotted pair, like -@samp{1.2}. +The breakpoint number. @item type The type of the breakpoint. For ordinary breakpoints this will be @@ -28271,6 +28301,52 @@ is not. @item what Some extra data, the exact contents of which are type-dependent. +@item locations +This field is present if the breakpoint has multiple locations. It is also +exceptionally present if the breakpoint is enabled and has a single, disabled +location. + +The value is a list of locations. The format of a location is decribed below. + +@end table + +A location in a multi-location breakpoint is represented as a tuple with the +following fields: + +@table @code + +@item number +The location number as a dotted pair, like @samp{1.2}. The first digit is the +number of the parent breakpoint. The second digit is the number of the +location within that breakpoint. + +@item enabled +This indicates whether the location is enabled, in which case the +value is @samp{y}, or disabled, in which case the value is @samp{n}. +Note that this is not the same as the field @code{enable}. + +@item addr +The address of this location as an hexidecimal number. + +@item func +If known, the function in which the location appears. +If not known, this field is not present. + +@item file +The name of the source file which contains this location, if known. +If not known, this field is not present. + +@item fullname +The full file name of the source file which contains this location, if +known. If not known, this field is not present. + +@item line +The line number at which this location appears, if known. +If not known, this field is not present. + +@item thread-groups +The thread groups this location is in. + @end table For example, here is what the output of @code{-break-insert} |