diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-01-22 21:04:53 +0100 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-01-22 21:04:53 +0100 |
commit | 253828f102691732d014e8f1d62f9b5dc779b39c (patch) | |
tree | 5904d09d392427f47b3089c9b81853b8bb59b5c3 /gdb/doc | |
parent | f0e8c4c5d1bce422ac86090b76c28931b0d240bf (diff) | |
download | gdb-253828f102691732d014e8f1d62f9b5dc779b39c.zip gdb-253828f102691732d014e8f1d62f9b5dc779b39c.tar.gz gdb-253828f102691732d014e8f1d62f9b5dc779b39c.tar.bz2 |
Sort threads for thread apply all
downstream Fedora request:
Please make it easier to find the backtrace of the crashing thread
https://bugzilla.redhat.com/show_bug.cgi?id=1024504
Currently after loading a core file GDB prints:
Core was generated by `./threadcrash1'.
Program terminated with signal SIGSEGV, Segmentation fault.
8 *(volatile int *)0=0;
(gdb) _
there is nowhere seen which of the threads had crashed. In reality GDB always
numbers that thread as #1 and it is the current thread that time. But after
dumping all the info into a file for later analysis it is no longer obvious.
'thread apply all bt' even puts the thread #1 to the _end_ of the output!!!
I find maybe as good enough and with no risk of UI change flamewar to just
sort the threads by their number. Currently they are printed as they happen
in the internal GDB list which has no advantage. Printing thread #1 as the
first one with assumed 'thread apply all bt' (after the core file is loaded)
should make the complaint resolved I guess.
On Thu, 15 Jan 2015 20:29:07 +0100, Doug Evans wrote:
No objection to sorting the list, but if thread #1 is the important one,
then a concern could be it'll have scrolled off the screen (such a
concern has been voiced in another thread in another context),
and if not lost (say it's in an emacs buffer) one would still have
to scroll back to see it.
So one *could* still want #1 to be last.
Do we want an option to choose the sort direction?
gdb/ChangeLog
2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Changes since GDB 7.9): Add 'thread apply all' option
'-ascending'.
* thread.c (tp_array_compar_ascending, tp_array_compar): New.
(thread_apply_all_command): Parse CMD for tp_array_compar_ascending.
Sort tp_array using tp_array_compar.
(_initialize_thread): Extend thread_apply_all_command help.
gdb/doc/ChangeLog
2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Threads): Describe -ascending for thread apply all.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4d2470a..a5d8329 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-01-22 Jan Kratochvil <jan.kratochvil@redhat.com> + + * gdb.texinfo (Threads): Describe -ascending for thread apply all. + 2015-01-16 Eli Zaretskii <eliz@gnu.org> * doc/gdb.texinfo (TUI Commands): Document the possible diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f413e23..277df25 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2959,14 +2959,17 @@ information on convenience variables. @kindex thread apply @cindex apply command to several threads -@item thread apply [@var{threadno} | all] @var{command} +@item thread apply [@var{threadno} | all [-ascending]] @var{command} The @code{thread apply} command allows you to apply the named @var{command} to one or more threads. Specify the numbers of the threads that you want affected with the command argument @var{threadno}. It can be a single thread number, one of the numbers shown in the first field of the @samp{info threads} display; or it -could be a range of thread numbers, as in @code{2-4}. To apply a -command to all threads, type @kbd{thread apply all @var{command}}. +could be a range of thread numbers, as in @code{2-4}. To apply +a command to all threads in descending order, type @kbd{thread apply all +@var{command}}. To apply a command to all threads in ascending order, +type @kbd{thread apply all -ascending @var{command}}. + @kindex thread name @cindex name a thread |