When your program has multiple threads (see Debugging Programs with Multiple Threads), you can choose whether to set breakpoints on all threads, or on a particular thread.
Use the qualifier ‘thread threadno’ with a breakpoint command to specify that you only want gdb to stop the program when a particular thread reaches this breakpoint. threadno is one of the numeric thread identifiers assigned by gdb, shown in the first column of the ‘info threads’ display.
If you do not specify ‘thread threadno’ when you set a breakpoint, the breakpoint applies to all threads of your program.
You can use the
thread qualifier on conditional breakpoints as
well; in this case, place ‘thread threadno’ before or
after the breakpoint condition, like this:
(gdb) break frik.c:13 thread 28 if bartab > lim