You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GDB_002fMI-Stack-Manipulation.html 23KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>GDB/MI Stack Manipulation (Debugging with GDB)</title>
  17. <meta name="description" content="GDB/MI Stack Manipulation (Debugging with GDB)">
  18. <meta name="keywords" content="GDB/MI Stack Manipulation (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  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="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
  26. <link href="GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects" rel="next" title="GDB/MI Variable Objects">
  27. <link href="GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution" rel="prev" title="GDB/MI Program Execution">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="GDB_002fMI-Stack-Manipulation"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects" accesskey="n" rel="next">GDB/MI Variable Objects</a>, Previous: <a href="GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution" accesskey="p" rel="prev">GDB/MI Program Execution</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
  61. </div>
  62. <hr>
  63. <a name="GDB_002fMI-Stack-Manipulation-Commands"></a>
  64. <h3 class="section">27.14 <small>GDB/MI</small> Stack Manipulation Commands</h3>
  65. <a name="The-_002denable_002dframe_002dfilters-Command"></a>
  66. <h4 class="subheading">The <code>-enable-frame-filters</code> Command</h4>
  67. <a name="index-_002denable_002dframe_002dfilters"></a>
  68. <div class="smallexample">
  69. <pre class="smallexample">-enable-frame-filters
  70. </pre></div>
  71. <p><small>GDB</small> allows Python-based frame filters to affect the output of
  72. the MI commands relating to stack traces. As there is no way to
  73. implement this in a fully backward-compatible way, a front end must
  74. request that this functionality be enabled.
  75. </p>
  76. <p>Once enabled, this feature cannot be disabled.
  77. </p>
  78. <p>Note that if Python support has not been compiled into <small>GDB</small>,
  79. this command will still succeed (and do nothing).
  80. </p>
  81. <a name="The-_002dstack_002dinfo_002dframe-Command"></a>
  82. <h4 class="subheading">The <code>-stack-info-frame</code> Command</h4>
  83. <a name="index-_002dstack_002dinfo_002dframe"></a>
  84. <a name="Synopsis-41"></a>
  85. <h4 class="subsubheading">Synopsis</h4>
  86. <div class="smallexample">
  87. <pre class="smallexample"> -stack-info-frame
  88. </pre></div>
  89. <p>Get info on the selected frame.
  90. </p>
  91. <a name="GDB-Command-40"></a>
  92. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  93. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>info frame</samp>&rsquo; or &lsquo;<samp>frame</samp>&rsquo;
  94. (without arguments).
  95. </p>
  96. <a name="Example-39"></a>
  97. <h4 class="subsubheading">Example</h4>
  98. <div class="smallexample">
  99. <pre class="smallexample">(gdb)
  100. -stack-info-frame
  101. ^done,frame={level=&quot;1&quot;,addr=&quot;0x0001076c&quot;,func=&quot;callee3&quot;,
  102. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  103. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;17&quot;,
  104. arch=&quot;i386:x86_64&quot;}
  105. (gdb)
  106. </pre></div>
  107. <a name="The-_002dstack_002dinfo_002ddepth-Command"></a>
  108. <h4 class="subheading">The <code>-stack-info-depth</code> Command</h4>
  109. <a name="index-_002dstack_002dinfo_002ddepth"></a>
  110. <a name="Synopsis-42"></a>
  111. <h4 class="subsubheading">Synopsis</h4>
  112. <div class="smallexample">
  113. <pre class="smallexample"> -stack-info-depth [ <var>max-depth</var> ]
  114. </pre></div>
  115. <p>Return the depth of the stack. If the integer argument <var>max-depth</var>
  116. is specified, do not count beyond <var>max-depth</var> frames.
  117. </p>
  118. <a name="GDB-Command-41"></a>
  119. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  120. <p>There&rsquo;s no equivalent <small>GDB</small> command.
  121. </p>
  122. <a name="Example-40"></a>
  123. <h4 class="subsubheading">Example</h4>
  124. <p>For a stack with frame levels 0 through 11:
  125. </p>
  126. <div class="smallexample">
  127. <pre class="smallexample">(gdb)
  128. -stack-info-depth
  129. ^done,depth=&quot;12&quot;
  130. (gdb)
  131. -stack-info-depth 4
  132. ^done,depth=&quot;4&quot;
  133. (gdb)
  134. -stack-info-depth 12
  135. ^done,depth=&quot;12&quot;
  136. (gdb)
  137. -stack-info-depth 11
  138. ^done,depth=&quot;11&quot;
  139. (gdb)
  140. -stack-info-depth 13
  141. ^done,depth=&quot;12&quot;
  142. (gdb)
  143. </pre></div>
  144. <a name="g_t_002dstack_002dlist_002darguments"></a><a name="The-_002dstack_002dlist_002darguments-Command"></a>
  145. <h4 class="subheading">The <code>-stack-list-arguments</code> Command</h4>
  146. <a name="index-_002dstack_002dlist_002darguments"></a>
  147. <a name="Synopsis-43"></a>
  148. <h4 class="subsubheading">Synopsis</h4>
  149. <div class="smallexample">
  150. <pre class="smallexample"> -stack-list-arguments [ --no-frame-filters ] [ --skip-unavailable ] <var>print-values</var>
  151. [ <var>low-frame</var> <var>high-frame</var> ]
  152. </pre></div>
  153. <p>Display a list of the arguments for the frames between <var>low-frame</var>
  154. and <var>high-frame</var> (inclusive). If <var>low-frame</var> and
  155. <var>high-frame</var> are not provided, list the arguments for the whole
  156. call stack. If the two arguments are equal, show the single frame
  157. at the corresponding level. It is an error if <var>low-frame</var> is
  158. larger than the actual number of frames. On the other hand,
  159. <var>high-frame</var> may be larger than the actual number of frames, in
  160. which case only existing frames will be returned.
  161. </p>
  162. <p>If <var>print-values</var> is 0 or <code>--no-values</code>, print only the names of
  163. the variables; if it is 1 or <code>--all-values</code>, print also their
  164. values; and if it is 2 or <code>--simple-values</code>, print the name,
  165. type and value for simple data types, and the name and type for arrays,
  166. structures and unions. If the option <code>--no-frame-filters</code> is
  167. supplied, then Python frame filters will not be executed.
  168. </p>
  169. <p>If the <code>--skip-unavailable</code> option is specified, arguments that
  170. are not available are not listed. Partially available arguments
  171. are still displayed, however.
  172. </p>
  173. <p>Use of this command to obtain arguments in a single frame is
  174. deprecated in favor of the &lsquo;<samp>-stack-list-variables</samp>&rsquo; command.
  175. </p>
  176. <a name="GDB-Command-42"></a>
  177. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  178. <p><small>GDB</small> does not have an equivalent command. <code>gdbtk</code> has a
  179. &lsquo;<samp>gdb_get_args</samp>&rsquo; command which partially overlaps with the
  180. functionality of &lsquo;<samp>-stack-list-arguments</samp>&rsquo;.
  181. </p>
  182. <a name="Example-41"></a>
  183. <h4 class="subsubheading">Example</h4>
  184. <div class="smallexample">
  185. <pre class="smallexample">(gdb)
  186. -stack-list-frames
  187. ^done,
  188. stack=[
  189. frame={level=&quot;0&quot;,addr=&quot;0x00010734&quot;,func=&quot;callee4&quot;,
  190. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  191. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;8&quot;,
  192. arch=&quot;i386:x86_64&quot;},
  193. frame={level=&quot;1&quot;,addr=&quot;0x0001076c&quot;,func=&quot;callee3&quot;,
  194. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  195. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;17&quot;,
  196. arch=&quot;i386:x86_64&quot;},
  197. frame={level=&quot;2&quot;,addr=&quot;0x0001078c&quot;,func=&quot;callee2&quot;,
  198. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  199. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;22&quot;,
  200. arch=&quot;i386:x86_64&quot;},
  201. frame={level=&quot;3&quot;,addr=&quot;0x000107b4&quot;,func=&quot;callee1&quot;,
  202. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  203. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;27&quot;,
  204. arch=&quot;i386:x86_64&quot;},
  205. frame={level=&quot;4&quot;,addr=&quot;0x000107e0&quot;,func=&quot;main&quot;,
  206. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  207. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;32&quot;,
  208. arch=&quot;i386:x86_64&quot;}]
  209. (gdb)
  210. -stack-list-arguments 0
  211. ^done,
  212. stack-args=[
  213. frame={level=&quot;0&quot;,args=[]},
  214. frame={level=&quot;1&quot;,args=[name=&quot;strarg&quot;]},
  215. frame={level=&quot;2&quot;,args=[name=&quot;intarg&quot;,name=&quot;strarg&quot;]},
  216. frame={level=&quot;3&quot;,args=[name=&quot;intarg&quot;,name=&quot;strarg&quot;,name=&quot;fltarg&quot;]},
  217. frame={level=&quot;4&quot;,args=[]}]
  218. (gdb)
  219. -stack-list-arguments 1
  220. ^done,
  221. stack-args=[
  222. frame={level=&quot;0&quot;,args=[]},
  223. frame={level=&quot;1&quot;,
  224. args=[{name=&quot;strarg&quot;,value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;}]},
  225. frame={level=&quot;2&quot;,args=[
  226. {name=&quot;intarg&quot;,value=&quot;2&quot;},
  227. {name=&quot;strarg&quot;,value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;}]},
  228. {frame={level=&quot;3&quot;,args=[
  229. {name=&quot;intarg&quot;,value=&quot;2&quot;},
  230. {name=&quot;strarg&quot;,value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;},
  231. {name=&quot;fltarg&quot;,value=&quot;3.5&quot;}]},
  232. frame={level=&quot;4&quot;,args=[]}]
  233. (gdb)
  234. -stack-list-arguments 0 2 2
  235. ^done,stack-args=[frame={level=&quot;2&quot;,args=[name=&quot;intarg&quot;,name=&quot;strarg&quot;]}]
  236. (gdb)
  237. -stack-list-arguments 1 2 2
  238. ^done,stack-args=[frame={level=&quot;2&quot;,
  239. args=[{name=&quot;intarg&quot;,value=&quot;2&quot;},
  240. {name=&quot;strarg&quot;,value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;}]}]
  241. (gdb)
  242. </pre></div>
  243. <a name="g_t_002dstack_002dlist_002dframes"></a><a name="The-_002dstack_002dlist_002dframes-Command"></a>
  244. <h4 class="subheading">The <code>-stack-list-frames</code> Command</h4>
  245. <a name="index-_002dstack_002dlist_002dframes"></a>
  246. <a name="Synopsis-44"></a>
  247. <h4 class="subsubheading">Synopsis</h4>
  248. <div class="smallexample">
  249. <pre class="smallexample"> -stack-list-frames [ --no-frame-filters <var>low-frame</var> <var>high-frame</var> ]
  250. </pre></div>
  251. <p>List the frames currently on the stack. For each frame it displays the
  252. following info:
  253. </p>
  254. <dl compact="compact">
  255. <dt>&lsquo;<samp><var>level</var></samp>&rsquo;</dt>
  256. <dd><p>The frame number, 0 being the topmost frame, i.e., the innermost function.
  257. </p></dd>
  258. <dt>&lsquo;<samp><var>addr</var></samp>&rsquo;</dt>
  259. <dd><p>The <code>$pc</code> value for that frame.
  260. </p></dd>
  261. <dt>&lsquo;<samp><var>func</var></samp>&rsquo;</dt>
  262. <dd><p>Function name.
  263. </p></dd>
  264. <dt>&lsquo;<samp><var>file</var></samp>&rsquo;</dt>
  265. <dd><p>File name of the source file where the function lives.
  266. </p></dd>
  267. <dt>&lsquo;<samp><var>fullname</var></samp>&rsquo;</dt>
  268. <dd><p>The full file name of the source file where the function lives.
  269. </p></dd>
  270. <dt>&lsquo;<samp><var>line</var></samp>&rsquo;</dt>
  271. <dd><p>Line number corresponding to the <code>$pc</code>.
  272. </p></dd>
  273. <dt>&lsquo;<samp><var>from</var></samp>&rsquo;</dt>
  274. <dd><p>The shared library where this function is defined. This is only given
  275. if the frame&rsquo;s function is not known.
  276. </p></dd>
  277. <dt>&lsquo;<samp><var>arch</var></samp>&rsquo;</dt>
  278. <dd><p>Frame&rsquo;s architecture.
  279. </p></dd>
  280. </dl>
  281. <p>If invoked without arguments, this command prints a backtrace for the
  282. whole stack. If given two integer arguments, it shows the frames whose
  283. levels are between the two arguments (inclusive). If the two arguments
  284. are equal, it shows the single frame at the corresponding level. It is
  285. an error if <var>low-frame</var> is larger than the actual number of
  286. frames. On the other hand, <var>high-frame</var> may be larger than the
  287. actual number of frames, in which case only existing frames will be
  288. returned. If the option <code>--no-frame-filters</code> is supplied, then
  289. Python frame filters will not be executed.
  290. </p>
  291. <a name="GDB-Command-43"></a>
  292. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  293. <p>The corresponding <small>GDB</small> commands are &lsquo;<samp>backtrace</samp>&rsquo; and &lsquo;<samp>where</samp>&rsquo;.
  294. </p>
  295. <a name="Example-42"></a>
  296. <h4 class="subsubheading">Example</h4>
  297. <p>Full stack backtrace:
  298. </p>
  299. <div class="smallexample">
  300. <pre class="smallexample">(gdb)
  301. -stack-list-frames
  302. ^done,stack=
  303. [frame={level=&quot;0&quot;,addr=&quot;0x0001076c&quot;,func=&quot;foo&quot;,
  304. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;11&quot;,
  305. arch=&quot;i386:x86_64&quot;},
  306. frame={level=&quot;1&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  307. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  308. arch=&quot;i386:x86_64&quot;},
  309. frame={level=&quot;2&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  310. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  311. arch=&quot;i386:x86_64&quot;},
  312. frame={level=&quot;3&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  313. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  314. arch=&quot;i386:x86_64&quot;},
  315. frame={level=&quot;4&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  316. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  317. arch=&quot;i386:x86_64&quot;},
  318. frame={level=&quot;5&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  319. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  320. arch=&quot;i386:x86_64&quot;},
  321. frame={level=&quot;6&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  322. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  323. arch=&quot;i386:x86_64&quot;},
  324. frame={level=&quot;7&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  325. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  326. arch=&quot;i386:x86_64&quot;},
  327. frame={level=&quot;8&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  328. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  329. arch=&quot;i386:x86_64&quot;},
  330. frame={level=&quot;9&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  331. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  332. arch=&quot;i386:x86_64&quot;},
  333. frame={level=&quot;10&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  334. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  335. arch=&quot;i386:x86_64&quot;},
  336. frame={level=&quot;11&quot;,addr=&quot;0x00010738&quot;,func=&quot;main&quot;,
  337. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;4&quot;,
  338. arch=&quot;i386:x86_64&quot;}]
  339. (gdb)
  340. </pre></div>
  341. <p>Show frames between <var>low_frame</var> and <var>high_frame</var>:
  342. </p>
  343. <div class="smallexample">
  344. <pre class="smallexample">(gdb)
  345. -stack-list-frames 3 5
  346. ^done,stack=
  347. [frame={level=&quot;3&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  348. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  349. arch=&quot;i386:x86_64&quot;},
  350. frame={level=&quot;4&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  351. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  352. arch=&quot;i386:x86_64&quot;},
  353. frame={level=&quot;5&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  354. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  355. arch=&quot;i386:x86_64&quot;}]
  356. (gdb)
  357. </pre></div>
  358. <p>Show a single frame:
  359. </p>
  360. <div class="smallexample">
  361. <pre class="smallexample">(gdb)
  362. -stack-list-frames 3 3
  363. ^done,stack=
  364. [frame={level=&quot;3&quot;,addr=&quot;0x000107a4&quot;,func=&quot;foo&quot;,
  365. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  366. arch=&quot;i386:x86_64&quot;}]
  367. (gdb)
  368. </pre></div>
  369. <a name="The-_002dstack_002dlist_002dlocals-Command"></a>
  370. <h4 class="subheading">The <code>-stack-list-locals</code> Command</h4>
  371. <a name="index-_002dstack_002dlist_002dlocals"></a>
  372. <a name="g_t_002dstack_002dlist_002dlocals"></a>
  373. <a name="Synopsis-45"></a>
  374. <h4 class="subsubheading">Synopsis</h4>
  375. <div class="smallexample">
  376. <pre class="smallexample"> -stack-list-locals [ --no-frame-filters ] [ --skip-unavailable ] <var>print-values</var>
  377. </pre></div>
  378. <p>Display the local variable names for the selected frame. If
  379. <var>print-values</var> is 0 or <code>--no-values</code>, print only the names of
  380. the variables; if it is 1 or <code>--all-values</code>, print also their
  381. values; and if it is 2 or <code>--simple-values</code>, print the name,
  382. type and value for simple data types, and the name and type for arrays,
  383. structures and unions. In this last case, a frontend can immediately
  384. display the value of simple data types and create variable objects for
  385. other data types when the user wishes to explore their values in
  386. more detail. If the option <code>--no-frame-filters</code> is supplied, then
  387. Python frame filters will not be executed.
  388. </p>
  389. <p>If the <code>--skip-unavailable</code> option is specified, local variables
  390. that are not available are not listed. Partially available local
  391. variables are still displayed, however.
  392. </p>
  393. <p>This command is deprecated in favor of the
  394. &lsquo;<samp>-stack-list-variables</samp>&rsquo; command.
  395. </p>
  396. <a name="GDB-Command-44"></a>
  397. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  398. <p>&lsquo;<samp>info locals</samp>&rsquo; in <small>GDB</small>, &lsquo;<samp>gdb_get_locals</samp>&rsquo; in <code>gdbtk</code>.
  399. </p>
  400. <a name="Example-43"></a>
  401. <h4 class="subsubheading">Example</h4>
  402. <div class="smallexample">
  403. <pre class="smallexample">(gdb)
  404. -stack-list-locals 0
  405. ^done,locals=[name=&quot;A&quot;,name=&quot;B&quot;,name=&quot;C&quot;]
  406. (gdb)
  407. -stack-list-locals --all-values
  408. ^done,locals=[{name=&quot;A&quot;,value=&quot;1&quot;},{name=&quot;B&quot;,value=&quot;2&quot;},
  409. {name=&quot;C&quot;,value=&quot;{1, 2, 3}&quot;}]
  410. -stack-list-locals --simple-values
  411. ^done,locals=[{name=&quot;A&quot;,type=&quot;int&quot;,value=&quot;1&quot;},
  412. {name=&quot;B&quot;,type=&quot;int&quot;,value=&quot;2&quot;},{name=&quot;C&quot;,type=&quot;int [3]&quot;}]
  413. (gdb)
  414. </pre></div>
  415. <a name="g_t_002dstack_002dlist_002dvariables"></a><a name="The-_002dstack_002dlist_002dvariables-Command"></a>
  416. <h4 class="subheading">The <code>-stack-list-variables</code> Command</h4>
  417. <a name="index-_002dstack_002dlist_002dvariables"></a>
  418. <a name="Synopsis-46"></a>
  419. <h4 class="subsubheading">Synopsis</h4>
  420. <div class="smallexample">
  421. <pre class="smallexample"> -stack-list-variables [ --no-frame-filters ] [ --skip-unavailable ] <var>print-values</var>
  422. </pre></div>
  423. <p>Display the names of local variables and function arguments for the selected frame. If
  424. <var>print-values</var> is 0 or <code>--no-values</code>, print only the names of
  425. the variables; if it is 1 or <code>--all-values</code>, print also their
  426. values; and if it is 2 or <code>--simple-values</code>, print the name,
  427. type and value for simple data types, and the name and type for arrays,
  428. structures and unions. If the option <code>--no-frame-filters</code> is
  429. supplied, then Python frame filters will not be executed.
  430. </p>
  431. <p>If the <code>--skip-unavailable</code> option is specified, local variables
  432. and arguments that are not available are not listed. Partially
  433. available arguments and local variables are still displayed, however.
  434. </p>
  435. <a name="Example-44"></a>
  436. <h4 class="subsubheading">Example</h4>
  437. <div class="smallexample">
  438. <pre class="smallexample">(gdb)
  439. -stack-list-variables --thread 1 --frame 0 --all-values
  440. ^done,variables=[{name=&quot;x&quot;,value=&quot;11&quot;},{name=&quot;s&quot;,value=&quot;{a = 1, b = 2}&quot;}]
  441. (gdb)
  442. </pre></div>
  443. <a name="The-_002dstack_002dselect_002dframe-Command"></a>
  444. <h4 class="subheading">The <code>-stack-select-frame</code> Command</h4>
  445. <a name="index-_002dstack_002dselect_002dframe"></a>
  446. <a name="Synopsis-47"></a>
  447. <h4 class="subsubheading">Synopsis</h4>
  448. <div class="smallexample">
  449. <pre class="smallexample"> -stack-select-frame <var>framenum</var>
  450. </pre></div>
  451. <p>Change the selected frame. Select a different frame <var>framenum</var> on
  452. the stack.
  453. </p>
  454. <p>This command in deprecated in favor of passing the &lsquo;<samp>--frame</samp>&rsquo;
  455. option to every command.
  456. </p>
  457. <a name="GDB-Command-45"></a>
  458. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  459. <p>The corresponding <small>GDB</small> commands are &lsquo;<samp>frame</samp>&rsquo;, &lsquo;<samp>up</samp>&rsquo;,
  460. &lsquo;<samp>down</samp>&rsquo;, &lsquo;<samp>select-frame</samp>&rsquo;, &lsquo;<samp>up-silent</samp>&rsquo;, and &lsquo;<samp>down-silent</samp>&rsquo;.
  461. </p>
  462. <a name="Example-45"></a>
  463. <h4 class="subsubheading">Example</h4>
  464. <div class="smallexample">
  465. <pre class="smallexample">(gdb)
  466. -stack-select-frame 2
  467. ^done
  468. (gdb)
  469. </pre></div>
  470. <hr>
  471. <div class="header">
  472. <p>
  473. Next: <a href="GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects" accesskey="n" rel="next">GDB/MI Variable Objects</a>, Previous: <a href="GDB_002fMI-Program-Execution.html#GDB_002fMI-Program-Execution" accesskey="p" rel="prev">GDB/MI Program Execution</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
  474. </div>
  475. </body>
  476. </html>