beautypg.com

4 stopping and starting multi-thread programs – HP gnu source-level debugger 5992-4701 User Manual

Page 69

background image

pass

GDB should allow your program to see this signal; your program can
handle the signal, or else it may terminate if the signal is fatal and not
handled.

nopass

GDB should not allow your program to see this signal.

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.

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'. See

“Giving your program a signal” (page 121)

.

5.4 Stopping and starting multi-thread programs

When your program has multiple threads (see

“Debugging programs with multiple

threads” (page 46)

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

5.4 Stopping and starting multi-thread programs

69