Debugging with GDB (September 2007)

36 Debugging with GDB
When debugging C++ programs, rbreak is useful for setting breakpoints on
overloaded functions that are not members of any spe cial classe s.
info breakpoints [n]
info break [n]
info watchpoints [n]
Print a table of all breakpoints, watchp oints, and catchpoints set and not
deleted, with the following columns for each breakpoint:
Breakpoint Numbers
Type Breakpoint, watchp oint, or catchpoint.
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 fol-
lowing the affected breakpoint; breakpoint commands, if any, are listed after
that.
info break with a breakpoint number n as argument lists only that break-
point. The convenience variable $_ and the default examining-address for the
x command are set to the address of the last breakpoint listed (see Section 8.5
[Examining memory], page 67).
info break displays a count of the number of times the breakpoint has been
hit. This is especially 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 (see Section 5.1.5 [Break conditions], page 40).
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, s tarting with -1; info breakpoints does not display them.
You can see these breakpoints with the GDB maintenance command maint info
breakpoints’.
maint info breakpoints
Using the same format as info breakpoints’, display both the breakpoints
you’ve set explicitly, and those GDB is using for internal purposes. Internal
breakpoints are shown with negative breakpoint numbers. The type column
identifies what kind of breakpoint is shown: