简体   繁体   中英

How to halt execution of a single thread when a breakpoint is reached with Eclipse CDT + GDB

I'm debugging a multi-threaded C++ application in Eclipse Oxygen with gdb 7.4 The default behaviour is that when a breakpoint is reached all threads are halted, however, I'd like only the thread that reached the breakpoint to halt and all others would continue to run.

How is possible?

How is possible?

(gdb) set non-stop on 

By default non-stop mode is off. You want it to be on, see gdb builtin help:

(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) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM