not stopping all threads in gdb

醉酒当歌 提交于 2020-01-01 05:41:09

问题


GDB normally stops all threads if a breakpoint is reached (or Ctrl+C is pressed in the GDB shell). I'm aware that commands like scheduler-locking and schedule-multiple exists, but I see no possibility to let a defined thread run in the background while another is debugged.


回答1:


You can use set target-async on to enable asynchronous mode, if your target supports it. Then, you can specify background execution with commands. For example,

continue&

can be used to run a single thread, and

interrupt [-a]

to suspend execution of a single thread, or the whole program.

In conjunction with non-stop mode, you can examine a single thread while others continue to run in the background:

 # If using the CLI, pagination breaks non-stop.
 set pagination off

 # Finally, turn it on!
 set non-stop on
 # Before debugging is started!


来源:https://stackoverflow.com/questions/3666331/not-stopping-all-threads-in-gdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!