diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-11-08 12:32:51 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-08-17 16:42:39 +0100 |
commit | b080fe54fb3414b488b8ef323c6c50def061f918 (patch) | |
tree | 7b0b54ca4a9a44fb37e3838fb68a01b572380b3d /gdb/NEWS | |
parent | 0c9546b152f6b01756475ce259c895d3fa446774 (diff) | |
download | gdb-b080fe54fb3414b488b8ef323c6c50def061f918.zip gdb-b080fe54fb3414b488b8ef323c6c50def061f918.tar.gz gdb-b080fe54fb3414b488b8ef323c6c50def061f918.tar.bz2 |
gdb: add inferior-specific breakpoints
This commit extends the breakpoint mechanism to allow for inferior
specific breakpoints (but not watchpoints in this commit).
As GDB gains better support for multiple connections, and so for
running multiple (possibly unrelated) inferiors, then it is not hard
to imagine that a user might wish to create breakpoints that apply to
any thread in a single inferior. To achieve this currently, the user
would need to create a condition possibly making use of the $_inferior
convenience variable, which, though functional, isn't the most user
friendly.
This commit adds a new 'inferior' keyword that allows for the creation
of inferior specific breakpoints.
Inferior specific breakpoints are automatically deleted when the
associated inferior is removed from GDB, this is similar to how
thread-specific breakpoints are deleted when the associated thread is
deleted.
Watchpoints are already per-program-space, which in most cases mean
watchpoints are already inferior specific. There is a small window
where inferior-specific watchpoints might make sense, which is after a
vfork, when two processes are sharing the same address space.
However, I'm leaving that as an exercise for another day. For now,
attempting to use the inferior keyword with a watchpoint will give an
error, like this:
(gdb) watch a8 inferior 1
Cannot use 'inferior' keyword with watchpoints
A final note on the implementation: currently, inferior specific
breakpoints, like thread-specific breakpoints, are inserted into every
inferior, GDB then checks once the inferior stops if we are in the
correct thread or inferior, and resumes automatically if we stopped in
the wrong thread/inferior.
An obvious optimisation here is to only insert breakpoint locations
into the specific program space (which mostly means inferior) that
contains either the inferior or thread we are interested in. This
would reduce the number times GDB has to stop and then resume again in
a multi-inferior setup.
I have a series on the mailing list[1] that implements this
optimisation for thread-specific breakpoints. Once this series has
landed I'll update that series to also handle inferior specific
breakpoints in the same way. For now, inferior specific breakpoints
are just slightly less optimal, but this is no different to
thread-specific breakpoints in a multi-inferior debug session, so I
don't see this as a huge problem.
[1] https://inbox.sourceware.org/gdb-patches/cover.1685479504.git.aburgess@redhat.com/
Diffstat (limited to 'gdb/NEWS')
-rw-r--r-- | gdb/NEWS | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -98,6 +98,13 @@ user that the end of file has been reached, refers the user to the newly added '.' argument +* Breakpoints can now be inferior-specific. This is similar to the + existing thread-specific breakpoint support. Breakpoint conditions + can include the 'inferior' keyword followed by an inferior id (as + displayed in the 'info inferiors' output). It is invalid to use the + 'inferior' keyword with either the 'thread' or 'task' keywords when + creating a breakpoint. + * New commands set debug breakpoint on|off @@ -162,6 +169,14 @@ info main considered simple.) Support for this feature can be verified by using the '-list-features' command, which should contain "simple-values-ref-types". +** The -break-insert command now accepts a '-g thread-group-id' option + to allow for the creation of inferior-specific breakpoints. + +** The bkpt tuple, which appears in breakpoint-created notifications, + and in the result of the -break-insert command can now include an + optional 'inferior' field for both the main breakpoint, and each + location, when the breakpoint is inferior-specific. + * Python API ** gdb.ThreadExitedEvent added. Emits a ThreadEvent. @@ -257,6 +272,12 @@ info main ** gdb.Progspace now has the new method "objfile_for_address". This returns the gdb.Objfile, if any, that covers a given address. + ** gdb.Breakpoint now has an "inferior" attribute. If the + Breakpoint object is inferior specific then this attribute holds + the inferior-id (an integer). If the Breakpoint object is not + inferior specific, then this field contains None. This field can + be written too. + *** Changes in GDB 13 * MI version 1 is deprecated, and will be removed in GDB 14. |