From: Paul Smith <paul@mad-scientist.net>
To: Pedro Alves <palves@redhat.com>, Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb@sourceware.org
Subject: Re: GDB (not) handling SIGINT...?
Date: Mon, 19 Nov 2018 19:07:00 -0000 [thread overview]
Message-ID: <0aa97651789ea8cc5917b73435ab61db5670934a.camel@mad-scientist.net> (raw)
In-Reply-To: <276f4526-1873-0072-206c-c45bb47be3f6@redhat.com>
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 ...
next prev parent reply other threads:[~2018-11-19 19:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 22:37 Paul Smith
2018-11-14 22:32 ` Simon Marchi
2018-11-15 13:55 ` Pedro Alves
2018-11-15 16:01 ` Paul Smith
2018-11-15 16:24 ` Pedro Alves
2018-11-15 18:01 ` Paul Smith
2018-11-15 18:04 ` Pedro Alves
2018-11-15 18:27 ` Paul Smith
2018-11-19 19:07 ` Paul Smith [this message]
2018-11-19 19:44 ` Paul Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0aa97651789ea8cc5917b73435ab61db5670934a.camel@mad-scientist.net \
--to=paul@mad-scientist.net \
--cc=gdb@sourceware.org \
--cc=palves@redhat.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox