Re: GDB (not) handling SIGINT...?
Paul Smith <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2018-11-15 at 16:24 +0000, Pedro Alves wrote: > If you're OK with hacking GDB, s/SIGINT/SIGSTOP/g in child_pass_ctrlc > should work reasonably OK, even though not perfect. I got around to trying this and it did work... except for one thing: when I wanted to continue I had to continue once for each thread in my program :-/. Actually it stopped thread 1 twice, once at first then again... This is GDB 8.2 on x86_64 GNU/Linux (Linux 4.15, GNU libc 2.27) Somewhat confusing. $ gdb -p 7351 ... Attaching to process 7351 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) c Continuing. ^C Thread 1 "foo" received signal SIGSTOP, Stopped (signal). 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) c Continuing. Thread 11 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a91fe700 (LWP 7369)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 6 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17acfff700 (LWP 7361)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 3 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17af7ff700 (LWP 7356)] 0x00007f17b0be9bb7 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) Continuing. Thread 9 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17aa5ff700 (LWP 7367)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 4 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ae7ff700 (LWP 7357)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 7 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ac7fe700 (LWP 7362)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 1 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17b3ccb8c0 (LWP 7351)] 0x00007f17b0b0826c in sigtimedwait () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) Continuing. Thread 12 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a3fff700 (LWP 7370)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 2 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17b03ed700 (LWP 7355)] 0x00007f17b0ec6f85 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 10 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17a99ff700 (LWP 7368)] 0x00007f17b0eca82e in recv () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 8 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17ab3ff700 (LWP 7363)] 0x00007f17b0ec69f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. Thread 5 "foo" received signal SIGSTOP, Stopped (signal). [Switching to Thread 0x7f17adbff700 (LWP 7359)] 0x00007f17b0eca82e in recv () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) Continuing. ... finally here the program is really running again ...