summaryrefslogtreecommitdiff
path: root/share/doc/gdb/Inline-Functions.html
diff options
context:
space:
mode:
Diffstat (limited to 'share/doc/gdb/Inline-Functions.html')
-rw-r--r--share/doc/gdb/Inline-Functions.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/share/doc/gdb/Inline-Functions.html b/share/doc/gdb/Inline-Functions.html
new file mode 100644
index 0000000..fc0eb29
--- /dev/null
+++ b/share/doc/gdb/Inline-Functions.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Copyright (C) 1988-2023 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.1, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Debugging with GDB: Inline Functions</title>
+
+<meta name="description" content="Debugging with GDB: Inline Functions">
+<meta name="keywords" content="Debugging with GDB: Inline Functions">
+<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="Optimized-Code.html#Optimized-Code" rel="up" title="Optimized Code">
+<link href="Tail-Call-Frames.html#Tail-Call-Frames" rel="next" title="Tail Call Frames">
+<link href="Optimized-Code.html#Optimized-Code" rel="previous" title="Optimized Code">
+<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="Inline-Functions"></a>
+<div class="header">
+<p>
+Next: <a href="Tail-Call-Frames.html#Tail-Call-Frames" accesskey="n" rel="next">Tail Call Frames</a>, Up: <a href="Optimized-Code.html#Optimized-Code" accesskey="u" rel="up">Optimized Code</a> &nbsp; [<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="Inline-Functions-1"></a>
+<h3 class="section">11.1 Inline Functions</h3>
+<a name="index-inline-functions_002c-debugging"></a>
+
+<p><em>Inlining</em> is an optimization that inserts a copy of the function
+body directly at each call site, instead of jumping to a shared
+routine. <small>GDB</small> displays inlined functions just like
+non-inlined functions. They appear in backtraces. You can view their
+arguments and local variables, step into them with <code>step</code>, skip
+them with <code>next</code>, and escape from them with <code>finish</code>.
+You can check whether a function was inlined by using the
+<code>info frame</code> command.
+</p>
+<p>For <small>GDB</small> to support inlined functions, the compiler must
+record information about inlining in the debug information &mdash;
+<small>GCC</small> using the <small>DWARF 2</small> format does this, and several
+other compilers do also. <small>GDB</small> only supports inlined functions
+when using <small>DWARF 2</small>. Versions of <small>GCC</small> before 4.1
+do not emit two required attributes (&lsquo;<samp>DW_AT_call_file</samp>&rsquo; and
+&lsquo;<samp>DW_AT_call_line</samp>&rsquo;); <small>GDB</small> does not display inlined
+function calls with earlier versions of <small>GCC</small>. It instead
+displays the arguments and local variables of inlined functions as
+local variables in the caller.
+</p>
+<p>The body of an inlined function is directly included at its call site;
+unlike a non-inlined function, there are no instructions devoted to
+the call. <small>GDB</small> still pretends that the call site and the
+start of the inlined function are different instructions. Stepping to
+the call site shows the call site, and then stepping again shows
+the first line of the inlined function, even though no additional
+instructions are executed.
+</p>
+<p>This makes source-level debugging much clearer; you can see both the
+context of the call and then the effect of the call. Only stepping by
+a single instruction using <code>stepi</code> or <code>nexti</code> does not do
+this; single instruction steps always show the inlined body.
+</p>
+<p>There are some ways that <small>GDB</small> does not pretend that inlined
+function calls are the same as normal calls:
+</p>
+<ul>
+<li> Setting breakpoints at the call site of an inlined function may not
+work, because the call site does not contain any code. <small>GDB</small>
+may incorrectly move the breakpoint to the next line of the enclosing
+function, after the call. This limitation will be removed in a future
+version of <small>GDB</small>; until then, set a breakpoint on an earlier line
+or inside the inlined function instead.
+
+</li><li> <small>GDB</small> cannot locate the return value of inlined calls after
+using the <code>finish</code> command. This is a limitation of compiler-generated
+debugging information; after <code>finish</code>, you can step to the next line
+and print a variable where your program stored the return value.
+
+</li></ul>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="Tail-Call-Frames.html#Tail-Call-Frames" accesskey="n" rel="next">Tail Call Frames</a>, Up: <a href="Optimized-Code.html#Optimized-Code" accesskey="u" rel="up">Optimized Code</a> &nbsp; [<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>