Next: Signals, Previous: Continuing and Stepping, Up: Stopping
The program you are debugging may contain some functions which are
uninteresting to debug. The skip
comand lets you tell gdb to
skip a function or all functions in a file when stepping.
For example, consider the following C function:
101 int func() 102 { 103 foo(boring()); 104 bar(boring()); 105 }
Suppose you wish to step into the functions foo
and bar
, but you
are not interested in stepping through boring
. If you run step
at line 103, you'll enter boring()
, but if you run next
, you'll
step over both foo
and boring
!
One solution is to step
into boring
and use the finish
command to immediately exit it. But this can become tedious if boring
is called from many places.
A more flexible solution is to execute skip boring. This instructs
gdb never to step into boring
. Now when you execute
step
at line 103, you'll step over boring
and directly into
foo
.
You can also instruct gdb to skip all functions in a file, with, for
example, skip file boring.c
.
skip
[linespec]skip function
[linespec]If you do not specify linespec, the function you're currently debugging will be skipped.
(If you have a function called file
that you want to skip, use
skip function file.)
skip file
[filename]If you do not specify filename, functions whose source lives in the file you're currently debugging will be skipped.
Skips can be listed, deleted, disabled, and enabled, much like breakpoints. These are the commands for managing your list of skips:
info skip
[range]info skip
prints the following information about each skip:
info skip
will show the function's
address here.
skip delete
[range]skip enable
[range]skip disable
[range]