[PATCHv13,0/6] thread-specific breakpoints in just some inferiors

Message ID cover.1725613660.git.aburgess@redhat.com
Headers
Series thread-specific breakpoints in just some inferiors |

Message

Andrew Burgess Sept. 6, 2024, 9:10 a.m. UTC
  I'm planning to merge the rest of this series once my testing has
completed unless someone asks me not too.  Obviously I'll address
anything that crops up after committing.

---

In v13:

  - Rebased to current HEAD of master.  Resolved some minor merge
    conflicts in breakpoint.{c,h} for the last patch, and updated the
    patch to take account of catchpoint::re_set() which was added
    recently.

  - Moved the NEWS entries now that GDB 15 has been released.

In v12:

  - First 3 patches from previous version have now been merged,

  - Rebased to current master and retested.  Few minor testsuite
    changes to account for other changes in the master branch, nothing
    major though.

In v11:

  - Rebased on to current upstream master.  No significant merge
    issues found.  Retested, no issues found.

In v10:

  - I merged the first 5 patches.  These were mostly just adding extra
    asserts, or minor refactoring and cleanup that didn't change GDB's
    behaviour.  Patch #2 did have a minor behaviour change, but this
    was just removing some (I think) unintended behaviour,

  - Rebased onto current upstream/master branch,

  - No other changes since v9.

In v9:

  - Rebased onto current upstream/master branch,

  - Minor testsuite fix to account for updated output from GDB,

  - No other changes since v8.

In v8:

  - Rebased onto current upstream/master branch.

  - Reordered the patches a little.  Patches 0 to 8 are unchanged from
    previous.  If there's no objections then I'm planning to merge
    these some point soon as I think these are all good cleanup patches.

  - Patches 9, 10, and 11 are new.  These are also refactoring
    commits, but are all tied pretty tightly to what is now patch 12.

  - Patch 12 is the most important patch.  This has had a complete
    rewrite since V7 in order to address Tom's feedback.  The general
    idea is unchanged; the breakpoint condition string is parsed first
    forwards, and then backwards, but we now have a two phase
    analysis, rather than immediately parsing things like the
    thread-id as we find them.  This resolves this problem:

    (gdb) break some_function if ( 3 == thread )

    Previous GDB would try to match 'thread )' as a thread-id and give
    an error that ')' as invalid.  Now GDB correctly understands that
    the 'thread )' is likely part of the 'if' condition, and parses it
    as such.

  - Patches 13 and 14 are unchanged from V7.  These patches depend on
    the changes in patch 12 so can't be merged without that patch.

In v7:

  - Addressed all the issues except one that Baris pointed out, this
    includes typos, some minor testsuite cleanups, and reformatting an
    assert (but not changing the meaning).

  - As requested, switched to use std::string_view in
    break-parse-cond.c file instead of a custom class, I agree that
    this is an improvement.

  - I've not changed the handling of -force-condition flag.  I replied
    to the review email with my thoughts, TLDR: fixing this would be a
    bigger task which I'd rather leave for ... the future.

  - Rebased and retested.

In v6:

  - Rebased to current master, one minor fix due to the C++17 changes,
    nothing major.  Retested.

In v5:

  - Updates after Lancelot's feedback, including, -force-condition can
    no longer be abbreviated to '-', and can't be used immediately
    after the breakpoint condition.

  - More tests to check some of the edge cases.

In v4:

  - Big update, this series now handles thread-specific and
    inferior-specific breakpoints.

In v3:

  - Rebased on to current upstream/master, this includes all Simon's
    recent breakpoint changes.  Retested with no regressions seen.

In v2:

  - Rebased on current upstream/master and retested,

  - No changes to code or docs.

---

Andrew Burgess (6):
  gdb: make breakpoint_debug_printf global
  gdb: add another overload of startswith
  gdb: create new is_thread_id helper function
  gdb: parse pending breakpoint thread/task immediately
  gdb: don't set breakpoint::pspace in create_breakpoint
  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                        | 702 ++++++++++++++++++
 gdb/break-cond-parse.h                        |  52 ++
 gdb/breakpoint.c                              | 671 ++++++++---------
 gdb/breakpoint.h                              |  63 +-
 gdb/testsuite/gdb.ada/tasks.exp               |   6 +-
 gdb/testsuite/gdb.base/condbreak.exp          |  57 +-
 gdb/testsuite/gdb.base/pending.exp            |  30 +-
 gdb/testsuite/gdb.linespec/explicit.exp       |  14 +-
 gdb/testsuite/gdb.linespec/keywords.exp       |   8 +-
 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp   |   3 +-
 gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp    |   8 +-
 .../gdb.mi/user-selected-context-sync.exp     |  14 +-
 .../gdb.multi/bp-thread-specific.exp          |   7 +-
 .../gdb.multi/inferior-specific-bp.exp        |  16 +-
 .../gdb.multi/multi-target-continue.exp       |   2 +-
 .../gdb.multi/multi-target-ping-pong-next.exp |   4 +-
 .../gdb.multi/pending-bp-del-inferior.c       |  28 +
 .../gdb.multi/pending-bp-del-inferior.exp     | 214 ++++++
 gdb/testsuite/gdb.multi/pending-bp.exp        | 206 +++++
 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     |  98 +++
 gdb/tid-parse.c                               |  82 +-
 gdb/tid-parse.h                               |   8 +
 gdbsupport/common-utils.h                     |  10 +
 30 files changed, 1994 insertions(+), 447 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-del-inferior.c
 create mode 100644 gdb/testsuite/gdb.multi/pending-bp-del-inferior.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: 237df762d73a7fdf910277b0644df58688d2d87a
  

Comments

Andrew Burgess Sept. 7, 2024, 8:49 p.m. UTC | #1
I'm checking this in now.

Thanks,
Andrew