1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Frame Info</title> 18 19<meta name="description" content="Debugging with GDB: Frame Info"> 20<meta name="keywords" content="Debugging with GDB: Frame Info"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="Stack.html#Stack" rel="up" title="Stack"> 29<link href="Frame-Apply.html#Frame-Apply" rel="next" title="Frame Apply"> 30<link href="Selection.html#Selection" rel="previous" title="Selection"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Frame-Info"></a> 65<div class="header"> 66<p> 67Next: <a href="Frame-Apply.html#Frame-Apply" accesskey="n" rel="next">Frame Apply</a>, Previous: <a href="Selection.html#Selection" accesskey="p" rel="previous">Selection</a>, Up: <a href="Stack.html#Stack" accesskey="u" rel="up">Stack</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> 68</div> 69<hr> 70<a name="Information-about-a-Frame"></a> 71<h3 class="section">8.4 Information about a Frame</h3> 72 73<p>There are several other commands to print information about the selected 74stack frame. 75</p> 76<dl compact="compact"> 77<dt><code>frame</code></dt> 78<dt><code>f</code></dt> 79<dd><p>When used without any argument, this command does not change which 80frame is selected, but prints a brief description of the currently 81selected stack frame. It can be abbreviated <code>f</code>. With an 82argument, this command is used to select a stack frame. 83See <a href="Selection.html#Selection">Selecting a Frame</a>. 84</p> 85<a name="index-info-frame"></a> 86<a name="index-info-f-_0028info-frame_0029"></a> 87</dd> 88<dt><code>info frame</code></dt> 89<dt><code>info f</code></dt> 90<dd><p>This command prints a verbose description of the selected stack frame, 91including: 92</p> 93<ul> 94<li> the address of the frame 95</li><li> the address of the next frame down (called by this frame) 96</li><li> the address of the next frame up (caller of this frame) 97</li><li> the language in which the source code corresponding to this frame is written 98</li><li> the address of the frame’s arguments 99</li><li> the address of the frame’s local variables 100</li><li> the program counter saved in it (the address of execution in the caller frame) 101</li><li> which registers were saved in the frame 102</li></ul> 103 104<p>The verbose description is useful when 105something has gone wrong that has made the stack format fail to fit 106the usual conventions. 107</p> 108</dd> 109<dt><code>info frame <span class="roman">[</span> <var>frame-selection-spec</var> <span class="roman">]</span></code></dt> 110<dt><code>info f <span class="roman">[</span> <var>frame-selection-spec</var> <span class="roman">]</span></code></dt> 111<dd><p>Print a verbose description of the frame selected by 112<var>frame-selection-spec</var>. The <var>frame-selection-spec</var> is the 113same as for the <code>frame</code> command (see <a href="Selection.html#Selection">Selecting 114a Frame</a>). The selected frame remains unchanged by this command. 115</p> 116<a name="index-info-args"></a> 117</dd> 118<dt><code>info args [-q]</code></dt> 119<dd><p>Print the arguments of the selected frame, each on a separate line. 120</p> 121<p>The optional flag ‘<samp>-q</samp>’, which stands for ‘<samp>quiet</samp>’, disables 122printing header information and messages explaining why no argument 123have been printed. 124</p> 125</dd> 126<dt><code>info args [-q] [-t <var>type_regexp</var>] [<var>regexp</var>]</code></dt> 127<dd><p>Like <kbd>info args</kbd>, but only print the arguments selected 128with the provided regexp(s). 129</p> 130<p>If <var>regexp</var> is provided, print only the arguments whose names 131match the regular expression <var>regexp</var>. 132</p> 133<p>If <var>type_regexp</var> is provided, print only the arguments whose 134types, as printed by the <code>whatis</code> command, match 135the regular expression <var>type_regexp</var>. 136If <var>type_regexp</var> contains space(s), it should be enclosed in 137quote characters. If needed, use backslash to escape the meaning 138of special characters or quotes. 139</p> 140<p>If both <var>regexp</var> and <var>type_regexp</var> are provided, an argument 141is printed only if its name matches <var>regexp</var> and its type matches 142<var>type_regexp</var>. 143</p> 144</dd> 145<dt><code>info locals [-q]</code></dt> 146<dd><a name="index-info-locals"></a> 147<p>Print the local variables of the selected frame, each on a separate 148line. These are all variables (declared either static or automatic) 149accessible at the point of execution of the selected frame. 150</p> 151<p>The optional flag ‘<samp>-q</samp>’, which stands for ‘<samp>quiet</samp>’, disables 152printing header information and messages explaining why no local variables 153have been printed. 154</p> 155</dd> 156<dt><code>info locals [-q] [-t <var>type_regexp</var>] [<var>regexp</var>]</code></dt> 157<dd><p>Like <kbd>info locals</kbd>, but only print the local variables selected 158with the provided regexp(s). 159</p> 160<p>If <var>regexp</var> is provided, print only the local variables whose names 161match the regular expression <var>regexp</var>. 162</p> 163<p>If <var>type_regexp</var> is provided, print only the local variables whose 164types, as printed by the <code>whatis</code> command, match 165the regular expression <var>type_regexp</var>. 166If <var>type_regexp</var> contains space(s), it should be enclosed in 167quote characters. If needed, use backslash to escape the meaning 168of special characters or quotes. 169</p> 170<p>If both <var>regexp</var> and <var>type_regexp</var> are provided, a local variable 171is printed only if its name matches <var>regexp</var> and its type matches 172<var>type_regexp</var>. 173</p> 174<p>The command <kbd>info locals -q -t <var>type_regexp</var></kbd> can usefully be 175combined with the commands <kbd>frame apply</kbd> and <kbd>thread apply</kbd>. 176For example, your program might use Resource Acquisition Is 177Initialization types (RAII) such as <code>lock_something_t</code>: each 178local variable of type <code>lock_something_t</code> automatically places a 179lock that is destroyed when the variable goes out of scope. You can 180then list all acquired locks in your program by doing 181</p><div class="smallexample"> 182<pre class="smallexample">thread apply all -s frame apply all -s info locals -q -t lock_something_t 183</pre></div> 184<p>or the equivalent shorter form 185</p><div class="smallexample"> 186<pre class="smallexample">tfaas i lo -q -t lock_something_t 187</pre></div> 188 189</dd> 190</dl> 191 192<hr> 193<div class="header"> 194<p> 195Next: <a href="Frame-Apply.html#Frame-Apply" accesskey="n" rel="next">Frame Apply</a>, Previous: <a href="Selection.html#Selection" accesskey="p" rel="previous">Selection</a>, Up: <a href="Stack.html#Stack" accesskey="u" rel="up">Stack</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> 196</div> 197 198 199 200</body> 201</html> 202