38
Chapter 7. Stopping and Continuing
Disposition
Whether the breakpoint is marked to be disabled or deleted when hit.
Enabled or Disabled
Enabled breakpoints are marked with
y
.
n
marks breakpoints that are not enabled.
Address
Where the breakpoint is in your program, as a memory address.
What
Where the breakpoint is in the source for your program, as a file and line number.
If a breakpoint is conditional,
info break
shows the condition on the line following the affected
breakpoint; breakpoint commands, if any, are listed after that.
info break
with a breakpoint number
n
as argument lists only that breakpoint. The conve-
nience variable
$_
and the default examining-address for the
x
command are set to the address
of the last breakpoint listed (refer to Section 10.5
Examining memory
).
info break
displays a count of the number of times the breakpoint has been hit. This is es-
pecially useful in conjunction with the
ignore
command. You can ignore a large number of
breakpoint hits, look at the breakpoint info to see how many times the breakpoint was hit, and
then run again, ignoring one less than that number. This will get you quickly to the last hit of that
breakpoint.
gdb allows you to set any number of breakpoints at the same place in your program. There is nothing
silly or meaningless about this. When the breakpoints are conditional, this is even useful (refer to
Section 7.1.6
Break conditions
).
gdb itself sometimes sets breakpoints in your program for special purposes, such as proper handling of
longjmp
(in C programs). These internal breakpoints are assigned negative numbers, starting with
-1
;
info breakpoints
does not display them. You can see these breakpoints with the gdb maintenance
command
maint info breakpoints
(refer to Appendix C
Maintenance Commands
).
7.1.2. Setting watchpoints
You can use a watchpoint to stop execution whenever the value of an expression changes, without
having to predict a particular place where this may happen.
Depending on your system, watchpoints may be implemented in software or hardware. gdb does
software watchpointing by single-stepping your program and testing the variable’s value each time,
which is hundreds of times slower than normal execution. (But this may still be worth it, to catch
errors where you have no clue what part of your program is the culprit.)
On some systems, such as HP-UX, gnu/Linux and some other x86-based targets, gdb includes support
for hardware watchpoints, which do not slow down the running of your program.
watch
expr
Set a watchpoint for an expression. gdb will break when
expr
is written into by the program and
its value changes.
rwatch
expr
Set a watchpoint that will break when watch
expr
is read by the program.
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: ......