2006-07-31 Frederic Riss * gdb.texinfo (Stopping and starting multi-thread programs): Mention the $_gdb_thread convenience variable. Index: gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.345 diff -u -p -r1.345 gdb.texinfo --- gdb.texinfo 21 Jul 2006 14:46:55 -0000 1.345 +++ gdb.texinfo 31 Jul 2006 19:22:50 -0000 @@ -4208,8 +4208,10 @@ breakpoints on all threads, or on a part @cindex breakpoints and threads @cindex thread breakpoints @kindex break @dots{} thread @var{threadno} +@vindex $_gdb_thread@r{, convenience variable} @item break @var{linespec} thread @var{threadno} @itemx break @var{linespec} thread @var{threadno} if @dots{} +@itemx break @var{linespec} if $_gdb_thread == @var{threadno} @r{[} && @dots@r{]} @var{linespec} specifies source lines; there are several ways of writing them, but the effect is always to specify some source line. @@ -4231,6 +4233,15 @@ breakpoint condition, like this: (@value{GDBP}) break frik.c:13 thread 28 if bartab > lim @end smallexample +Alternatively, you can use the @samp{$_gdb_thread} convenience variable in +the breakpoint's condition. The @samp{$_gdb_thread} variable is set by +@value{GDBN} to the thread identifier of the stopped thread. This can be used +for example to make a breakpoint trigger in multiple threads, like this: + +@smallexample +(@value{GDBP}) break frik.c:13 if $_gdb_thread == 8 ||  $_gdb_thread == 9 +@end smallexample + @end table @cindex stopped threads