* [PATCH 0/2] Fix detach bug when lwp has exited/terminated @ 2023-11-11 22:26 Kevin Buettner 2023-11-11 22:26 ` [PATCH 1/2] linux-nat.c, linux-fork.c: " Kevin Buettner 2023-11-11 22:26 ` [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp Kevin Buettner 0 siblings, 2 replies; 7+ messages in thread From: Kevin Buettner @ 2023-11-11 22:26 UTC (permalink / raw) To: gdb-patches; +Cc: Kevin Buettner Part one two part series is a fix for a detach bug which occurs when the inferior has been terminated or killed. Part 2 is the test case. Kevin Buettner (2): linux-nat.c, linux-fork.c: Fix detach bug when lwp has exited/terminated New test: gdb.base/process-dies-while-detaching.exp gdb/linux-fork.c | 22 ++- gdb/linux-fork.h | 2 +- gdb/linux-nat.c | 17 ++- gdb/testsuite/gdb.base/kill-during-detach.c | 32 +++++ gdb/testsuite/gdb.base/kill-during-detach.exp | 132 ++++++++++++++++++ 5 files changed, 196 insertions(+), 9 deletions(-) create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.c create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.exp -- 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] linux-nat.c, linux-fork.c: Fix detach bug when lwp has exited/terminated 2023-11-11 22:26 [PATCH 0/2] Fix detach bug when lwp has exited/terminated Kevin Buettner @ 2023-11-11 22:26 ` Kevin Buettner 2023-11-13 10:58 ` Andrew Burgess 2023-11-11 22:26 ` [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp Kevin Buettner 1 sibling, 1 reply; 7+ messages in thread From: Kevin Buettner @ 2023-11-11 22:26 UTC (permalink / raw) To: gdb-patches; +Cc: Kevin Buettner When using GDB on native linux, it can happen that, while attempting to detach an inferior, the inferior may have been exited or have been killed, yet still be in the list of lwps. Should that happen, the assert in x86_linux_update_debug_registers in gdb/nat/x86-linux-dregs.c will trigger. The line in question looks like this: gdb_assert (lwp_is_stopped (lwp)); For this case, the lwp isn't stopped - it's dead. The bug which brought this problem to my attention is one in which the pwntools library uses GDB to to debug a process; as the script is shutting things down, it kills the process that GDB is debugging and also sends GDB a SIGTERM signal, which causes GDB to detach all inferiors prior to exiting. Here's a link to the bug: https://bugzilla.redhat.com/show_bug.cgi?id=2192169 The following shell command mimics part of what the pwntools reproducer script does (with regard to shutting things down), but reproduces the bug much less reliably. I have found it necessary to run the command a bunch of times before seeing the bug. (I usually see it within 5-10 repetitions.) If you choose to try this command, make sure that you have no running "cat" or "gdb" processes first! cat </dev/zero >/dev/null & \ (sleep 5; (kill -KILL `pgrep cat` & kill -TERM `pgrep gdb`)) & \ sleep 1 ; \ gdb -q -iex 'set debuginfod enabled off' -ex 'set height 0' \ -ex c /usr/bin/cat `pgrep cat` So, basically, the idea here is to kill both gdb and cat at roughly the same time. If we happen to attempt the detach before the process lwp has been deleted from GDB's (linux native) LWP data structures, then the assert will trigger. The relevant part of the backtrace looks like this: #8 0x00000000008a83ae in x86_linux_update_debug_registers (lwp=0x1873280) at gdb/nat/x86-linux-dregs.c:146 #9 0x00000000008a862f in x86_linux_prepare_to_resume (lwp=0x1873280) at gdb/nat/x86-linux.c:81 #10 0x000000000048ea42 in x86_linux_nat_target::low_prepare_to_resume ( this=0x121eee0 <the_amd64_linux_nat_target>, lwp=0x1873280) at gdb/x86-linux-nat.h:70 #11 0x000000000081a452 in detach_one_lwp (lp=0x1873280, signo_p=0x7fff8ca3441c) at gdb/linux-nat.c:1374 #12 0x000000000081a85f in linux_nat_target::detach ( this=0x121eee0 <the_amd64_linux_nat_target>, inf=0x16e8f70, from_tty=0) at gdb/linux-nat.c:1450 #13 0x000000000083a23b in thread_db_target::detach ( this=0x1206ae0 <the_thread_db_target>, inf=0x16e8f70, from_tty=0) at gdb/linux-thread-db.c:1385 #14 0x0000000000a66722 in target_detach (inf=0x16e8f70, from_tty=0) at gdb/target.c:2526 #15 0x0000000000a8f0ad in kill_or_detach (inf=0x16e8f70, from_tty=0) at gdb/top.c:1659 #16 0x0000000000a8f4fa in quit_force (exit_arg=0x0, from_tty=0) at gdb/top.c:1762 #17 0x000000000070829c in async_sigterm_handler (arg=0x0) at gdb/event-top.c:1141 My colleague, Andrew Burgess, has done some recent work on other problems with detach. Upon hearing of this problem, he came up a test case which reliably reproduces the problem and tests for a few other problems as well. In addition to testing detach when the inferior has terminated due to a signal, it also tests detach when the inferior has exited normally. Andrew observed that the linux-native-only "checkpoint" command would be affected too, so the test also tests those cases when there's an active checkpoint. For the LWP exit / termination case with no checkpoint, that's handled via newly added checks of the waitstatus in detach_one_lwp in linux-nat.c. For the checkpoint detach problem, I chose to pass the lwp_info to linux_fork_detach in linux-fork.c. With that in place, suitable tests were added before attempting a PTRACE_DETACH operation. I added a few asserts at the beginning of linux_fork_detach and modified the caller code so that the newly added asserts shouldn't trigger. (That's what the 'pid == inferior_ptid.pid' check is about in gdb/linux-nat.c.) Finally, the #include for linux-fork.h had to be moved after that of linux-nat.c so that the type of lwp_info would be known. Lastly, I'll note that the checkpoint code needs some work with regard to background execution. This patch doesn't attempt to fix that problem, but it doesn't make it any worse. It does slightly improve the situation with detach because, due to the check noted above, linux_fork_detach() won't be called for the wrong inferior when there are multiple inferiors. (I haven't checked closely, but I don't think that the rest of the checkpoint code works correctly when there are multiple inferiors.) --- gdb/linux-fork.c | 22 ++++++++++++++++------ gdb/linux-fork.h | 2 +- gdb/linux-nat.c | 17 +++++++++++++++-- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 52e385411c7..73d086938bd 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -25,13 +25,14 @@ #include "gdbcmd.h" #include "infcall.h" #include "objfiles.h" -#include "linux-fork.h" #include "linux-nat.h" +#include "linux-fork.h" #include "gdbthread.h" #include "source.h" #include "nat/gdb_ptrace.h" #include "gdbsupport/gdb_wait.h" +#include "target/waitstatus.h" #include <dirent.h> #include <ctype.h> @@ -361,15 +362,24 @@ linux_fork_mourn_inferior (void) the first available. */ void -linux_fork_detach (int from_tty) +linux_fork_detach (int from_tty, lwp_info *lp) { + gdb_assert (lp != nullptr); + gdb_assert (lp->ptid == inferior_ptid); + /* OK, inferior_ptid is the one we are detaching from. We need to delete it from the fork_list, and switch to the next available - fork. */ + fork. But before doing the detach, do make sure that the lwp + hasn't exited or been terminated first. */ - if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0)) - error (_("Unable to detach %s"), - target_pid_to_str (inferior_ptid).c_str ()); + if (lp->waitstatus.kind () != TARGET_WAITKIND_EXITED + && lp->waitstatus.kind () != TARGET_WAITKIND_THREAD_EXITED + && lp->waitstatus.kind () != TARGET_WAITKIND_SIGNALLED) + { + if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0)) + error (_("Unable to detach %s"), + target_pid_to_str (inferior_ptid).c_str ()); + } delete_fork (inferior_ptid); diff --git a/gdb/linux-fork.h b/gdb/linux-fork.h index 5a593fca91e..6e8f5ab7d0b 100644 --- a/gdb/linux-fork.h +++ b/gdb/linux-fork.h @@ -25,7 +25,7 @@ extern void add_fork (pid_t); extern struct fork_info *find_fork_pid (pid_t); extern void linux_fork_killall (void); extern void linux_fork_mourn_inferior (void); -extern void linux_fork_detach (int); +extern void linux_fork_detach (int, lwp_info *); extern int forks_exist_p (void); extern int linux_fork_checkpointing_p (int); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 1c9756c18bd..bf2da572de0 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1354,6 +1354,19 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p) lp->signalled = 0; } + /* If the lwp has exited or was terminated due to a signal, there's + nothing left to do. */ + if (lp->waitstatus.kind () == TARGET_WAITKIND_EXITED + || lp->waitstatus.kind () == TARGET_WAITKIND_THREAD_EXITED + || lp->waitstatus.kind () == TARGET_WAITKIND_SIGNALLED) + { + linux_nat_debug_printf + ("Can't detach %s - it has exited or was terminated: %s.", + lp->ptid.to_string ().c_str (), + lp->waitstatus.to_string ().c_str ()); + return; + } + if (signo_p == NULL) { /* Pass on any pending signal for this LWP. */ @@ -1427,13 +1440,13 @@ linux_nat_target::detach (inferior *inf, int from_tty) gdb_assert (num_lwps (pid) == 1 || (target_is_non_stop_p () && num_lwps (pid) == 0)); - if (forks_exist_p ()) + if (pid == inferior_ptid.pid () && forks_exist_p ()) { /* Multi-fork case. The current inferior_ptid is being detached from, but there are other viable forks to debug. Detach from the current fork, and context-switch to the first available. */ - linux_fork_detach (from_tty); + linux_fork_detach (from_tty, find_lwp_pid (ptid_t (pid))); } else { -- 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] linux-nat.c, linux-fork.c: Fix detach bug when lwp has exited/terminated 2023-11-11 22:26 ` [PATCH 1/2] linux-nat.c, linux-fork.c: " Kevin Buettner @ 2023-11-13 10:58 ` Andrew Burgess 2023-11-14 1:36 ` Kevin Buettner 0 siblings, 1 reply; 7+ messages in thread From: Andrew Burgess @ 2023-11-13 10:58 UTC (permalink / raw) To: Kevin Buettner, gdb-patches; +Cc: Kevin Buettner Kevin Buettner <kevinb@redhat.com> writes: > When using GDB on native linux, it can happen that, while attempting > to detach an inferior, the inferior may have been exited or have been > killed, yet still be in the list of lwps. Should that happen, the > assert in x86_linux_update_debug_registers in > gdb/nat/x86-linux-dregs.c will trigger. The line in question looks > like this: > > gdb_assert (lwp_is_stopped (lwp)); > > For this case, the lwp isn't stopped - it's dead. > > The bug which brought this problem to my attention is one in which the > pwntools library uses GDB to to debug a process; as the script is > shutting things down, it kills the process that GDB is debugging and > also sends GDB a SIGTERM signal, which causes GDB to detach all > inferiors prior to exiting. Here's a link to the bug: > > https://bugzilla.redhat.com/show_bug.cgi?id=2192169 > > The following shell command mimics part of what the pwntools > reproducer script does (with regard to shutting things down), but > reproduces the bug much less reliably. I have found it necessary to > run the command a bunch of times before seeing the bug. (I usually > see it within 5-10 repetitions.) If you choose to try this command, > make sure that you have no running "cat" or "gdb" processes first! > > cat </dev/zero >/dev/null & \ > (sleep 5; (kill -KILL `pgrep cat` & kill -TERM `pgrep gdb`)) & \ > sleep 1 ; \ > gdb -q -iex 'set debuginfod enabled off' -ex 'set height 0' \ > -ex c /usr/bin/cat `pgrep cat` > > So, basically, the idea here is to kill both gdb and cat at roughly > the same time. If we happen to attempt the detach before the process > lwp has been deleted from GDB's (linux native) LWP data structures, > then the assert will trigger. The relevant part of the backtrace > looks like this: > > #8 0x00000000008a83ae in x86_linux_update_debug_registers (lwp=0x1873280) > at gdb/nat/x86-linux-dregs.c:146 > #9 0x00000000008a862f in x86_linux_prepare_to_resume (lwp=0x1873280) > at gdb/nat/x86-linux.c:81 > #10 0x000000000048ea42 in x86_linux_nat_target::low_prepare_to_resume ( > this=0x121eee0 <the_amd64_linux_nat_target>, lwp=0x1873280) > at gdb/x86-linux-nat.h:70 > #11 0x000000000081a452 in detach_one_lwp (lp=0x1873280, signo_p=0x7fff8ca3441c) > at gdb/linux-nat.c:1374 > #12 0x000000000081a85f in linux_nat_target::detach ( > this=0x121eee0 <the_amd64_linux_nat_target>, inf=0x16e8f70, from_tty=0) > at gdb/linux-nat.c:1450 > #13 0x000000000083a23b in thread_db_target::detach ( > this=0x1206ae0 <the_thread_db_target>, inf=0x16e8f70, from_tty=0) > at gdb/linux-thread-db.c:1385 > #14 0x0000000000a66722 in target_detach (inf=0x16e8f70, from_tty=0) > at gdb/target.c:2526 > #15 0x0000000000a8f0ad in kill_or_detach (inf=0x16e8f70, from_tty=0) > at gdb/top.c:1659 > #16 0x0000000000a8f4fa in quit_force (exit_arg=0x0, from_tty=0) > at gdb/top.c:1762 > #17 0x000000000070829c in async_sigterm_handler (arg=0x0) > at gdb/event-top.c:1141 > > My colleague, Andrew Burgess, has done some recent work on other > problems with detach. Upon hearing of this problem, he came up a test > case which reliably reproduces the problem and tests for a few other > problems as well. In addition to testing detach when the inferior has > terminated due to a signal, it also tests detach when the inferior has > exited normally. Andrew observed that the linux-native-only > "checkpoint" command would be affected too, so the test also tests > those cases when there's an active checkpoint. > > For the LWP exit / termination case with no checkpoint, that's handled > via newly added checks of the waitstatus in detach_one_lwp in > linux-nat.c. > > For the checkpoint detach problem, I chose to pass the lwp_info > to linux_fork_detach in linux-fork.c. With that in place, suitable > tests were added before attempting a PTRACE_DETACH operation. > > I added a few asserts at the beginning of linux_fork_detach and > modified the caller code so that the newly added asserts shouldn't > trigger. (That's what the 'pid == inferior_ptid.pid' check is about > in gdb/linux-nat.c.) > > Finally, the #include for linux-fork.h had to be moved after that > of linux-nat.c so that the type of lwp_info would be known. > > Lastly, I'll note that the checkpoint code needs some work with > regard to background execution. This patch doesn't attempt to > fix that problem, but it doesn't make it any worse. It does > slightly improve the situation with detach because, due to the > check noted above, linux_fork_detach() won't be called for the > wrong inferior when there are multiple inferiors. (I haven't > checked closely, but I don't think that the rest of the checkpoint > code works correctly when there are multiple inferiors.) > --- > gdb/linux-fork.c | 22 ++++++++++++++++------ > gdb/linux-fork.h | 2 +- > gdb/linux-nat.c | 17 +++++++++++++++-- > 3 files changed, 32 insertions(+), 9 deletions(-) > > diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c > index 52e385411c7..73d086938bd 100644 > --- a/gdb/linux-fork.c > +++ b/gdb/linux-fork.c > @@ -25,13 +25,14 @@ > #include "gdbcmd.h" > #include "infcall.h" > #include "objfiles.h" > -#include "linux-fork.h" > #include "linux-nat.h" > +#include "linux-fork.h" This change is only needed so that linux-fork.h sees the declaration of lwp_info from linux-nat.h. I'm firmly of the opinion that a header file should pull in all of its dependencies, rather than relying on the #include order of its users. So, instead of this change, I think you should really just add: struct lwp_info; to linux-fork.h. > #include "gdbthread.h" > #include "source.h" > > #include "nat/gdb_ptrace.h" > #include "gdbsupport/gdb_wait.h" > +#include "target/waitstatus.h" > #include <dirent.h> > #include <ctype.h> > > @@ -361,15 +362,24 @@ linux_fork_mourn_inferior (void) > the first available. */ > > void > -linux_fork_detach (int from_tty) > +linux_fork_detach (int from_tty, lwp_info *lp) > { > + gdb_assert (lp != nullptr); > + gdb_assert (lp->ptid == inferior_ptid); > + > /* OK, inferior_ptid is the one we are detaching from. We need to > delete it from the fork_list, and switch to the next available > - fork. */ > + fork. But before doing the detach, do make sure that the lwp > + hasn't exited or been terminated first. */ > > - if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0)) > - error (_("Unable to detach %s"), > - target_pid_to_str (inferior_ptid).c_str ()); > + if (lp->waitstatus.kind () != TARGET_WAITKIND_EXITED > + && lp->waitstatus.kind () != TARGET_WAITKIND_THREAD_EXITED > + && lp->waitstatus.kind () != TARGET_WAITKIND_SIGNALLED) > + { > + if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0)) > + error (_("Unable to detach %s"), > + target_pid_to_str (inferior_ptid).c_str ()); > + } > > delete_fork (inferior_ptid); > > diff --git a/gdb/linux-fork.h b/gdb/linux-fork.h > index 5a593fca91e..6e8f5ab7d0b 100644 > --- a/gdb/linux-fork.h > +++ b/gdb/linux-fork.h > @@ -25,7 +25,7 @@ extern void add_fork (pid_t); > extern struct fork_info *find_fork_pid (pid_t); > extern void linux_fork_killall (void); > extern void linux_fork_mourn_inferior (void); > -extern void linux_fork_detach (int); > +extern void linux_fork_detach (int, lwp_info *); > extern int forks_exist_p (void); > extern int linux_fork_checkpointing_p (int); > > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 1c9756c18bd..bf2da572de0 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -1354,6 +1354,19 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p) > lp->signalled = 0; > } > > + /* If the lwp has exited or was terminated due to a signal, there's > + nothing left to do. */ > + if (lp->waitstatus.kind () == TARGET_WAITKIND_EXITED > + || lp->waitstatus.kind () == TARGET_WAITKIND_THREAD_EXITED > + || lp->waitstatus.kind () == TARGET_WAITKIND_SIGNALLED) > + { > + linux_nat_debug_printf > + ("Can't detach %s - it has exited or was terminated: %s.", This line should be indented with a leading <tab>. The binutils-gdb/.gitattributes file should result in this issue being highlighted if you 'git show' this patch. > + lp->ptid.to_string ().c_str (), > + lp->waitstatus.to_string ().c_str ()); > + return; I wonder if we should be calling `delete_lwp (lp->ptid);` before calling return here? I suspect that, at least in the test case you have, that this doesn't really matter, we'll likely end up calling purge_lwp_list via linux_nat_target::mourn_inferior ... but it still feels like we should be making the call. > + } > + > if (signo_p == NULL) > { > /* Pass on any pending signal for this LWP. */ > @@ -1427,13 +1440,13 @@ linux_nat_target::detach (inferior *inf, int from_tty) > gdb_assert (num_lwps (pid) == 1 > || (target_is_non_stop_p () && num_lwps (pid) == 0)); > > - if (forks_exist_p ()) > + if (pid == inferior_ptid.pid () && forks_exist_p ()) I see how this ties to the assert in linux_fork_detach. And given the comments and use of inferior_ptid, I can see why you added the assert. But I guess you added the check because some test triggered the assert. Do you recall which test that was? I guess I'm curious what PID we are trying to detach from when this condition triggers. Thanks, Andrew > { > /* Multi-fork case. The current inferior_ptid is being detached > from, but there are other viable forks to debug. Detach from > the current fork, and context-switch to the first > available. */ > - linux_fork_detach (from_tty); > + linux_fork_detach (from_tty, find_lwp_pid (ptid_t (pid))); > } > else > { > -- > 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] linux-nat.c, linux-fork.c: Fix detach bug when lwp has exited/terminated 2023-11-13 10:58 ` Andrew Burgess @ 2023-11-14 1:36 ` Kevin Buettner 2023-11-14 5:48 ` Kevin Buettner 0 siblings, 1 reply; 7+ messages in thread From: Kevin Buettner @ 2023-11-14 1:36 UTC (permalink / raw) To: Andrew Burgess; +Cc: gdb-patches Hi Andrew, I'll make (or at least consider) the changes that you requested, but I see that you also asked a question. I'll answer that now... On Mon, 13 Nov 2023 10:58:12 +0000 Andrew Burgess <aburgess@redhat.com> wrote: > Kevin Buettner <kevinb@redhat.com> writes: > > + } > > + > > if (signo_p == NULL) > > { > > /* Pass on any pending signal for this LWP. */ > > @@ -1427,13 +1440,13 @@ linux_nat_target::detach (inferior *inf, int from_tty) > > gdb_assert (num_lwps (pid) == 1 > > || (target_is_non_stop_p () && num_lwps (pid) == 0)); > > > > - if (forks_exist_p ()) > > + if (pid == inferior_ptid.pid () && forks_exist_p ()) > > I see how this ties to the assert in linux_fork_detach. And given the > comments and use of inferior_ptid, I can see why you added the assert. > > But I guess you added the check because some test triggered the assert. > Do you recall which test that was? I guess I'm curious what PID we are > trying to detach from when this condition triggers. I added that check and the asserts when I realized that the lwp that I was (now) passing to linux_fork_detach might not be the same as that for inferior_ptid. There was no test that I ran which demonstrated the problem. I was imagining something like this, below, using two of the executables from gdb.multi/base.exp: kev@f39-1:gdb$ ./gdb GNU gdb (GDB) 15.0.50.20231110-git [snipped start-up messages...] (gdb) file testsuite/outputs/gdb.multi/base/hello Reading symbols from testsuite/outputs/gdb.multi/base/hello... (gdb) start Temporary breakpoint 1 at 0x401199: file /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c, line 51. Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello [snipped debuginfod stuff...] Temporary breakpoint 1, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) info inferiors Num Description Connection Executable * 1 process 238425 1 (native) /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello (gdb) add-inferior -exec testsuite/outputs/gdb.multi/base/goodbye [New inferior 2] Added inferior 2 on connection 1 (native) Reading symbols from testsuite/outputs/gdb.multi/base/goodbye... (gdb) info inferiors Num Description Connection Executable * 1 process 238425 1 (native) /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello 2 <null> 1 (native) /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye (gdb) inferior 2 [Switching to inferior 2 [<null>] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye)] (gdb) start Temporary breakpoint 2 at 0x401199: -qualified main. (2 locations) Starting program: /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Thread 2.1 "goodbye" hit Temporary breakpoint 2.2, main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:61 61 mailand(); (gdb) checkpoint checkpoint 1: fork returned pid 238435. (gdb) info inferiors Num Description Connection Executable 1 process 238425 1 (native) /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello * 2 process 238434 1 (native) /mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/goodbye (gdb) info checkpoint * 0 Thread 0x7ffff7cd3740 (LWP 238434) (main process) at 0x0 1 process 238435 at 0x40124e, file /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c, line 61 (gdb) s mailand () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:46 46 glob = 46; (gdb) s 47 } (gdb) s main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:62 62 foo(glob); (gdb) s foo (x=46) at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/goodbye.c:51 51 return x + 92; (gdb) inferior 1 [Switching to inferior 1 [process 238425] (/mesquite2/sourceware-git/f39-master/bld/gdb/testsuite/outputs/gdb.multi/base/hello)] [Switching to thread 1.1 (Thread 0x7ffff7cd3740 (LWP 238425))] #0 main () at /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/testsuite/gdb.multi/hello.c:51 51 alarm (240); (gdb) detach /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624: internal-error: lwp_lwpid_htab_add_lwp: Assertion `slot != NULL && *slot == NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x4ef132 gdb_internal_backtrace_1 /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:122 0x4ef132 _Z22gdb_internal_backtracev /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/bt-utils.c:168 0x8d9074 internal_vproblem /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:396 0x8d92f8 _Z15internal_verrorPKciS0_P13__va_list_tag /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/utils.c:476 0xa1e431 _Z18internal_error_locPKciS0_z /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/errors.cc:58 0x6c4a41 lwp_lwpid_htab_add_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624 0x6c4a41 add_initial_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:792 0x6c7d58 add_lwp /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:806 0x6c7d58 _Z21linux_nat_switch_fork6ptid_t /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:887 0x6c28fe fork_load_infrun_state /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:219 0x6c343b _Z17linux_fork_detachi /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-fork.c:381 0x6c8bd8 _ZN16linux_nat_target6detachEP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:1436 0x6d8652 _ZN16thread_db_target6detachEP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-thread-db.c:1385 0x85e943 _Z13target_detachP8inferiori /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/target.c:2526 0x680aed _Z14detach_commandPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/infcmd.c:2863 0x5224ac _Z8cmd_funcP16cmd_list_elementPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/cli/cli-decode.c:2735 0x86cd0a _Z15execute_commandPKci /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/top.c:575 0x600c4f _Z15command_handlerPKc /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:552 0x60204a _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:788 0x60149b gdb_rl_callback_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:259 0x91ef44 rl_callback_read_char /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/readline/readline/callback.c:290 0x6015bd gdb_rl_callback_read_char_wrapper_noexcept /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:195 0x60173c gdb_rl_callback_read_char_wrapper /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/event-top.c:234 0x8a763f stdin_event_handler /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/ui.c:155 0xa1ed35 gdb_wait_for_event /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:716 0xa1f7f7 _Z16gdb_do_one_eventi /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdbsupport/event-loop.cc:264 0x6e92c9 start_event_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:407 0x6e92c9 captured_command_loop /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:471 0x6ebba4 captured_main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1324 0x6ebba4 _Z8gdb_mainP18captured_main_args /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/main.c:1343 0x446ad4 main /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/gdb.c:39 --------------------- /mesquite2/sourceware-git/f39-master/bld/../../worktree-master/gdb/linux-nat.c:624: internal-error: lwp_lwpid_htab_add_lwp: Assertion `slot != NULL && *slot == NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. I see this problem both with my patch and without, so there's more to be done in to make the checkpoint support work with multiple inferiors. I would guess that the check that I added reduces by (at least) one, the number of problems that exist with the linux checkpoint code. I'll file a bug and add this to my list of things to look at. Kevin ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] linux-nat.c, linux-fork.c: Fix detach bug when lwp has exited/terminated 2023-11-14 1:36 ` Kevin Buettner @ 2023-11-14 5:48 ` Kevin Buettner 0 siblings, 0 replies; 7+ messages in thread From: Kevin Buettner @ 2023-11-14 5:48 UTC (permalink / raw) To: Andrew Burgess; +Cc: gdb-patches On Mon, 13 Nov 2023 18:36:35 -0700 Kevin Buettner <kevinb@redhat.com> wrote: > I'll file a bug and add this to my list of things to look at. The bug is: https://sourceware.org/bugzilla/show_bug.cgi?id=31065 Kevin ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp 2023-11-11 22:26 [PATCH 0/2] Fix detach bug when lwp has exited/terminated Kevin Buettner 2023-11-11 22:26 ` [PATCH 1/2] linux-nat.c, linux-fork.c: " Kevin Buettner @ 2023-11-11 22:26 ` Kevin Buettner 2023-11-13 11:04 ` Andrew Burgess 1 sibling, 1 reply; 7+ messages in thread From: Kevin Buettner @ 2023-11-11 22:26 UTC (permalink / raw) To: gdb-patches; +Cc: Kevin Buettner, Andrew Burgess Andrew Burgess is the primary author of this test case. Its design is similar to that of gdb.threads/main-thread-exit-during-detach.exp, which was also written by Andrew. This test checks that GDB correctly handles several cases that can occur when GDB attempts to detach an inferior process. The process can exit or be terminated (e.g. via SIGKILL) prior to GDB's event loop getting a chance to remove it from GDB's internal data structures. To complicate things even more, detach works differently when a checkpoint (created via GDB's "checkpoint" command) exists for the inferior. This test checks all four possibilities: process exit with no checkpoint, process termination with no checkpoint, process exit with a checkpoint, and process termination with a checkpoint. Co-Authored-By: Andrew Burgess <aburgess@redhat.com> --- gdb/testsuite/gdb.base/kill-during-detach.c | 32 +++++ gdb/testsuite/gdb.base/kill-during-detach.exp | 132 ++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.c create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.exp diff --git a/gdb/testsuite/gdb.base/kill-during-detach.c b/gdb/testsuite/gdb.base/kill-during-detach.c new file mode 100644 index 00000000000..2d9cca91e2f --- /dev/null +++ b/gdb/testsuite/gdb.base/kill-during-detach.c @@ -0,0 +1,32 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2023 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <unistd.h> + +volatile int dont_exit_just_yet = 1; + +int +main () +{ + alarm (300); + + /* Spin until GDB releases us. */ + while (dont_exit_just_yet) + usleep (100000); + + _exit (0); +} diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp new file mode 100644 index 00000000000..26028d5fc34 --- /dev/null +++ b/gdb/testsuite/gdb.base/kill-during-detach.exp @@ -0,0 +1,132 @@ +# Copyright 2023 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This test checks that GDB correctly handles several cases that can +# occur when GDB attempts to detach an inferior process. The process +# can exit or be terminated (e.g. via SIGKILL) prior to GDB's event +# loop getting a chance to remove it from GDB's internal data +# structures. To complicate things even more, detach works differently +# when a checkpoint (created via GDB's "checkpoint" command) exists for +# the inferior. This test checks all four possibilities: process exit +# with no checkpoint, process termination with no checkpoint, process +# exit with a checkpoint, and process termination with a checkpoint. + +standard_testfile + +# This test requires python. +require allow_python_tests + +# This test attempts to kill a process on the host running GDB, so +# disallow remote targets. (Setting --target_board to +# native-gdbserver or native-extended-gdbserver should still work.) +require {!is_remote target} + +# Checkpoint support only works on native Linux: +if { [istarget "*-*-linux*"] && [target_info gdb_protocol] == ""} { + set has_checkpoint true +} else { + set has_checkpoint false +} + +if {[build_executable "failed to prepare" $testfile $srcfile] == -1} { + return -1 +} + +# Start an inferior, which blocks in a spin loop. Setup a Python +# function that performs an action based on EXIT_P that will cause the +# inferior to exit, and then, within the same Python function, ask GDB +# to detach from the inferior. Use 'continue&' to run the inferior in +# the background, and then invoke the Python function. Note, too, that +# non-stop mode is enabled during the restart; if this is not done, +# remote_target::putpkt_binary in remote.c will disallow some of the +# operations necessary for this test. +# +# The idea is that GDB's event loop will not get a chance to handle +# the inferior exiting, so it will only be at the point that we try to +# detach that we notice that the inferior has exited. +# +# When EXIT_P is true the action we perform to terminate the inferior +# is to set a flag in the inferior, which allows the inferior to break +# out of its spin loop. +# +# When EXIT_P is false the action we perform is to send SIGKILL to the +# inferior. +# +# When CHECKPOINT_P is true, before issuing 'continue&' we use the +# 'checkpoint' command to create a checkpoint of GDB. +# +# When CHECKPOINT_P is false we don't use the 'checkpoint' command. +proc run_test { exit_p checkpoint_p } { + save_vars { ::GDBFLAGS } { + append ::GDBFLAGS " -ex \"set non-stop on\"" + clean_restart $::binfile + } + + if {![runto_main]} { + return -1 + } + + if { $checkpoint_p } { + gdb_test "checkpoint" \ + "checkpoint 1: fork returned pid $::decimal\\." + } + + # Must get the PID before we resume the inferior. + set inf_pid [get_inferior_pid] + + # Put the PID in a python variable so that a numerical PID won't + # appear in the PASS/FAIL output. + gdb_test_no_output "python inf_pid=$inf_pid" "assign inf_pid" + + gdb_test "continue &" + + if { $exit_p } { + set action_line "gdb.execute(\"set variable dont_exit_just_yet=0\")" + } else { + set action_line "os.kill(inf_pid, signal.SIGKILL)" + } + + gdb_test_multiline "Create worker function" \ + "python" "" \ + "import time" "" \ + "import os" "" \ + "import signal" "" \ + "def kill_and_detach():" "" \ + " $action_line" "" \ + " time.sleep(1)" "" \ + " gdb.execute(\"detach\")" "" \ + "end" "" + + if { $checkpoint_p } { + # NOTE: The 'checkpoint' system in GDB appears to be a little + # iffy. This detach does seem to restore the checkpoint, but + # it leaves the inferior stuck in a running state. + gdb_test_no_output "python kill_and_detach()" + } else { + gdb_test "python kill_and_detach()" \ + "\\\[Inferior $::decimal \[^\r\n\]+ detached\\\]" + } +} + +if { $has_checkpoint } { + set checkpoint_iters { true false } +} else { + set checkpoint_iters { false } +} + +foreach_with_prefix exit_p { true false } { + foreach_with_prefix checkpoint_p $checkpoint_iters { + run_test $exit_p $checkpoint_p + } +} -- 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp 2023-11-11 22:26 ` [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp Kevin Buettner @ 2023-11-13 11:04 ` Andrew Burgess 0 siblings, 0 replies; 7+ messages in thread From: Andrew Burgess @ 2023-11-13 11:04 UTC (permalink / raw) To: Kevin Buettner, gdb-patches; +Cc: Kevin Buettner Kevin Buettner <kevinb@redhat.com> writes: > Andrew Burgess is the primary author of this test case. Its design > is similar to that of gdb.threads/main-thread-exit-during-detach.exp, > which was also written by Andrew. > > This test checks that GDB correctly handles several cases that can > occur when GDB attempts to detach an inferior process. The process > can exit or be terminated (e.g. via SIGKILL) prior to GDB's event > loop getting a chance to remove it from GDB's internal data > structures. To complicate things even more, detach works differently > when a checkpoint (created via GDB's "checkpoint" command) exists for > the inferior. This test checks all four possibilities: process exit > with no checkpoint, process termination with no checkpoint, process > exit with a checkpoint, and process termination with a checkpoint. > > Co-Authored-By: Andrew Burgess <aburgess@redhat.com> > --- > gdb/testsuite/gdb.base/kill-during-detach.c | 32 +++++ > gdb/testsuite/gdb.base/kill-during-detach.exp | 132 ++++++++++++++++++ I really dislike having tests added in a separate commit to the change they relate too. Please would you consider combining these two commits. I often end up looking back at historic commits: I want to modify some corner of GDB so I use 'git blame' to find a commit to look at. In an ideal world, the commit includes tests, then, when I modify the code in question, I know that this particular test is a good candidate to use to ensure I've not broken anything. But in addition, I often find I can understand some code better if I can see it in action. Having an included test means I immediately have a good test which makes use of the code I'm interested in. Neither of the above are impossible to figure out when the tests are separated out like this .... but, in this case I see no benefit to splitting out the tests, only downsides. Otherwise, this looks good to me. Approved-By: Andrew Burgess <aburgess@redhat.com> Thanks, Andrew > 2 files changed, 164 insertions(+) > create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.c > create mode 100644 gdb/testsuite/gdb.base/kill-during-detach.exp > > diff --git a/gdb/testsuite/gdb.base/kill-during-detach.c b/gdb/testsuite/gdb.base/kill-during-detach.c > new file mode 100644 > index 00000000000..2d9cca91e2f > --- /dev/null > +++ b/gdb/testsuite/gdb.base/kill-during-detach.c > @@ -0,0 +1,32 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2023 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see <http://www.gnu.org/licenses/>. */ > + > +#include <unistd.h> > + > +volatile int dont_exit_just_yet = 1; > + > +int > +main () > +{ > + alarm (300); > + > + /* Spin until GDB releases us. */ > + while (dont_exit_just_yet) > + usleep (100000); > + > + _exit (0); > +} > diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp > new file mode 100644 > index 00000000000..26028d5fc34 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/kill-during-detach.exp > @@ -0,0 +1,132 @@ > +# Copyright 2023 Free Software Foundation, Inc. > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +# This test checks that GDB correctly handles several cases that can > +# occur when GDB attempts to detach an inferior process. The process > +# can exit or be terminated (e.g. via SIGKILL) prior to GDB's event > +# loop getting a chance to remove it from GDB's internal data > +# structures. To complicate things even more, detach works differently > +# when a checkpoint (created via GDB's "checkpoint" command) exists for > +# the inferior. This test checks all four possibilities: process exit > +# with no checkpoint, process termination with no checkpoint, process > +# exit with a checkpoint, and process termination with a checkpoint. > + > +standard_testfile > + > +# This test requires python. > +require allow_python_tests > + > +# This test attempts to kill a process on the host running GDB, so > +# disallow remote targets. (Setting --target_board to > +# native-gdbserver or native-extended-gdbserver should still work.) > +require {!is_remote target} > + > +# Checkpoint support only works on native Linux: > +if { [istarget "*-*-linux*"] && [target_info gdb_protocol] == ""} { > + set has_checkpoint true > +} else { > + set has_checkpoint false > +} > + > +if {[build_executable "failed to prepare" $testfile $srcfile] == -1} { > + return -1 > +} > + > +# Start an inferior, which blocks in a spin loop. Setup a Python > +# function that performs an action based on EXIT_P that will cause the > +# inferior to exit, and then, within the same Python function, ask GDB > +# to detach from the inferior. Use 'continue&' to run the inferior in > +# the background, and then invoke the Python function. Note, too, that > +# non-stop mode is enabled during the restart; if this is not done, > +# remote_target::putpkt_binary in remote.c will disallow some of the > +# operations necessary for this test. > +# > +# The idea is that GDB's event loop will not get a chance to handle > +# the inferior exiting, so it will only be at the point that we try to > +# detach that we notice that the inferior has exited. > +# > +# When EXIT_P is true the action we perform to terminate the inferior > +# is to set a flag in the inferior, which allows the inferior to break > +# out of its spin loop. > +# > +# When EXIT_P is false the action we perform is to send SIGKILL to the > +# inferior. > +# > +# When CHECKPOINT_P is true, before issuing 'continue&' we use the > +# 'checkpoint' command to create a checkpoint of GDB. > +# > +# When CHECKPOINT_P is false we don't use the 'checkpoint' command. > +proc run_test { exit_p checkpoint_p } { > + save_vars { ::GDBFLAGS } { > + append ::GDBFLAGS " -ex \"set non-stop on\"" > + clean_restart $::binfile > + } > + > + if {![runto_main]} { > + return -1 > + } > + > + if { $checkpoint_p } { > + gdb_test "checkpoint" \ > + "checkpoint 1: fork returned pid $::decimal\\." > + } > + > + # Must get the PID before we resume the inferior. > + set inf_pid [get_inferior_pid] > + > + # Put the PID in a python variable so that a numerical PID won't > + # appear in the PASS/FAIL output. > + gdb_test_no_output "python inf_pid=$inf_pid" "assign inf_pid" > + > + gdb_test "continue &" > + > + if { $exit_p } { > + set action_line "gdb.execute(\"set variable dont_exit_just_yet=0\")" > + } else { > + set action_line "os.kill(inf_pid, signal.SIGKILL)" > + } > + > + gdb_test_multiline "Create worker function" \ > + "python" "" \ > + "import time" "" \ > + "import os" "" \ > + "import signal" "" \ > + "def kill_and_detach():" "" \ > + " $action_line" "" \ > + " time.sleep(1)" "" \ > + " gdb.execute(\"detach\")" "" \ > + "end" "" > + > + if { $checkpoint_p } { > + # NOTE: The 'checkpoint' system in GDB appears to be a little > + # iffy. This detach does seem to restore the checkpoint, but > + # it leaves the inferior stuck in a running state. > + gdb_test_no_output "python kill_and_detach()" > + } else { > + gdb_test "python kill_and_detach()" \ > + "\\\[Inferior $::decimal \[^\r\n\]+ detached\\\]" > + } > +} > + > +if { $has_checkpoint } { > + set checkpoint_iters { true false } > +} else { > + set checkpoint_iters { false } > +} > + > +foreach_with_prefix exit_p { true false } { > + foreach_with_prefix checkpoint_p $checkpoint_iters { > + run_test $exit_p $checkpoint_p > + } > +} > -- > 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-14 5:48 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-11 22:26 [PATCH 0/2] Fix detach bug when lwp has exited/terminated Kevin Buettner 2023-11-11 22:26 ` [PATCH 1/2] linux-nat.c, linux-fork.c: " Kevin Buettner 2023-11-13 10:58 ` Andrew Burgess 2023-11-14 1:36 ` Kevin Buettner 2023-11-14 5:48 ` Kevin Buettner 2023-11-11 22:26 ` [PATCH 2/2] New test: gdb.base/process-dies-while-detaching.exp Kevin Buettner 2023-11-13 11:04 ` Andrew Burgess
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).