gdb调试多线程

gdb调试多线程程序

# 查看进程book
ps aux |grep book

# 查看线程 book
 ps -aL| grep book

 

在gdb中执行 


  

# 查看线程数
info threads

# 切换线程
thread thread_id

# 只运行当前线程,其他线程挂起
set scheduler-locking on

# 运行全部的线程
set scheduler-locking off

# 指定某线程执行某gdb命令
thread apply thread_id cmd
# 例如
thread apply 3 c
thread apply 3 n

# 全部的线程执行某gdb命令
thread apply all cmd

  

posted @ 2024-03-14 22:19  FigureOut  阅读(33)  评论(0)    收藏  举报