Previous: Interrupted System Calls, Up: Thread Stops
If you want to build on non-stop mode and observe program behavior without any chance of disruption by gdb, you can set variables to disable all of the debugger's attempts to modify state, whether by writing memory, inserting breakpoints, etc. These operate at a low level, intercepting operations from all commands.
When all of these are set to off
, then gdb is said to
be observer mode. As a convenience, the variable
observer
can be set to disable these, plus enable non-stop
mode.
Note that gdb will not prevent you from making nonsensical
combinations of these settings. For instance, if you have enabled
may-insert-breakpoints
but disabled may-write-memory
,
then breakpoints that work by writing trap instructions into the code
stream will still not be able to be placed.
set observer on
set observer off
on
, this disables all the permission variables
below (except for insert-fast-tracepoints
), plus enables
non-stop debugging. Setting this to off
switches back to
normal debugging, though remaining in non-stop mode.
show observer
set may-write-registers on
set may-write-registers off
print
, or the
jump
command. It defaults to on
.
show may-write-registers
set may-write-memory on
set may-write-memory off
print
. It
defaults to on
.
show may-write-memory
set may-insert-breakpoints on
set may-insert-breakpoints off
on
.
show may-insert-breakpoints
set may-insert-tracepoints on
set may-insert-tracepoints off
may-insert-fast-tracepoints
. It defaults to on
.
show may-insert-tracepoints
set may-insert-fast-tracepoints on
set may-insert-fast-tracepoints off
may-insert-tracepoints
. It defaults to on
.
show may-insert-fast-tracepoints
set may-interrupt on
set may-interrupt off
off
, the
interrupt
command will have no effect, nor will
Ctrl-c. It defaults to on
.
show may-interrupt