
Chapter 7. Stopping and Continuing
41
unload
unload
libname
The unloading of any dynamically loaded shared library, or the unloading of the library
libname
. This is currently only available for HP-UX.
tcatch
event
Set a catchpoint that is enabled only for one stop. The catchpoint is automatically deleted after
the first time the event is caught.
Use the
info break
command to list the current catchpoints.
There are currently some limitations to C
++
exception handling (
catch throw
and
catch catch
)
in gdb:
•
If you call a function interactively, gdb normally returns control to you when the function has
finished executing. If the call raises an exception, however, the call may bypass the mechanism that
returns control to you and cause your program either to abort or to simply continue running until it
hits a breakpoint, catches a signal that gdb is listening for, or exits. This is the case even if you set
a catchpoint for the exception; catchpoints on exceptions are disabled within interactive calls.
•
You cannot raise an exception interactively.
•
You cannot install an exception handler interactively.
Sometimes
catch
is not the best way to debug exception handling: if you need to know exactly where
an exception is raised, it is better to stop
before
the exception handler is called, since that way you
can see the stack before any unwinding takes place. If you set a breakpoint in an exception handler
instead, it may not be easy to find out where the exception was raised.
To stop just before an exception handler is called, you need some knowledge of the implementation. In
the case of gnu C
++
, exceptions are raised by calling a library function named
__raise_exception
which has the following ANSI C interface:
/*
addr
is where the exception identifier is stored.
id
is the exception identifier.
*/
void __raise_exception (void **addr, void *id);
To make the debugger catch all exceptions before any stack unwinding takes place, set a breakpoint
on
__raise_exception
(refer to Section 7.1
Breakpoints, watchpoints, and catchpoints
).
With a conditional breakpoint (refer to Section 7.1.6
Break conditions
) that depends on the value of
id
, you can stop your program when a specific exception is raised. You can use multiple conditional
breakpoints to stop your program when any of a number of exceptions are raised.
7.1.4. Deleting breakpoints
It is often necessary to eliminate a breakpoint, watchpoint, or catchpoint once it has done its job and
you no longer want your program to stop there. This is called
deleting
the breakpoint. A breakpoint
that has been deleted no longer exists; it is forgotten.
With the
clear
command you can delete breakpoints according to where they are in your program.
With the
delete
command you can delete individual breakpoints, watchpoints, or catchpoints by
specifying their breakpoint numbers.
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: ......