From: dje@google.com (Doug Evans)
To: gdb@sourceware.org
Subject: improved thread id reporting
Date: Sat, 04 Apr 2009 19:06:00 -0000 [thread overview]
Message-ID: <20090404184604.8524C1C759C@localhost> (raw)
Hi.
GDB's current reporting of thread ids has (at least) three problems (IMO):
1) Reporting the pthread id (e.g. 0x0xf7e5cbb0) has a very low S/N ratio.
2) When switching to a thread IWBN to also report the thread being switched
from, otherwise one has to scrollback through the session to find it
(assuming that's even possible).
3) When reporting thread ids the only usable number in the gdb session
(gdb's internal thread number) is not included.
To fix (1) I'd like to simply remove the pthread id from the output.
This would be user selectable of course, and for example when using
MI I'd expect that it shouldn't be changed lest the frontend
get confused, but friendly reporting of thread ids in frontends
is the frontend's job anyway.
To fix (2) I propose to change "Switch to Thread ..." to
"Switching to Thread ... from Thread ...".
To fix (3) I propose to include gdb's thread number in
"[New Thread ...]" and "[Switching to Thread ...]" messages.
Actually implementing this may be a challenge
but I think the improvement is usability for the user warrants it.
[E.g. This change shouldn't affect non-threaded targets (e.g. embedded).]
Comments?
Example:
Before:
gdb$ ./gdb.prev -nx testsuite/gdb.threads/interrupted-hand-call
GNU gdb (GDB) 6.8.50.20090404-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) b thread_entry
Breakpoint 1 at 0x8048319: file ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c, line 77.
(gdb) r
Starting program: /usr/local/g3/gnu/sourceware/thread-id/build/obj32/gdb/testsuite/gdb.threads/interrupted-hand-call
[Thread debugging using libthread_db enabled]
[New Thread 0xf7e5cbb0 (LWP 17858)]
[Switching to Thread 0xf7e5cbb0 (LWP 17858)]
Breakpoint 1, thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
77 incr_thread_count ();
(gdb) c
Continuing.
[New Thread 0xf765bbb0 (LWP 17859)]
[Switching to Thread 0xf765bbb0 (LWP 17859)]
Breakpoint 1, thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
77 incr_thread_count ();
(gdb) i thr
[New Thread 0xf6e5abb0 (LWP 17862)]
4 Thread 0xf6e5abb0 (LWP 17862) 0xf7f27748 in clone ()
from /usr/grte/v1/lib/libc.so.6
* 3 Thread 0xf765bbb0 (LWP 17859) thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
2 Thread 0xf7e5cbb0 (LWP 17858) 0xffffe410 in __kernel_vsyscall ()
1 Thread 0xf7e5d6b0 (LWP 17855) 0xf7f27748 in clone ()
from /usr/grte/v1/lib/libc.so.6
(gdb)
After:
[slightly different due to different o/s scheduling of threads, but
you get the idea]
gdb$ ./gdb -nx testsuite/gdb.threads/interrupted-hand-call
GNU gdb (GDB) 6.8.50.20090404-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) b thread_entry
Breakpoint 1 at 0x8048319: file ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c, line 77.
(gdb) r
Starting program: /usr/local/g3/gnu/sourceware/thread-id/build/obj32/gdb/testsuite/gdb.threads/interrupted-hand-call
[Thread debugging using libthread_db enabled]
[New Thread #2, LWP 17626]
[New Thread #3, LWP 17627]
[Switching to Thread #2, LWP 17626 from Thread #1, LWP 17626]
Breakpoint 1, thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
77 incr_thread_count ();
(gdb) c
Continuing.
[Switching to Thread #3, LWP 17627 from Thread #2, LWP 17627]
Breakpoint 1, thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
77 incr_thread_count ();
(gdb) i thr
[New Thread #4, LWP 17628]
4 LWP 17628 0xffffe410 in __kernel_vsyscall ()
* 3 LWP 17627 thread_entry (unused=0x0)
at ../../../../src/gdb/testsuite/gdb.threads/interrupted-hand-call.c:77
2 LWP 17626 0xffffe410 in __kernel_vsyscall ()
1 LWP 17623 0xf7fb9730 in __nptl_create_event ()
from /usr/grte/v1/lib/libpthread.so.0
(gdb)
next reply other threads:[~2009-04-04 18:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-04 19:06 Doug Evans [this message]
2009-04-04 19:07 ` Mark Kettenis
2009-04-04 20:40 ` Daniel Jacobowitz
2009-04-04 21:21 ` Eli Zaretskii
2009-04-04 22:17 ` Daniel Jacobowitz
2009-04-05 1:11 ` Doug Evans
2009-04-05 3:42 ` Eli Zaretskii
2009-04-05 3:48 ` Daniel Jacobowitz
2009-04-05 7:19 ` Paul Pluzhnikov
2009-04-05 18:50 ` Eli Zaretskii
2009-04-05 20:11 ` Paul Pluzhnikov
2009-04-05 20:36 ` Eli Zaretskii
2009-04-04 22:35 ` Doug Evans
2009-04-06 2:58 ` Doug Evans
2009-04-06 3:33 ` Eli Zaretskii
2009-04-06 15:36 ` Mark Kettenis
2009-04-06 20:21 ` Eli Zaretskii
2009-04-06 7:39 ` Daniel Jacobowitz
2009-04-06 21:21 ` Eli Zaretskii
2009-05-08 5:43 ` Doug Evans
2009-04-06 20:20 ` Tom Tromey
2009-04-06 20:20 ` Eli Zaretskii
2009-04-06 22:15 ` Tom Tromey
2009-04-07 15:18 ` Doug Evans
2009-04-04 22:24 ` Doug Evans
2009-04-05 3:13 ` Daniel Jacobowitz
2009-04-05 9:16 ` Mark Kettenis
2009-04-05 18:23 ` Eli Zaretskii
2009-04-05 19:22 ` Doug Evans
2009-04-04 19:20 ` Thiago Jung Bauermann
2009-04-04 19:21 ` Eli Zaretskii
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=20090404184604.8524C1C759C@localhost \
--to=dje@google.com \
--cc=gdb@sourceware.org \
/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