GDB_002fMI-Stack-Manipulation.html 23 KB

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