This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Document backtrace for all threads (was: btacktrace on all threads)
- From: Eli Zaretskii <eliz at gnu dot org>
- To: gdb-patches at sourceware dot org
- Date: Sat, 21 Jan 2006 23:16:01 +0200
- Subject: [commit] Document backtrace for all threads (was: btacktrace on all threads)
- References: <43D28228.10105@fastmail.co.uk> <20060121185028.GA4861@nevyn.them.org>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Sat, 21 Jan 2006 13:50:28 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb@sourceware.org
>
> On Sat, Jan 21, 2006 at 06:49:12PM +0000, Ivan Novick wrote:
> > Hi,
> >
> > Is there an easier way to backtrace all threads in a core file.
>
> "thread apply all backtrace"
I committed the following patch to document this, and also to clarify
the threadno arg to "thread apply":
2006-01-21 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Backtrace): Describe how to get backtrace of all
the threads in a multi-threaded program.
(Threads): The threadno argument of "thread apply" can be a range
of numbers.
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.307
diff -u -r1.307 gdb.texinfo
--- gdb.texinfo 13 Jan 2006 20:11:47 -0000 1.307
+++ gdb.texinfo 21 Jan 2006 21:08:18 -0000
@@ -2424,13 +2424,14 @@
@kindex thread apply
@cindex apply command to several threads
-@item thread apply [@var{threadno}] [@var{all}] @var{args}
-The @code{thread apply} command allows you to apply a command to one or
-more threads. Specify the numbers of the threads that you want affected
-with the command argument @var{threadno}. @var{threadno} is the internal
-@value{GDBN} thread number, as shown in the first field of the @samp{info
-threads} display. To apply a command to all threads, use
-@code{thread apply all} @var{args}.
+@item thread apply [@var{threadno}] [@var{all}] @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}}.
@end table
@cindex automatic thread selection
@@ -4461,6 +4462,15 @@
The names @code{where} and @code{info stack} (abbreviated @code{info s})
are additional aliases for @code{backtrace}.
+@cindex multiple threads, backtrace
+In a multi-threaded program, @value{GDBN} by default shows the
+backtrace only for the current thread. To display the backtrace for
+several or all of the threads, use the command @code{thread apply}
+(@pxref{Threads, thread apply}). For example, if you type @kbd{thread
+apply all backtrace}, @value{GDBN} will display the backtrace for all
+the threads; this is handy when you debug a core dump of a
+multi-threaded program.
+
Each line in the backtrace shows the frame number and the function name.
The program counter value is also shown---unless you use @code{set
print address off}. The backtrace also shows the source file name and