This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug threads/19422] in non-stop mode, gdb does not print thread which stops
- From: "palves at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 31 Dec 2015 18:49:56 +0000
- Subject: [Bug threads/19422] in non-stop mode, gdb does not print thread which stops
- Auto-submitted: auto-generated
- References: <bug-19422-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19422
--- Comment #3 from Pedro Alves <palves at redhat dot com> ---
I actually gave this a try now. I've pushed the WIP to
https://github.com/palves/gdb/commits/palves/show-which-thread-caused-stop .
Below's how it currently looks.
I initially thought of lowercasing "breakpoint" in "Thread 1 hit Breakpoint 4",
but then realized that leaving it uppercase helps the eye quickly find the
relevant information. It's also easier to implement not showing anything about
threads until the program goes multi-threaded, per the upstream discussion in
2012.
Is this along the lines of what you'd expect?
(gdb) c -a&
Continuing.
(gdb) interrupt -a
(gdb)
Thread 1 "main" stopped.
0x0000003616a09237 in pthread_join (threadid=140737353877248,
thread_return=0x7fffffffd5b8) at pthread_join.c:92
92 lll_wait_tid (pd->tid);
Thread 2 "foo" stopped.
0x0000003615ebc6ed in nanosleep () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
Thread 3 "bar" stopped.
0x0000003615ebc6ed in nanosleep () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
b threads.c:87
Breakpoint 4 at 0x40087a: file threads.c, line 87.
(gdb) b threads.c:67
Breakpoint 5 at 0x400811: file threads.c, line 67.
(gdb) c -a&
Continuing.
(gdb)
Thread 3 "bar" hit Breakpoint 4, thread_function1 (arg=0x1) at threads.c:87
87 usleep (1); /* Loop increment. */
Thread 2 "foo" hit Breakpoint 5, thread_function0 (arg=0x0) at threads.c:68
68 (*myp) ++;
info threads
Id Target Id Frame
* 1 Thread 0x7ffff7fc1740 (LWP 31957) "main" (running)
2 Thread 0x7ffff7fc0700 (LWP 31961) "foo" thread_function0 (arg=0x0) at
threads.c:68
3 Thread 0x7ffff77bf700 (LWP 31962) "bar" thread_function1 (arg=0x1) at
threads.c:87
(gdb) shell kill -SIGINT 31957
(gdb)
Thread 1 "main" received signal SIGINT, Interrupt.
0x0000003616a09237 in pthread_join (threadid=140737353877248,
thread_return=0x7fffffffd5b8) at pthread_join.c:92
92 lll_wait_tid (pd->tid);
info threads
Id Target Id Frame
* 1 Thread 0x7ffff7fc1740 (LWP 31957) "main" 0x0000003616a09237 in
pthread_join (threadid=140737353877248, thread_return=0x7fffffffd5b8) at
pthread_join.c:92
2 Thread 0x7ffff7fc0700 (LWP 31961) "foo" thread_function0 (arg=0x0) at
threads.c:68
3 Thread 0x7ffff77bf700 (LWP 31962) "bar" thread_function1 (arg=0x1) at
threads.c:87
(gdb) t 1.2
[Switching to thread 2, Thread 0x7ffff7fc0700 (LWP 31961) "foo"]
#0 thread_function0 (arg=0x0) at threads.c:68
68 (*myp) ++;
(gdb) catch syscall
Catchpoint 6 (any syscall)
(gdb) c&
Continuing.
(gdb)
Thread 2 "foo" hit Catchpoint 6 (call to syscall nanosleep), 0x0000003615ebc6ed
in nanosleep () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
--
You are receiving this mail because:
You are on the CC list for the bug.