In non-stop mode, when a thread stops to report a debugging event, only that thread is stopped; gdb does not stop other threads as well, in contrast to the all-stop mode behavior. Additionally, execution commands such as continue and step apply by default only to the current thread in non-stop mode, rather than all threads as in all-stop mode. This allows you to control threads explicitly in ways that are not possible in all-stop mode — for example, stepping one thread while allowing others to run freely, stepping one thread while holding all others stopped, or stepping several threads independently and simultaneously.

To enter non-stop mode, use this sequence of commands before you run or attach to your program:

     # Enable the async interface.
     set target-async 1
     # If using the CLI, pagination breaks non-stop.
     set pagination off
     # Finally, turn it on!
     set non-stop on

You can use these commands to manipulate the non-stop mode setting:

set non-stop on
Enable selection of non-stop mode. 
set non-stop off
Disable selection of non-stop mode. 
show non-stop
Show the current non-stop enablement setting.

Note these commands only reflect whether non-stop mode is enabled, not whether the currently-executing program is being run in non-stop mode. In particular, the set non-stop preference is only consulted when gdb starts or connects to the target program, and it is generally not possible to switch modes once debugging has started. Furthermore, since not all targets support non-stop mode, even when you have enabled non-stop mode, gdb may still fall back to all-stop operation by default.

In non-stop mode, all execution commands apply only to the current thread by default. That is, continue only continues one thread. To continue all threads, issue continue -a or c -a.

You can use gdb's background execution commands (see Background Execution) to run some threads in the background while you continue to examine or step others from gdb. The MI execution commands (see GDB/MI Program Execution) are always executed asynchronously in non-stop mode.

Suspending execution is done with the interrupt command when running in the background, or Ctrl-c during foreground execution. In all-stop mode, this stops the whole process; but in non-stop mode the interrupt applies only to the current thread. To stop the whole program, use interrupt -a.

Other execution commands do not currently support the -a option.

In non-stop mode, when a thread stops, gdb doesn't automatically make that thread current, as it does in all-stop mode. This is because the thread stop notifications are asynchronous with respect to gdb's command interpreter, and it would be confusing if gdbunexpectedly changed to a different thread just as you entered a command to operate on the previously current thread.

' > 개발' 카테고리의 다른 글

VIM - 여러 파일 편집  (0) 2013.04.08
Eclipse에서 다른 유저의 프로세스 debug  (0) 2013.04.05
GDB에서 특정 쓰레드만 멈추게 하는 법  (0) 2013.03.27
vi 설정  (0) 2013.02.22
Difftool  (0) 2012.12.17
No repository found in Eclipse  (0) 2012.11.27
Posted by 라판