| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <!-- Copyright (C) 1988-2015 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being "Free Software" and "Free Software Needs |
| Free Documentation", with the Front-Cover Texts being "A GNU Manual," |
| and with the Back-Cover Texts as in (a) below. |
| |
| (a) The FSF's Back-Cover Text is: "You are free to copy and modify |
| this GNU Manual. Buying copies from GNU Press supports the FSF in |
| developing GNU and promoting software freedom." --> |
| <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> |
| <head> |
| <title>Debugging with GDB: Skipping Over Functions and Files</title> |
| |
| <meta name="description" content="Debugging with GDB: Skipping Over Functions and Files"> |
| <meta name="keywords" content="Debugging with GDB: Skipping Over Functions and Files"> |
| <meta name="resource-type" content="document"> |
| <meta name="distribution" content="global"> |
| <meta name="Generator" content="makeinfo"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <link href="index.html#Top" rel="start" title="Top"> |
| <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> |
| <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| <link href="Stopping.html#Stopping" rel="up" title="Stopping"> |
| <link href="Signals.html#Signals" rel="next" title="Signals"> |
| <link href="Continuing-and-Stepping.html#Continuing-and-Stepping" rel="prev" title="Continuing and Stepping"> |
| <style type="text/css"> |
| <!-- |
| a.summary-letter {text-decoration: none} |
| blockquote.smallquotation {font-size: smaller} |
| div.display {margin-left: 3.2em} |
| div.example {margin-left: 3.2em} |
| div.indentedblock {margin-left: 3.2em} |
| div.lisp {margin-left: 3.2em} |
| div.smalldisplay {margin-left: 3.2em} |
| div.smallexample {margin-left: 3.2em} |
| div.smallindentedblock {margin-left: 3.2em; font-size: smaller} |
| div.smalllisp {margin-left: 3.2em} |
| kbd {font-style:oblique} |
| pre.display {font-family: inherit} |
| pre.format {font-family: inherit} |
| pre.menu-comment {font-family: serif} |
| pre.menu-preformatted {font-family: serif} |
| pre.smalldisplay {font-family: inherit; font-size: smaller} |
| pre.smallexample {font-size: smaller} |
| pre.smallformat {font-family: inherit; font-size: smaller} |
| pre.smalllisp {font-size: smaller} |
| span.nocodebreak {white-space:nowrap} |
| span.nolinebreak {white-space:nowrap} |
| span.roman {font-family:serif; font-weight:normal} |
| span.sansserif {font-family:sans-serif; font-weight:normal} |
| ul.no-bullet {list-style: none} |
| --> |
| </style> |
| |
| |
| </head> |
| |
| <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| <a name="Skipping-Over-Functions-and-Files"></a> |
| <div class="header"> |
| <p> |
| Next: <a href="Signals.html#Signals" accesskey="n" rel="next">Signals</a>, Previous: <a href="Continuing-and-Stepping.html#Continuing-and-Stepping" accesskey="p" rel="prev">Continuing and Stepping</a>, Up: <a href="Stopping.html#Stopping" accesskey="u" rel="up">Stopping</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> |
| </div> |
| <hr> |
| <a name="Skipping-Over-Functions-and-Files-1"></a> |
| <h3 class="section">5.3 Skipping Over Functions and Files</h3> |
| <a name="index-skipping-over-functions-and-files"></a> |
| |
| <p>The program you are debugging may contain some functions which are |
| uninteresting to debug. The <code>skip</code> comand lets you tell <small>GDB</small> to |
| skip a function or all functions in a file when stepping. |
| </p> |
| <p>For example, consider the following C function: |
| </p> |
| <div class="smallexample"> |
| <pre class="smallexample">101 int func() |
| 102 { |
| 103 foo(boring()); |
| 104 bar(boring()); |
| 105 } |
| </pre></div> |
| |
| <p>Suppose you wish to step into the functions <code>foo</code> and <code>bar</code>, but you |
| are not interested in stepping through <code>boring</code>. If you run <code>step</code> |
| at line 103, you’ll enter <code>boring()</code>, but if you run <code>next</code>, you’ll |
| step over both <code>foo</code> and <code>boring</code>! |
| </p> |
| <p>One solution is to <code>step</code> into <code>boring</code> and use the <code>finish</code> |
| command to immediately exit it. But this can become tedious if <code>boring</code> |
| is called from many places. |
| </p> |
| <p>A more flexible solution is to execute <kbd>skip boring</kbd>. This instructs |
| <small>GDB</small> never to step into <code>boring</code>. Now when you execute |
| <code>step</code> at line 103, you’ll step over <code>boring</code> and directly into |
| <code>foo</code>. |
| </p> |
| <p>You can also instruct <small>GDB</small> to skip all functions in a file, with, for |
| example, <code>skip file boring.c</code>. |
| </p> |
| <dl compact="compact"> |
| <dd><a name="index-skip-function"></a> |
| </dd> |
| <dt><code>skip <span class="roman">[</span><var>linespec</var><span class="roman">]</span></code></dt> |
| <dt><code>skip function <span class="roman">[</span><var>linespec</var><span class="roman">]</span></code></dt> |
| <dd><p>After running this command, the function named by <var>linespec</var> or the |
| function containing the line named by <var>linespec</var> will be skipped over when |
| stepping. See <a href="Specify-Location.html#Specify-Location">Specify Location</a>. |
| </p> |
| <p>If you do not specify <var>linespec</var>, the function you’re currently debugging |
| will be skipped. |
| </p> |
| <p>(If you have a function called <code>file</code> that you want to skip, use |
| <kbd>skip function file</kbd>.) |
| </p> |
| <a name="index-skip-file"></a> |
| </dd> |
| <dt><code>skip file <span class="roman">[</span><var>filename</var><span class="roman">]</span></code></dt> |
| <dd><p>After running this command, any function whose source lives in <var>filename</var> |
| will be skipped over when stepping. |
| </p> |
| <p>If you do not specify <var>filename</var>, functions whose source lives in the file |
| you’re currently debugging will be skipped. |
| </p></dd> |
| </dl> |
| |
| <p>Skips can be listed, deleted, disabled, and enabled, much like breakpoints. |
| These are the commands for managing your list of skips: |
| </p> |
| <dl compact="compact"> |
| <dd><a name="index-info-skip"></a> |
| </dd> |
| <dt><code>info skip <span class="roman">[</span><var>range</var><span class="roman">]</span></code></dt> |
| <dd><p>Print details about the specified skip(s). If <var>range</var> is not specified, |
| print a table with details about all functions and files marked for skipping. |
| <code>info skip</code> prints the following information about each skip: |
| </p> |
| <dl compact="compact"> |
| <dt><em>Identifier</em></dt> |
| <dd><p>A number identifying this skip. |
| </p></dd> |
| <dt><em>Type</em></dt> |
| <dd><p>The type of this skip, either ‘<samp>function</samp>’ or ‘<samp>file</samp>’. |
| </p></dd> |
| <dt><em>Enabled or Disabled</em></dt> |
| <dd><p>Enabled skips are marked with ‘<samp>y</samp>’. Disabled skips are marked with ‘<samp>n</samp>’. |
| </p></dd> |
| <dt><em>Address</em></dt> |
| <dd><p>For function skips, this column indicates the address in memory of the function |
| being skipped. If you’ve set a function skip on a function which has not yet |
| been loaded, this field will contain ‘<samp><PENDING></samp>’. Once a shared library |
| which has the function is loaded, <code>info skip</code> will show the function’s |
| address here. |
| </p></dd> |
| <dt><em>What</em></dt> |
| <dd><p>For file skips, this field contains the filename being skipped. For functions |
| skips, this field contains the function name and its line number in the file |
| where it is defined. |
| </p></dd> |
| </dl> |
| |
| <a name="index-skip-delete"></a> |
| </dd> |
| <dt><code>skip delete <span class="roman">[</span><var>range</var><span class="roman">]</span></code></dt> |
| <dd><p>Delete the specified skip(s). If <var>range</var> is not specified, delete all |
| skips. |
| </p> |
| <a name="index-skip-enable"></a> |
| </dd> |
| <dt><code>skip enable <span class="roman">[</span><var>range</var><span class="roman">]</span></code></dt> |
| <dd><p>Enable the specified skip(s). If <var>range</var> is not specified, enable all |
| skips. |
| </p> |
| <a name="index-skip-disable"></a> |
| </dd> |
| <dt><code>skip disable <span class="roman">[</span><var>range</var><span class="roman">]</span></code></dt> |
| <dd><p>Disable the specified skip(s). If <var>range</var> is not specified, disable all |
| skips. |
| </p> |
| </dd> |
| </dl> |
| |
| <hr> |
| <div class="header"> |
| <p> |
| Next: <a href="Signals.html#Signals" accesskey="n" rel="next">Signals</a>, Previous: <a href="Continuing-and-Stepping.html#Continuing-and-Stepping" accesskey="p" rel="prev">Continuing and Stepping</a>, Up: <a href="Stopping.html#Stopping" accesskey="u" rel="up">Stopping</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> |
| </div> |
| |
| |
| |
| </body> |
| </html> |