use break conditions
(gdb) break frik.c:13 thread 28 if bartab > lim Edit:
(gdb) break <thread_function_entry_point> thread 2 (gdb) break <thread_function_entry_point> thread 1 (gdb) thread 1 (gdb) continue (gdb) ... thread 1 finishes (gdb) thread 2 (gdb) continue You can put these commands inside a .gdbrc file.