public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Some fixes for handling vfork by multi-threaded programs
@ 2022-01-17 16:27 Simon Marchi
  2022-01-17 16:27 ` [PATCH 1/8] gdb/infrun: add reason parameter to stop_all_threads Simon Marchi
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Simon Marchi @ 2022-01-17 16:27 UTC (permalink / raw)
  To: gdb-patches

Someone reported to me a while ago that stepping in a multi-threaded
program where some threads sometimes call vfork would make GDB behave
erratically.  Some "step"s or "next"s would land in the wrong place, or
just behave as "continue".  After a bit of investigation, I realized
that GDB didn't handle vforks by multi-threaded program correctly.  See
patch "fix handling of vfork by multi-threaded program" for an in-depth
explanation.

While working on this, I tried to fix all combinations of
target-non-stop, non-stop, schedule-multiple, detach-on-fork and
follow-fork-mode.  However, I was not seeing the end of it and it was
making me a bit crazy.  So I chose to only focus on the "default" case
of detach-on-fork=on and follow-fork-mode=parent for now.  It will
probably make it easier for the reviewers too.

Simon Marchi (8):
  gdb/infrun: add reason parameter to stop_all_threads
  gdb/linux-nat: remove check based on current_inferior in
    linux_handle_extended_wait
  gdb: replace inferior::waiting_for_vfork_done with
    inferior::thread_waiting_for_vfork_done
  gdb/infrun: add inferior parameters to stop_all_threads and
    restart_threads
  gdb/infrun: add logging statement to do_target_resume
  gdb: fix handling of vfork by multi-threaded program
    (follow-fork-mode=parent, detach-on-fork=on)
  gdbserver: report correct status in thread stop race condition
  gdb: resume ongoing step after handling fork or vfork

 gdb/infcmd.c                                  |   2 +-
 gdb/inferior.h                                |   8 +-
 gdb/infrun.c                                  | 210 ++++++++++++++++--
 gdb/infrun.h                                  |  14 +-
 gdb/linux-nat.c                               |  17 +-
 gdb/remote.c                                  |   2 +-
 .../gdb.threads/next-fork-other-thread.c      |  86 +++++++
 .../gdb.threads/next-fork-other-thread.exp    | 116 ++++++++++
 .../gdb.threads/vfork-multi-inferior-sleep.c  |  25 +++
 .../gdb.threads/vfork-multi-inferior.c        |  55 +++++
 .../gdb.threads/vfork-multi-inferior.exp      | 115 ++++++++++
 .../gdb.threads/vfork-multi-thread.c          |  74 ++++++
 .../gdb.threads/vfork-multi-thread.exp        |  96 ++++++++
 gdbserver/linux-low.cc                        |  60 +++--
 14 files changed, 801 insertions(+), 79 deletions(-)
 create mode 100644 gdb/testsuite/gdb.threads/next-fork-other-thread.c
 create mode 100644 gdb/testsuite/gdb.threads/next-fork-other-thread.exp
 create mode 100644 gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c
 create mode 100644 gdb/testsuite/gdb.threads/vfork-multi-inferior.c
 create mode 100644 gdb/testsuite/gdb.threads/vfork-multi-inferior.exp
 create mode 100644 gdb/testsuite/gdb.threads/vfork-multi-thread.c
 create mode 100644 gdb/testsuite/gdb.threads/vfork-multi-thread.exp


base-commit: 1adce770ea443ec73c8af29618c504495893d0b8
-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-04-01 18:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 16:27 [PATCH 0/8] Some fixes for handling vfork by multi-threaded programs Simon Marchi
2022-01-17 16:27 ` [PATCH 1/8] gdb/infrun: add reason parameter to stop_all_threads Simon Marchi
2022-03-31 15:05   ` Pedro Alves
2022-03-31 15:35     ` Simon Marchi
2022-01-17 16:27 ` [PATCH 2/8] gdb/linux-nat: remove check based on current_inferior in linux_handle_extended_wait Simon Marchi
2022-03-31 16:12   ` Pedro Alves
2022-03-31 17:06     ` Simon Marchi
2022-01-17 16:27 ` [PATCH 3/8] gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done Simon Marchi
2022-03-31 18:17   ` Pedro Alves
2022-04-01 14:25     ` Simon Marchi
2022-01-17 16:27 ` [PATCH 4/8] gdb/infrun: add inferior parameters to stop_all_threads and restart_threads Simon Marchi
2022-03-31 18:17   ` Pedro Alves
2022-01-17 16:27 ` [PATCH 5/8] gdb/infrun: add logging statement to do_target_resume Simon Marchi
2022-03-31 18:18   ` Pedro Alves
2022-01-17 16:27 ` [PATCH 6/8] gdb: fix handling of vfork by multi-threaded program (follow-fork-mode=parent, detach-on-fork=on) Simon Marchi
2022-03-31 18:21   ` Pedro Alves
2022-04-01 17:28     ` Simon Marchi
2022-01-17 16:27 ` [PATCH 7/8] gdbserver: report correct status in thread stop race condition Simon Marchi
2022-03-31 18:21   ` Pedro Alves
2022-01-17 16:27 ` [PATCH 8/8] gdb: resume ongoing step after handling fork or vfork Simon Marchi
2022-03-31 18:22   ` Pedro Alves
2022-03-31 18:28   ` Pedro Alves
2022-04-01 18:42     ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).