【问题标题】:not stopping all threads in gdb不停止 gdb 中的所有线程
【发布时间】:2010-09-08 09:31:34
【问题描述】:

如果到达断点(或在 GDB shell 中按下 Ctrl+C),GDB 通常会停止所有线程。我知道存在诸如 scheduler-locking 和 schedule-multiple 之类的命令,但我认为不可能让一个已定义的线程在后台运行而另一个正在调试。

【问题讨论】:

    标签: c gdb pthreads


    【解决方案1】:

    如果您的目标支持,您可以使用set target-async on 启用异步模式。然后,您可以使用命令指定后台执行。例如,

    continue&
    

    可用于运行单个线程,并且

    interrupt [-a]
    

    暂停单个线程或整个程序的执行。

    结合不间断模式,您可以检查单个线程,而其他线程继续在后台运行:

     # If using the CLI, pagination breaks non-stop.
     set pagination off
    
     # Finally, turn it on!
     set non-stop on
     # Before debugging is started!
    

    【讨论】:

    • 完美回答了这个问题。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-31
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多