[00/12] Infcalls from B/P conditions in multi-threaded inferiors

Message ID cover.1666341010.git.aburgess@redhat.com
Headers
Series Infcalls from B/P conditions in multi-threaded inferiors |

Message

Andrew Burgess Oct. 21, 2022, 8:43 a.m. UTC
  This series aims to fix PR gdb/28942, GDB's inability to use inferior
function calls from breakpoint conditions in multi-threaded inferiors.

This work draws on the work done in this patch:

  https://sourceware.org/pipermail/gdb-patches/2021-March/176654.html

Some of the changes in that series can be found in patch 10 in this
series.

There's a lot of patches here, but the work is really made of several
mini-series:

  Patches 01 and 02 are trivial cleanup and debug output patches.
  These could probably be committed as obvious.

  Patch 03 improves the error message GDB gives when there is an error
  while evaluating a breakpoint condition.

  Patches 04, 05, and 06 are some gdbserver cleanup and then a
  gdbserver bug fix.

  Patches 07 and 08 are two further improvements for how the error is
  reported when a GDB fails to evaluate a breakpoint condition.

  Patches 09 and 10 actually fix using inferior function calls from
  breakpoint conditions in multi-threaded inferiors.

  Patch 11 is some new functionality to hopefully make GDB more robust
  when using inferior function calls, especially from a breakpoint
  condition.  This patch is optional, we could stop at patch 10 if the
  ideas in this patch are not acceptable.

  Patch 12 is an adjustment for remote targets when not running in
  non-stop mode to improve how stops are reported to the user.  Like
  patch 11, this work is optional.  We could stop at either patch 10
  or patch 11 if the work in this patch is not acceptable.

Thanks,
Andrew

---

Andrew Burgess (12):
  gdb: int to bool conversion for normal_stop
  gdb/infrun: add debug print in print_signal_received_reason
  gdb: include breakpoint number in testing condition error message
  gdbserver: add comments to read_inferior_memory function
  gdbserver: allows agent_mem_read to return an error code
  gdbserver: allow agent expressions to fail with invalid memory access
  gdb: avoid repeated signal reporting during failed conditional
    breakpoint
  gdb: don't always print breakpoint location after failed condition
    check
  Revert "gdb: remove unnecessary parameter wait_ptid from
    do_target_wait"
  gdb: fix b/p conditions with infcalls in multi-threaded inferiors
  gdb: add timeouts for inferior function calls
  gdb/remote: avoid SIGINT after calling remote_target::stop

 gdb/NEWS                                      |  16 ++
 gdb/breakpoint.c                              |  17 +-
 gdb/doc/gdb.texinfo                           |  45 ++++
 gdb/gdbthread.h                               |   3 +
 gdb/infcall.c                                 | 174 +++++++++++++
 gdb/infcmd.c                                  |   2 +-
 gdb/infrun.c                                  |  60 +++--
 gdb/infrun.h                                  |   4 +-
 gdb/remote.c                                  |  17 ++
 gdb/testsuite/gdb.base/bp-cond-failure.c      |  30 +++
 gdb/testsuite/gdb.base/bp-cond-failure.exp    |  81 ++++++
 .../gdb.base/catch-signal-siginfo-cond.exp    |   2 +-
 gdb/testsuite/gdb.base/gnu-ifunc.exp          |   2 +-
 gdb/testsuite/gdb.base/help.exp               |   2 +-
 gdb/testsuite/gdb.base/infcall-failure.c      |  48 ++++
 gdb/testsuite/gdb.base/infcall-failure.exp    | 182 ++++++++++++++
 gdb/testsuite/gdb.base/infcall-timeout.c      |  36 +++
 gdb/testsuite/gdb.base/infcall-timeout.exp    |  74 ++++++
 .../gdb.python/py-finish-breakpoint.exp       |   2 +-
 .../infcall-from-bp-cond-other-thread-event.c | 135 ++++++++++
 ...nfcall-from-bp-cond-other-thread-event.exp | 175 +++++++++++++
 .../gdb.threads/infcall-from-bp-cond-simple.c |  89 +++++++
 .../infcall-from-bp-cond-simple.exp           | 236 ++++++++++++++++++
 .../gdb.threads/infcall-from-bp-cond-single.c | 139 +++++++++++
 .../infcall-from-bp-cond-single.exp           | 119 +++++++++
 .../infcall-from-bp-cond-timeout.c            | 169 +++++++++++++
 .../infcall-from-bp-cond-timeout.exp          | 121 +++++++++
 gdb/testsuite/lib/gdb.exp                     |   8 +
 gdbserver/ax.cc                               |  12 +-
 gdbserver/ax.h                                |   3 +-
 gdbserver/target.cc                           |   2 +
 gdbserver/target.h                            |   3 +
 gdbserver/tracepoint.cc                       |  13 +-
 gdbserver/tracepoint.h                        |   9 +-
 34 files changed, 1992 insertions(+), 38 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/bp-cond-failure.c
 create mode 100644 gdb/testsuite/gdb.base/bp-cond-failure.exp
 create mode 100644 gdb/testsuite/gdb.base/infcall-failure.c
 create mode 100644 gdb/testsuite/gdb.base/infcall-failure.exp
 create mode 100644 gdb/testsuite/gdb.base/infcall-timeout.c
 create mode 100644 gdb/testsuite/gdb.base/infcall-timeout.exp
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.c
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-other-thread-event.exp
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.exp
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.c
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-single.exp
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.c
 create mode 100644 gdb/testsuite/gdb.threads/infcall-from-bp-cond-timeout.exp