[PATCH 0/9] thread-specific breakpoints in just some inferiors

Andrew Burgess via Gdb-patches
2023-04-28T23:37:17Z

When I proposed my inferior-specific breakpoints patch, two people
independently asked: will these breakpoints only be inserted into the
relevant inferiors?

My answer at that point was, no, that's just not possible given how we
manage the breakpoint locations, but this series changes that.

But as the inferior specific breakpoints patch hasn't landed yet, this
series looks at thread-specific breakpoints.

A thread-specific breakpoint only applies to a single global
thread-id, and so will only apply for to a single thread in a single
inferior. As such, we can limit the locations for a thread-specific
breakpoint to just those locations in the inferior containing the
thread we are interested in.

In the following series patch #6 and #9 are the really interesting
ones. Patch #6 makes some pretty significant changes to how we setup
breakpoints, which opens the way for #9, which performs the location
limiting.

Patches #1 to #5 are me just trying to understand the breakpoint
creation code more -- adding asserts and making a couple of minor
cleanups.

Patches #7 and #8 are more cleanups, but now looking at the location
creation/re-setting code.

---

Andrew Burgess (9):
gdb: create_breakpoint: assert for a valid thread-id
gdb: create_breakpoint: asserts relating to extra_string/parse_extra
gdb: change 'if' to gdb_assert in update_dprintf_command_list
gdb: build dprintf commands just once in code_breakpoint constructor
gdb: don't display inferior list for pending breakpoints
gdb: parse pending breakpoint thread/task immediately
gdb: remove breakpoint_re_set_one
gdb: remove tracepoint_probe_create_sals_from_location_spec
gdb: only insert thread-specific breakpoints in the relevant inferior

gdb/Makefile.in | 2 +
gdb/NEWS | 11 +
gdb/ada-lang.c | 6 +-
gdb/break-catch-throw.c | 6 +-
gdb/break-cond-parse.c | 403 +++++++++++
gdb/break-cond-parse.h | 47 ++
gdb/breakpoint.c | 666 ++++++++----------
gdb/breakpoint.h | 64 +-
gdb/testsuite/gdb.base/condbreak.exp | 20 +-
gdb/testsuite/gdb.base/pending.exp | 23 +-
gdb/testsuite/gdb.linespec/explicit.exp | 4 +-
gdb/testsuite/gdb.mi/mi-dprintf-pending.exp | 3 +-
.../gdb.mi/user-selected-context-sync.exp | 2 +-
.../gdb.multi/bp-thread-specific.exp | 7 +-
.../gdb.multi/multi-target-continue.exp | 2 +-
.../gdb.multi/multi-target-ping-pong-next.exp | 4 +-
gdb/testsuite/gdb.multi/pending-bp-lib.c | 22 +
gdb/testsuite/gdb.multi/pending-bp.c | 66 ++
gdb/testsuite/gdb.multi/pending-bp.exp | 321 +++++++++
gdb/testsuite/gdb.multi/tids.exp | 6 +-
.../gdb.threads/del-pending-thread-bp-lib.c | 22 +
.../gdb.threads/del-pending-thread-bp.c | 85 +++
.../gdb.threads/del-pending-thread-bp.exp | 108 +++
23 files changed, 1498 insertions(+), 402 deletions(-)
create mode 100644 gdb/break-cond-parse.c
create mode 100644 gdb/break-cond-parse.h
create mode 100644 gdb/testsuite/gdb.multi/pending-bp-lib.c
create mode 100644 gdb/testsuite/gdb.multi/pending-bp.c
create mode 100644 gdb/testsuite/gdb.multi/pending-bp.exp
create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp-lib.c
create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp.c
create mode 100644 gdb/testsuite/gdb.threads/del-pending-thread-bp.exp

base-commit: 00cdd79a5d3f910c1362b9c4654adea3db0a97de
--
2.25.4