Frame-Info.html 9.0 KB

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