5.1.1 Setting breakpoints
Breakpoints are set with the break command (abbreviated b). The debugger
convenience variable '$bpnum' records the number of the breakpoint you have set most
recently; see “Convenience variables” (page 96), for a discussion of what you can do
with convenience variables.
You have several ways to say where the breakpoint should go.
break function
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” (page 62), for a discussion of that
situation.
break +offset, break
-offset
Set a breakpoint some number of lines forward or
back from the position at which execution stopped
in the currently selected stack frame. (See “Stack
frames” (page 71), for a description of stack
frames.)
break linenum Set a breakpoint at line linenum in the current
source file. The current source file is the last file
whose source text was printed. The breakpoint
will stop your program just before it executes any
of the code on that line.
break filename:linenum Set a breakpoint at line linenum in source file
filename.
break filename:function Set a breakpoint at entry to function function
found in file filename. Specifying a fie name as
well as a function name is superfluous except
when multiple files contain similarly named
functions.
break *address
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.
break When called without any arguments, break sets
a breakpoint at the next instruction to be executed
in the selected stack frame (see Chapter 6
(page 71)). In any selected frame but the
innermost, this makes your program stop as soon
as control returns to that frame. This is similar to
the effect of a finish command in the frame
inside the selected frame―except that finish
52 Stopping and Continuing