Chapter 7. Stopping and Continuing
51
nopass
ignore
{No value for ‘
listitem>GDBN’} should not allow your program to see this signal.
nopass
and
ignore
are synonyms.
When a signal stops your program, the signal is not visible to the program until you continue. Your
program sees the signal then, if
pass
is in effect for the signal in question
at that time
. In other words,
after gdb reports a signal, you can use the
handle
command with
pass
or
nopass
to control whether
your program sees that signal when you continue.
The default is set to
nostop
,
noprint
,
pass
for non-erroneous signals such as
SIGALRM
,
SIGWINCH
and
SIGCHLD
, and to
stop
,
,
pass
for the erroneous signals.
You can also use the
signal
command to prevent your program from seeing a signal, or cause it
to see a signal it normally would not see, or to give it any signal at any time. For example, if your
program stopped due to some sort of memory reference error, you might store correct values into the
erroneous variables and continue, hoping to see more execution; but your program would probably
terminate immediately as a result of the fatal signal once it saw the signal. To prevent this, you can
continue with
signal 0
. Refer to Section 16.3
Giving your program a signal
.
7.4. Stopping and starting multi-thread programs
When your program has multiple threads (refer to Section 6.9
Debugging programs with multiple
threads
), you can choose whether to set breakpoints on all threads, or on a particular thread.
break
linespec
thread
threadno
break
linespec
thread
threadno
if ...
linespec
specifies source lines; there are several ways of writing them, but the effect is always
to specify some source line.
Use the qualifier
thread
threadno
with a breakpoint command to specify that you only want
gdb to stop the program when a particular thread reaches this breakpoint.
threadno
is one of
the numeric thread identifiers assigned by gdb, shown in the first column of the
info threads
display.
If you do not specify
thread
threadno
when you set a breakpoint, the breakpoint applies to
all
threads of your program.
You can use the
thread
qualifier on conditional breakpoints as well; in this case, place
thread
threadno
before the breakpoint condition, like this:
(gdb) break frik.c:13 thread 28 if bartab
lim
Whenever your program stops under gdb for any reason,
all
threads of execution stop, not just the cur-
rent thread. This allows you to examine the overall state of the program, including switching between
threads, without worrying that things may change underfoot.
Conversely, whenever you restart the program,
all
threads start executing.
This is true even when
single-stepping
with commands like
step
or
next
.
In particular, gdb cannot single-step all threads in lockstep. Since thread scheduling is up to your
debugging target’s operating system (not controlled by gdb), other threads may execute more than
one statement while the current thread completes a single step. Moreover, in general other threads
stop in the middle of a statement, rather than at a clean statement boundary, when the program stops.
You might even find your program stopped in another thread after continuing or even single-stepping.
This happens whenever some other thread runs into a breakpoint, a signal, or an exception before the
first thread completes whatever you requested.
On some OSes, you can lock the OS scheduler and thus allow only a single thread to run.
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......