https://sourceware.org/gdb/onlinedocs/gdb/Threads.html
命令
automatic notification of new threads
-
‘thread thread-id’, a command to switch among threads
-
‘info threads’,a command to inquire about existing threads
-
‘thread apply [thread-id-list | all] args’, a command to apply a
command to a list of threads
thread-specific breakpoints -
‘set print thread-events’, which controls printing of messages on
thread start and exit.
‘set libthread-db-search-path path’, which lets the user specify which libthread_db to use if the default choice isn’t compatible with the program.
自动通知新线程 -
'thread 线程ID ’ 线程间切换,切换到指定ID的线程 的命令
-
’info threads‘ 显示所以存在的线程的命令
-
‘thread apply [thread-id-list | all] args’,对一系列线程使用指令(args)的命令
线程特定的断点- ‘set print thread-events’, 在线程开始和退出时,控制打印信息
- ‘set libthread-db-search-path path’,在默认选项不兼容的时候 , 用户指定使用哪个libthread_db
程序运行时,GDB可以观察所有线程。 启动GDB后,有一个当前线程,调试命令从当前线程角度显示程序信息。
每当 GDB 在程序中检测到新线程时,它都会显示目标系统对该线程的标识ID, 形式因特定系统而异。例如,在 GNU/Linux 上,您可能会看到[New systag]systag
[New Thread 0x41e02940 (LWP 25582)]