Gdb多線程調試

1.調試方法
# ps aux| grep proname //找出進程的pid
# gdb attach pid //使用gdb attach可以調試正在運行的進程
# info threads //查看具體的線程id
# thread x //切換線程到具體的線程x
# b func
# set scheduler-locking off //讓所有的線程運行.gdb默認調試狀態下只有當前的線程在運行,所以先要讓整個程序運行起來。
# c //讓線程運行,等待程序停在下一個斷點處
# display/x len //顯示16進制
# finsh //結束此函數
# return //return此函數

2。查看本地變量數據實用技巧
# set print pretty on //按格式打印struct結構體時
# set print union //打印struct時按格式打印內部的union
# set print array //按格式打印數組

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章