f78
Setting breakpoints
You have several ways to say where the breakpoint should go.
break -offset
This is similar to the effect of a
This rule applies whether or not the breakpoint already existed when your
program stopped.
info break [n]
info watchpoints [n]
Breakpoint Numbers
Disposition
Enabled or Disabled
Address
What
If a breakpoint is conditional,
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
Set a breakpoint at entry to function, function. When using source languages that permit overloading of symbols, such as C++, function may refer to more than one possible place to break. See Breakpoint menus for a discussion of that situation.
Set a breakpoint at line linenum in the current source file. That file is the last file whose source text was
printed. This breakpoint stops your program just before it executes any of the
code on that line.
Set a breakpoint at line, linenum, in source file, filename.
Set a breakpoint at entry to function, function, found in file, filename. Specifying a file name as well as a function name is superfluous except when
multiple files contain similarly named functions.
Set a breakpoint at address, address. You can use this to set breakpoints in parts of your program which do not
have debugging information or source files.
When called without any arguments, break sets a breakpoint at the next instruction to be executed in the selected
stack frame (see Examining the Stack). In any selected frame but the innermost, this makes your program stop as
soon as control returns to that frame.
Set a breakpoint with condition, cond; evaluate the expression, cond, each time the breakpoint is reached, and stop only if the value is
nonzero—that is, if cond, evaluates as true. ‘...’ stands for one of the possible arguments described previously (or no
argument) specifying where to break. See Break conditions for more information on breakpoint conditions.
Set a breakpoint enabled only for one stop. args are the same as for the break command, and the breakpoint is set in the same way, but the breakpoint is
automatically deleted after the first time your program stops there. See Disabling breakpoints.
Set a hardware-assisted breakpoint. args are the same as for the break command and the breakpoint is set in the same way, but the breakpoint
requires hardware support and some target hardware may not have this support. The main
purpose of this is EPROM/ROM code debugging, so you can set a breakpoint at an
instruction without changing the instruction. This can be used with the new
trap-generation provided by SPARClite DSU. DSU will generate traps when a program
accesses some date or instruction address that is assigned to the debug
registers. However the hardware breakpoi
ffb
nt registers can only take two data
breakpoints, and GDB will reject this command if more than two are used. Delete or
disable usused hardware breakpoints before setting new ones. See Break conditions.
Set a hardware-assisted breakpoint enabled only for one stop. args are the
same as for the hbreak command and the breakpoint is set in the same way. However, like the tbreak command, the breakpoint is automatically deleted after the first time your
program stops there. Also, like the hbreak command, the breakpoint requires hardware support and some target hardware
may not have this support. See Disabling breakpoints. Also see Break conditions.
Set breakpoints on all functions matching the regular expression, regex. This command sets an unconditional breakpoint on all matches, printing a
list of all breakpoints it set. Once these breakpoints are set, they are treated
just like the breakpoints set with the break command. You can delete them, disable them, or make them conditional the same
way as any other breakpoint. When debugging C++ programs, rbreak is useful for
setting breakpoints on overloaded functions that are not members of any
special classes.
Type Breakpoint or watchpoint.
Whether the breakpoint is marked to be disabled or deleted when hit.
Enabled breakpoints are marked with ‘
Where the breakpoint is in your program, as a memory address
Where the breakpoint is in the source for your program, as a file and line
number.
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:
Normal, explicitly set breakpoint.
Normal, explicitly set watchpoint.
Internal breakpoint, used to handle correctly stepping through longjmp calls.
Internal breakpoint at the target of a longjmp.
Temporary internal breakpoint used by the GDB until command.
Temporary internal breakpoint used by the GDB finish command.