Previous: Watch Expressions, Up: GDB Graphical Interface [Contents][Index]
In GDB’s all-stop mode, whenever your program stops, all execution threads stop. Likewise, whenever you restart the program, all threads start executing. See All-Stop Mode in The GNU debugger. For some multi-threaded targets, GDB supports a further mode of operation, called non-stop mode, in which you can examine stopped program threads in the debugger while other threads continue to execute freely. See Non-Stop Mode in The GNU debugger. Versions of GDB prior to 7.0 do not support non-stop mode, and it does not work on all targets.
The variable gdb-non-stop-setting
determines whether Emacs
runs GDB in all-stop mode or non-stop mode. The default is t
,
which means it tries to use non-stop mode if that is available. If
you change the value to nil
, or if non-stop mode is
unavailable, Emacs runs GDB in all-stop mode. The variable takes
effect when Emacs begins a debugging session; if you change its value,
you should restart any active debugging session.
When a thread stops in non-stop mode, Emacs usually switches to that
thread. If you don’t want Emacs to do this switch if another stopped
thread is already selected, change the variable
gdb-switch-when-another-stopped
to nil
.
Emacs can decide whether or not to switch to the stopped thread
depending on the reason which caused the stop. Customize the variable
gdb-switch-reasons
to select the stop reasons which will cause
a thread switch.
The variable gdb-stopped-functions
allows you to execute your
functions whenever some thread stops.
In non-stop mode, you can switch between different modes for GUD execution control commands.
When gdb-gud-control-all-threads
is t
(the default
value), interruption and continuation commands apply to all threads,
so you can halt or continue all your threads with one command using
gud-stop-subjob
and gud-cont
, respectively. The
‘Go’ button is shown on the tool bar when at least one thread is
stopped, whereas ‘Stop’ button is shown when at least one thread
is running.
When gdb-gud-control-all-threads
is nil
, only the
current thread is stopped/continued. ‘Go’ and ‘Stop’
buttons on the GUD tool bar are shown depending on the state of
current thread.
You can change the current value of gdb-gud-control-all-threads
from the tool bar or from ‘GUD->GDB-MI’ menu.
Stepping commands always apply to the current thread.
In non-stop mode, you can interrupt/continue your threads without selecting them. Hitting i in threads buffer interrupts thread under point, c continues it, s steps through. More such commands may be added in the future.
Note that when you interrupt a thread, it stops with the
‘signal received’ reason. If that reason is included in your
gdb-switch-reasons
(it is by default), Emacs will switch to
that thread.
Previous: Watch Expressions, Up: GDB Graphical Interface [Contents][Index]