[v8,0/6] Handle already-exited threads in 'stop_all_threads'

Message ID 20200513205338.14233-1-palves@redhat.com
Headers show
Series
  • Handle already-exited threads in 'stop_all_threads'
Related show

Message

Simon Marchi via Gdb-patches May 13, 2020, 8:53 p.m.
Here's v8 of Tankut's series that fixes an infinite loop when GDB
attempts to stop a thread in 'stop_all_threads', if the thread has
already died.  The problem is fixed by handling waitstatuses that
denote exiting.  It also includes a broader change to handle the case
of a whole process exiting while GDB is stopping all threads.

I'm resending the whole series for Tankut under a new cover letter
because I find that sending just chunks of the series makes it hard to
piece things together and make sense of where we are.

Compared to v7, the main change is in the last patch of the series.
I've thought through how to handle the case of a process exiting while
we're stopping all threads in stop_all_threads.  This version switches
back to avoiding deleting the last thread of an inferior in remote.c's
target_update_thread_list implementation instead of the previous
proposal of not deleting threads with a status pending and re-adding
threads in stop_all_threads.  See the updated tail end of the commit
log of the last patch, which describes the new change in more detail.
It then tweaks a few things in common code related to that change, and
also makes the new testcases spawn more than 2 inferiors.

Tankut Baris Aktemur (6):
  gdb: protect some 'regcache_read_pc' calls
  gdb/infrun: move a 'regcache_read_pc' call down to first use
  gdb/infrun: extract out a code piece into 'mark_non_executing_threads'
    function
  gdb: introduce 'all_non_exited_process_targets' and
    'switch_to_target_no_thread'
  gdb/infrun: enable/disable thread events of all targets in
    stop_all_threads
  gdb/infrun: handle already-exited threads when attempting to stop

 gdb/infrun.c                           | 188 +++++++++++++++++++++------------
 gdb/process-stratum-target.c           |  24 +++++
 gdb/process-stratum-target.h           |  10 ++
 gdb/regcache.c                         |  18 ++++
 gdb/remote.c                           |  20 ++++
 gdb/testsuite/gdb.base/annota1.exp     |   2 +-
 gdb/testsuite/gdb.cp/annota2.exp       |   2 +-
 gdb/testsuite/gdb.multi/multi-exit.c   |  22 ++++
 gdb/testsuite/gdb.multi/multi-exit.exp | 138 ++++++++++++++++++++++++
 gdb/testsuite/gdb.multi/multi-kill.c   |  42 ++++++++
 gdb/testsuite/gdb.multi/multi-kill.exp | 127 ++++++++++++++++++++++
 gdb/thread.c                           |   2 +-
 gdbsupport/common-regcache.h           |   5 +
 13 files changed, 531 insertions(+), 69 deletions(-)
 create mode 100644 gdb/testsuite/gdb.multi/multi-exit.c
 create mode 100644 gdb/testsuite/gdb.multi/multi-exit.exp
 create mode 100644 gdb/testsuite/gdb.multi/multi-kill.c
 create mode 100644 gdb/testsuite/gdb.multi/multi-kill.exp


base-commit: f7e23710fcb7133a3bbe7795ad0ddd2defca358a
-- 
2.14.5