如何在 Eclipse CDT + GDB 到达断点时停止执行单个线程
How to halt execution of a single thread when a breakpoint is reached with Eclipse CDT + GDB
我正在使用 gdb 7.4 在 Eclipse Oxygen 中调试多线程 C++ 应用程序
默认行为是当到达断点时所有线程都停止,但是,我希望只有到达断点的线程停止,所有其他线程将继续 运行.
怎么可能?
How is possible?
(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)
我正在使用 gdb 7.4 在 Eclipse Oxygen 中调试多线程 C++ 应用程序 默认行为是当到达断点时所有线程都停止,但是,我希望只有到达断点的线程停止,所有其他线程将继续 运行.
怎么可能?
How is possible?
(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)