如何在使用Eclipse CDT + GDB达到断点时停止执行单个线程

时间:2017-10-25 11:42:11

标签: multithreading gdb eclipse-cdt

我正在使用gdb 7.4调试Eclipse Oxygen中的多线程C ++应用程序 默认行为是,当达到断点时,所有线程都会停止,但是,我只希望到达断点的线程停止,而其他线程将继续运行。

怎么可能?

1 个答案:

答案 0 :(得分:1)

  

怎么可能?

(gdb) set non-stop on 

默认情况下,不停止模式关闭。你希望它打开,请参阅gdb内置帮助:

(gdb) help set non-stop 
Set whether gdb controls the inferior in non-stop mode.
When debugging a multi-threaded program and this setting is
off (the default, also called all-stop mode), when one thread stops
(for a breakpoint, watchpoint, exception, or similar events), GDB stops
all other threads in the program while you interact with the thread of
interest.  When you continue or step a thread, you can allow the other
threads to run, or have them remain stopped, but while you inspect any
thread's state, all threads stop.

In non-stop mode, when one thread stops, other threads can continue
to run freely.  You'll be able to step each thread independently,
leave it stopped or free to run as needed.
(gdb)