toolchain/share/doc/gdb/Frame-Info.html

147 lines
7.4 KiB
HTML
Raw Normal View History

2024-01-10 05:24:32 +00:00
<html lang="en">
<head>
<title>Frame Info - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Stack.html#Stack" title="Stack">
<link rel="prev" href="Selection.html#Selection" title="Selection">
<link rel="next" href="Frame-Apply.html#Frame-Apply" title="Frame Apply">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 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.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Frame-Info"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Frame-Apply.html#Frame-Apply">Frame Apply</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Selection.html#Selection">Selection</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Stack.html#Stack">Stack</a>
<hr>
</div>
<h3 class="section">8.4 Information About a Frame</h3>
<p>There are several other commands to print information about the selected
stack frame.
<dl>
<dt><code>frame</code><dt><code>f</code><dd>When used without any argument, this command does not change which
frame is selected, but prints a brief description of the currently
selected stack frame. It can be abbreviated <code>f</code>. With an
argument, this command is used to select a stack frame.
See <a href="Selection.html#Selection">Selecting a Frame</a>.
<p><a name="index-info-frame-541"></a><a name="index-info-f-_0040r_007b_0028_0040code_007binfo-frame_007d_0029_007d-542"></a><br><dt><code>info frame</code><dt><code>info f</code><dd>This command prints a verbose description of the selected stack frame,
including:
<ul>
<li>the address of the frame
<li>the address of the next frame down (called by this frame)
<li>the address of the next frame up (caller of this frame)
<li>the language in which the source code corresponding to this frame is written
<li>the address of the frame's arguments
<li>the address of the frame's local variables
<li>the program counter saved in it (the address of execution in the caller frame)
<li>which registers were saved in the frame
</ul>
<p class="noindent">The verbose description is useful when
something has gone wrong that has made the stack format fail to fit
the usual conventions.
<br><dt><code>info frame </code><span class="roman">[</span> <var>frame-selection-spec</var> <span class="roman">]</span><dt><code>info f </code><span class="roman">[</span> <var>frame-selection-spec</var> <span class="roman">]</span><dd>Print a verbose description of the frame selected by
<var>frame-selection-spec</var>. The <var>frame-selection-spec</var> is the
same as for the <samp><span class="command">frame</span></samp> command (see <a href="Selection.html#Selection">Selecting a Frame</a>). The selected frame remains unchanged by this command.
<p><a name="index-info-args-543"></a><br><dt><code>info args [-q]</code><dd>Print the arguments of the selected frame, each on a separate line.
<p>The optional flag &lsquo;<samp><span class="samp">-q</span></samp>&rsquo;, which stands for &lsquo;<samp><span class="samp">quiet</span></samp>&rsquo;, disables
printing header information and messages explaining why no argument
have been printed.
<br><dt><code>info args [-q] [-t </code><var>type_regexp</var><code>] [</code><var>regexp</var><code>]</code><dd>Like <kbd>info args</kbd>, but only print the arguments selected
with the provided regexp(s).
<p>If <var>regexp</var> is provided, print only the arguments whose names
match the regular expression <var>regexp</var>.
<p>If <var>type_regexp</var> is provided, print only the arguments whose
types, as printed by the <code>whatis</code> command, match
the regular expression <var>type_regexp</var>.
If <var>type_regexp</var> contains space(s), it should be enclosed in
quote characters. If needed, use backslash to escape the meaning
of special characters or quotes.
<p>If both <var>regexp</var> and <var>type_regexp</var> are provided, an argument
is printed only if its name matches <var>regexp</var> and its type matches
<var>type_regexp</var>.
<br><dt><code>info locals [-q]</code><dd><a name="index-info-locals-544"></a>Print the local variables of the selected frame, each on a separate
line. These are all variables (declared either static or automatic)
accessible at the point of execution of the selected frame.
<p>The optional flag &lsquo;<samp><span class="samp">-q</span></samp>&rsquo;, which stands for &lsquo;<samp><span class="samp">quiet</span></samp>&rsquo;, disables
printing header information and messages explaining why no local variables
have been printed.
<br><dt><code>info locals [-q] [-t </code><var>type_regexp</var><code>] [</code><var>regexp</var><code>]</code><dd>Like <kbd>info locals</kbd>, but only print the local variables selected
with the provided regexp(s).
<p>If <var>regexp</var> is provided, print only the local variables whose names
match the regular expression <var>regexp</var>.
<p>If <var>type_regexp</var> is provided, print only the local variables whose
types, as printed by the <code>whatis</code> command, match
the regular expression <var>type_regexp</var>.
If <var>type_regexp</var> contains space(s), it should be enclosed in
quote characters. If needed, use backslash to escape the meaning
of special characters or quotes.
<p>If both <var>regexp</var> and <var>type_regexp</var> are provided, a local variable
is printed only if its name matches <var>regexp</var> and its type matches
<var>type_regexp</var>.
<p>The command <kbd>info locals -q -t </kbd><var>type_regexp</var> can usefully be
combined with the commands <kbd>frame apply</kbd> and <kbd>thread apply</kbd>.
For example, your program might use Resource Acquisition Is
Initialization types (RAII) such as <code>lock_something_t</code>: each
local variable of type <code>lock_something_t</code> automatically places a
lock that is destroyed when the variable goes out of scope. You can
then list all acquired locks in your program by doing
<pre class="smallexample"> thread apply all -s frame apply all -s info locals -q -t lock_something_t
</pre>
<p class="noindent">or the equivalent shorter form
<pre class="smallexample"> tfaas i lo -q -t lock_something_t
</pre>
</dl>
</body></html>