Print-Settings.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  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: Print Settings</title>
  16. <meta name="description" content="Debugging with GDB: Print Settings">
  17. <meta name="keywords" content="Debugging with GDB: Print Settings">
  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="Data.html#Data" rel="up" title="Data">
  26. <link href="Pretty-Printing.html#Pretty-Printing" rel="next" title="Pretty Printing">
  27. <link href="Auto-Display.html#Auto-Display" rel="previous" title="Auto Display">
  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="Print-Settings"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Pretty-Printing.html#Pretty-Printing" accesskey="n" rel="next">Pretty Printing</a>, Previous: <a href="Auto-Display.html#Auto-Display" accesskey="p" rel="previous">Auto Display</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</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="Print-Settings-1"></a>
  65. <h3 class="section">10.8 Print Settings</h3>
  66. <a name="index-format-options"></a>
  67. <a name="index-print-settings"></a>
  68. <p><small>GDB</small> provides the following ways to control how arrays, structures,
  69. and symbols are printed.
  70. </p>
  71. <p>These settings are useful for debugging programs in any language:
  72. </p>
  73. <dl compact="compact">
  74. <dd><a name="index-set-print"></a>
  75. <a name="set-print-address"></a></dd>
  76. <dt><code>set print address</code></dt>
  77. <dt><code>set print address on</code></dt>
  78. <dd><a name="index-print_002fdon_0027t-print-memory-addresses"></a>
  79. <p><small>GDB</small> prints memory addresses showing the location of stack
  80. traces, structure values, pointer values, breakpoints, and so forth,
  81. even when it also displays the contents of those addresses. The default
  82. is <code>on</code>. For example, this is what a stack frame display looks like with
  83. <code>set print address on</code>:
  84. </p>
  85. <div class="smallexample">
  86. <pre class="smallexample">(gdb) f
  87. #0 set_quotes (lq=0x34c78 &quot;&lt;&lt;&quot;, rq=0x34c88 &quot;&gt;&gt;&quot;)
  88. at input.c:530
  89. 530 if (lquote != def_lquote)
  90. </pre></div>
  91. </dd>
  92. <dt><code>set print address off</code></dt>
  93. <dd><p>Do not print addresses when displaying their contents. For example,
  94. this is the same stack frame displayed with <code>set print address off</code>:
  95. </p>
  96. <div class="smallexample">
  97. <pre class="smallexample">(gdb) set print addr off
  98. (gdb) f
  99. #0 set_quotes (lq=&quot;&lt;&lt;&quot;, rq=&quot;&gt;&gt;&quot;) at input.c:530
  100. 530 if (lquote != def_lquote)
  101. </pre></div>
  102. <p>You can use &lsquo;<samp>set print address off</samp>&rsquo; to eliminate all machine
  103. dependent displays from the <small>GDB</small> interface. For example, with
  104. <code>print address off</code>, you should get the same text for backtraces on
  105. all machines&mdash;whether or not they involve pointer arguments.
  106. </p>
  107. <a name="index-show-print"></a>
  108. </dd>
  109. <dt><code>show print address</code></dt>
  110. <dd><p>Show whether or not addresses are to be printed.
  111. </p></dd>
  112. </dl>
  113. <p>When <small>GDB</small> prints a symbolic address, it normally prints the
  114. closest earlier symbol plus an offset. If that symbol does not uniquely
  115. identify the address (for example, it is a name whose scope is a single
  116. source file), you may need to clarify. One way to do this is with
  117. <code>info line</code>, for example &lsquo;<samp>info line *0x4537</samp>&rsquo;. Alternately,
  118. you can set <small>GDB</small> to print the source file and line number when
  119. it prints a symbolic address:
  120. </p>
  121. <dl compact="compact">
  122. <dt><code>set print symbol-filename on</code></dt>
  123. <dd><a name="index-source-file-and-line-of-a-symbol"></a>
  124. <a name="index-symbol_002c-source-file-and-line"></a>
  125. <p>Tell <small>GDB</small> to print the source file name and line number of a
  126. symbol in the symbolic form of an address.
  127. </p>
  128. </dd>
  129. <dt><code>set print symbol-filename off</code></dt>
  130. <dd><p>Do not print source file name and line number of a symbol. This is the
  131. default.
  132. </p>
  133. </dd>
  134. <dt><code>show print symbol-filename</code></dt>
  135. <dd><p>Show whether or not <small>GDB</small> will print the source file name and
  136. line number of a symbol in the symbolic form of an address.
  137. </p></dd>
  138. </dl>
  139. <p>Another situation where it is helpful to show symbol filenames and line
  140. numbers is when disassembling code; <small>GDB</small> shows you the line
  141. number and source file that corresponds to each instruction.
  142. </p>
  143. <p>Also, you may wish to see the symbolic form only if the address being
  144. printed is reasonably close to the closest earlier symbol:
  145. </p>
  146. <dl compact="compact">
  147. <dt><code>set print max-symbolic-offset <var>max-offset</var></code></dt>
  148. <dt><code>set print max-symbolic-offset unlimited</code></dt>
  149. <dd><a name="index-maximum-value-for-offset-of-closest-symbol"></a>
  150. <p>Tell <small>GDB</small> to only display the symbolic form of an address if the
  151. offset between the closest earlier symbol and the address is less than
  152. <var>max-offset</var>. The default is <code>unlimited</code>, which tells <small>GDB</small>
  153. to always print the symbolic form of an address if any symbol precedes
  154. it. Zero is equivalent to <code>unlimited</code>.
  155. </p>
  156. </dd>
  157. <dt><code>show print max-symbolic-offset</code></dt>
  158. <dd><p>Ask how large the maximum offset is that <small>GDB</small> prints in a
  159. symbolic address.
  160. </p></dd>
  161. </dl>
  162. <a name="index-wild-pointer_002c-interpreting"></a>
  163. <a name="index-pointer_002c-finding-referent"></a>
  164. <p>If you have a pointer and you are not sure where it points, try
  165. &lsquo;<samp>set print symbol-filename on</samp>&rsquo;. Then you can determine the name
  166. and source file location of the variable where it points, using
  167. &lsquo;<samp>p/a <var>pointer</var></samp>&rsquo;. This interprets the address in symbolic form.
  168. For example, here <small>GDB</small> shows that a variable <code>ptt</code> points
  169. at another variable <code>t</code>, defined in <samp>hi2.c</samp>:
  170. </p>
  171. <div class="smallexample">
  172. <pre class="smallexample">(gdb) set print symbol-filename on
  173. (gdb) p/a ptt
  174. $4 = 0xe008 &lt;t in hi2.c&gt;
  175. </pre></div>
  176. <blockquote>
  177. <p><em>Warning:</em> For pointers that point to a local variable, &lsquo;<samp>p/a</samp>&rsquo;
  178. does not show the symbol name and filename of the referent, even with
  179. the appropriate <code>set print</code> options turned on.
  180. </p></blockquote>
  181. <p>You can also enable &lsquo;<samp>/a</samp>&rsquo;-like formatting all the time using
  182. &lsquo;<samp>set print symbol on</samp>&rsquo;:
  183. </p>
  184. <a name="set-print-symbol"></a><dl compact="compact">
  185. <dt><code>set print symbol on</code></dt>
  186. <dd><p>Tell <small>GDB</small> to print the symbol corresponding to an address, if
  187. one exists.
  188. </p>
  189. </dd>
  190. <dt><code>set print symbol off</code></dt>
  191. <dd><p>Tell <small>GDB</small> not to print the symbol corresponding to an
  192. address. In this mode, <small>GDB</small> will still print the symbol
  193. corresponding to pointers to functions. This is the default.
  194. </p>
  195. </dd>
  196. <dt><code>show print symbol</code></dt>
  197. <dd><p>Show whether <small>GDB</small> will display the symbol corresponding to an
  198. address.
  199. </p></dd>
  200. </dl>
  201. <p>Other settings control how different kinds of objects are printed:
  202. </p>
  203. <dl compact="compact">
  204. <dd><a name="set-print-array"></a></dd>
  205. <dt><code>set print array</code></dt>
  206. <dt><code>set print array on</code></dt>
  207. <dd><a name="index-pretty-print-arrays"></a>
  208. <p>Pretty print arrays. This format is more convenient to read,
  209. but uses more space. The default is off.
  210. </p>
  211. </dd>
  212. <dt><code>set print array off</code></dt>
  213. <dd><p>Return to compressed format for arrays.
  214. </p>
  215. </dd>
  216. <dt><code>show print array</code></dt>
  217. <dd><p>Show whether compressed or pretty format is selected for displaying
  218. arrays.
  219. </p>
  220. <a name="index-print-array-indexes"></a>
  221. <a name="set-print-array_002dindexes"></a></dd>
  222. <dt><code>set print array-indexes</code></dt>
  223. <dt><code>set print array-indexes on</code></dt>
  224. <dd><p>Print the index of each element when displaying arrays. May be more
  225. convenient to locate a given element in the array or quickly find the
  226. index of a given element in that printed array. The default is off.
  227. </p>
  228. </dd>
  229. <dt><code>set print array-indexes off</code></dt>
  230. <dd><p>Stop printing element indexes when displaying arrays.
  231. </p>
  232. </dd>
  233. <dt><code>show print array-indexes</code></dt>
  234. <dd><p>Show whether the index of each element is printed when displaying
  235. arrays.
  236. </p>
  237. <a name="set-print-elements"></a></dd>
  238. <dt><code>set print elements <var>number-of-elements</var></code></dt>
  239. <dt><code>set print elements unlimited</code></dt>
  240. <dd><a name="index-number-of-array-elements-to-print"></a>
  241. <a name="index-limit-on-number-of-printed-array-elements"></a>
  242. <p>Set a limit on how many elements of an array <small>GDB</small> will print.
  243. If <small>GDB</small> is printing a large array, it stops printing after it has
  244. printed the number of elements set by the <code>set print elements</code> command.
  245. This limit also applies to the display of strings.
  246. When <small>GDB</small> starts, this limit is set to 200.
  247. Setting <var>number-of-elements</var> to <code>unlimited</code> or zero means
  248. that the number of elements to print is unlimited.
  249. </p>
  250. </dd>
  251. <dt><code>show print elements</code></dt>
  252. <dd><p>Display the number of elements of a large array that <small>GDB</small> will print.
  253. If the number is 0, then the printing is unlimited.
  254. </p>
  255. <a name="set-print-frame_002darguments"></a></dd>
  256. <dt><code>set print frame-arguments <var>value</var></code></dt>
  257. <dd><a name="index-set-print-frame_002darguments"></a>
  258. <a name="index-printing-frame-argument-values"></a>
  259. <a name="index-print-all-frame-argument-values"></a>
  260. <a name="index-print-frame-argument-values-for-scalars-only"></a>
  261. <a name="index-do-not-print-frame-arguments"></a>
  262. <p>This command allows to control how the values of arguments are printed
  263. when the debugger prints a frame (see <a href="Frames.html#Frames">Frames</a>). The possible
  264. values are:
  265. </p>
  266. <dl compact="compact">
  267. <dt><code>all</code></dt>
  268. <dd><p>The values of all arguments are printed.
  269. </p>
  270. </dd>
  271. <dt><code>scalars</code></dt>
  272. <dd><p>Print the value of an argument only if it is a scalar. The value of more
  273. complex arguments such as arrays, structures, unions, etc, is replaced
  274. by <code>&hellip;</code>. This is the default. Here is an example where
  275. only scalar arguments are shown:
  276. </p>
  277. <div class="smallexample">
  278. <pre class="smallexample">#1 0x08048361 in call_me (i=3, s=&hellip;, ss=0xbf8d508c, u=&hellip;, e=green)
  279. at frame-args.c:23
  280. </pre></div>
  281. </dd>
  282. <dt><code>none</code></dt>
  283. <dd><p>None of the argument values are printed. Instead, the value of each argument
  284. is replaced by <code>&hellip;</code>. In this case, the example above now becomes:
  285. </p>
  286. <div class="smallexample">
  287. <pre class="smallexample">#1 0x08048361 in call_me (i=&hellip;, s=&hellip;, ss=&hellip;, u=&hellip;, e=&hellip;)
  288. at frame-args.c:23
  289. </pre></div>
  290. </dd>
  291. <dt><code>presence</code></dt>
  292. <dd><p>Only the presence of arguments is indicated by <code>&hellip;</code>.
  293. The <code>&hellip;</code> are not printed for function without any arguments.
  294. None of the argument names and values are printed.
  295. In this case, the example above now becomes:
  296. </p>
  297. <div class="smallexample">
  298. <pre class="smallexample">#1 0x08048361 in call_me (&hellip;) at frame-args.c:23
  299. </pre></div>
  300. </dd>
  301. </dl>
  302. <p>By default, only scalar arguments are printed. This command can be used
  303. to configure the debugger to print the value of all arguments, regardless
  304. of their type. However, it is often advantageous to not print the value
  305. of more complex parameters. For instance, it reduces the amount of
  306. information printed in each frame, making the backtrace more readable.
  307. Also, it improves performance when displaying Ada frames, because
  308. the computation of large arguments can sometimes be CPU-intensive,
  309. especially in large applications. Setting <code>print frame-arguments</code>
  310. to <code>scalars</code> (the default), <code>none</code> or <code>presence</code> avoids
  311. this computation, thus speeding up the display of each Ada frame.
  312. </p>
  313. </dd>
  314. <dt><code>show print frame-arguments</code></dt>
  315. <dd><p>Show how the value of arguments should be displayed when printing a frame.
  316. </p>
  317. <a name="set-print-raw_002dframe_002darguments"></a></dd>
  318. <dt><code>set print raw-frame-arguments on</code></dt>
  319. <dd><p>Print frame arguments in raw, non pretty-printed, form.
  320. </p>
  321. </dd>
  322. <dt><code>set print raw-frame-arguments off</code></dt>
  323. <dd><p>Print frame arguments in pretty-printed form, if there is a pretty-printer
  324. for the value (see <a href="Pretty-Printing.html#Pretty-Printing">Pretty Printing</a>),
  325. otherwise print the value in raw form.
  326. This is the default.
  327. </p>
  328. </dd>
  329. <dt><code>show print raw-frame-arguments</code></dt>
  330. <dd><p>Show whether to print frame arguments in raw form.
  331. </p>
  332. <a name="set-print-entry_002dvalues"></a></dd>
  333. <dt><code>set print entry-values <var>value</var></code></dt>
  334. <dd><a name="index-set-print-entry_002dvalues"></a>
  335. <p>Set printing of frame argument values at function entry. In some cases
  336. <small>GDB</small> can determine the value of function argument which was passed by
  337. the function caller, even if the value was modified inside the called function
  338. and therefore is different. With optimized code, the current value could be
  339. unavailable, but the entry value may still be known.
  340. </p>
  341. <p>The default value is <code>default</code> (see below for its description). Older
  342. <small>GDB</small> behaved as with the setting <code>no</code>. Compilers not supporting
  343. this feature will behave in the <code>default</code> setting the same way as with the
  344. <code>no</code> setting.
  345. </p>
  346. <p>This functionality is currently supported only by DWARF 2 debugging format and
  347. the compiler has to produce &lsquo;<samp>DW_TAG_call_site</samp>&rsquo; tags. With
  348. <small>GCC</small>, you need to specify <samp>-O -g</samp> during compilation, to get
  349. this information.
  350. </p>
  351. <p>The <var>value</var> parameter can be one of the following:
  352. </p>
  353. <dl compact="compact">
  354. <dt><code>no</code></dt>
  355. <dd><p>Print only actual parameter values, never print values from function entry
  356. point.
  357. </p><div class="smallexample">
  358. <pre class="smallexample">#0 equal (val=5)
  359. #0 different (val=6)
  360. #0 lost (val=&lt;optimized out&gt;)
  361. #0 born (val=10)
  362. #0 invalid (val=&lt;optimized out&gt;)
  363. </pre></div>
  364. </dd>
  365. <dt><code>only</code></dt>
  366. <dd><p>Print only parameter values from function entry point. The actual parameter
  367. values are never printed.
  368. </p><div class="smallexample">
  369. <pre class="smallexample">#0 equal (val@entry=5)
  370. #0 different (val@entry=5)
  371. #0 lost (val@entry=5)
  372. #0 born (val@entry=&lt;optimized out&gt;)
  373. #0 invalid (val@entry=&lt;optimized out&gt;)
  374. </pre></div>
  375. </dd>
  376. <dt><code>preferred</code></dt>
  377. <dd><p>Print only parameter values from function entry point. If value from function
  378. entry point is not known while the actual value is known, print the actual
  379. value for such parameter.
  380. </p><div class="smallexample">
  381. <pre class="smallexample">#0 equal (val@entry=5)
  382. #0 different (val@entry=5)
  383. #0 lost (val@entry=5)
  384. #0 born (val=10)
  385. #0 invalid (val@entry=&lt;optimized out&gt;)
  386. </pre></div>
  387. </dd>
  388. <dt><code>if-needed</code></dt>
  389. <dd><p>Print actual parameter values. If actual parameter value is not known while
  390. value from function entry point is known, print the entry point value for such
  391. parameter.
  392. </p><div class="smallexample">
  393. <pre class="smallexample">#0 equal (val=5)
  394. #0 different (val=6)
  395. #0 lost (val@entry=5)
  396. #0 born (val=10)
  397. #0 invalid (val=&lt;optimized out&gt;)
  398. </pre></div>
  399. </dd>
  400. <dt><code>both</code></dt>
  401. <dd><p>Always print both the actual parameter value and its value from function entry
  402. point, even if values of one or both are not available due to compiler
  403. optimizations.
  404. </p><div class="smallexample">
  405. <pre class="smallexample">#0 equal (val=5, val@entry=5)
  406. #0 different (val=6, val@entry=5)
  407. #0 lost (val=&lt;optimized out&gt;, val@entry=5)
  408. #0 born (val=10, val@entry=&lt;optimized out&gt;)
  409. #0 invalid (val=&lt;optimized out&gt;, val@entry=&lt;optimized out&gt;)
  410. </pre></div>
  411. </dd>
  412. <dt><code>compact</code></dt>
  413. <dd><p>Print the actual parameter value if it is known and also its value from
  414. function entry point if it is known. If neither is known, print for the actual
  415. value <code>&lt;optimized out&gt;</code>. If not in MI mode (see <a href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>) and if both
  416. values are known and identical, print the shortened
  417. <code>param=param@entry=VALUE</code> notation.
  418. </p><div class="smallexample">
  419. <pre class="smallexample">#0 equal (val=val@entry=5)
  420. #0 different (val=6, val@entry=5)
  421. #0 lost (val@entry=5)
  422. #0 born (val=10)
  423. #0 invalid (val=&lt;optimized out&gt;)
  424. </pre></div>
  425. </dd>
  426. <dt><code>default</code></dt>
  427. <dd><p>Always print the actual parameter value. Print also its value from function
  428. entry point, but only if it is known. If not in MI mode (see <a href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>) and
  429. if both values are known and identical, print the shortened
  430. <code>param=param@entry=VALUE</code> notation.
  431. </p><div class="smallexample">
  432. <pre class="smallexample">#0 equal (val=val@entry=5)
  433. #0 different (val=6, val@entry=5)
  434. #0 lost (val=&lt;optimized out&gt;, val@entry=5)
  435. #0 born (val=10)
  436. #0 invalid (val=&lt;optimized out&gt;)
  437. </pre></div>
  438. </dd>
  439. </dl>
  440. <p>For analysis messages on possible failures of frame argument values at function
  441. entry resolution see <a href="Tail-Call-Frames.html#set-debug-entry_002dvalues">set debug entry-values</a>.
  442. </p>
  443. </dd>
  444. <dt><code>show print entry-values</code></dt>
  445. <dd><p>Show the method being used for printing of frame argument values at function
  446. entry.
  447. </p>
  448. <a name="set-print-frame_002dinfo"></a></dd>
  449. <dt><code>set print frame-info <var>value</var></code></dt>
  450. <dd><a name="index-set-print-frame_002dinfo"></a>
  451. <a name="index-printing-frame-information"></a>
  452. <a name="index-frame-information_002c-printing"></a>
  453. <p>This command allows to control the information printed when
  454. the debugger prints a frame. See <a href="Frames.html#Frames">Frames</a>, <a href="Backtrace.html#Backtrace">Backtrace</a>,
  455. for a general explanation about frames and frame information.
  456. Note that some other settings (such as <code>set print frame-arguments</code>
  457. and <code>set print address</code>) are also influencing if and how some frame
  458. information is displayed. In particular, the frame program counter is never
  459. printed if <code>set print address</code> is off.
  460. </p>
  461. <p>The possible values for <code>set print frame-info</code> are:
  462. </p><dl compact="compact">
  463. <dt><code>short-location</code></dt>
  464. <dd><p>Print the frame level, the program counter (if not at the
  465. beginning of the location source line), the function, the function
  466. arguments.
  467. </p></dd>
  468. <dt><code>location</code></dt>
  469. <dd><p>Same as <code>short-location</code> but also print the source file and source line
  470. number.
  471. </p></dd>
  472. <dt><code>location-and-address</code></dt>
  473. <dd><p>Same as <code>location</code> but print the program counter even if located at the
  474. beginning of the location source line.
  475. </p></dd>
  476. <dt><code>source-line</code></dt>
  477. <dd><p>Print the program counter (if not at the beginning of the location
  478. source line), the line number and the source line.
  479. </p></dd>
  480. <dt><code>source-and-location</code></dt>
  481. <dd><p>Print what <code>location</code> and <code>source-line</code> are printing.
  482. </p></dd>
  483. <dt><code>auto</code></dt>
  484. <dd><p>The information printed for a frame is decided automatically
  485. by the <small>GDB</small> command that prints a frame.
  486. For example, <code>frame</code> prints the information printed by
  487. <code>source-and-location</code> while <code>stepi</code> will switch between
  488. <code>source-line</code> and <code>source-and-location</code> depending on the program
  489. counter.
  490. The default value is <code>auto</code>.
  491. </p></dd>
  492. </dl>
  493. <a name="set-print-repeats"></a></dd>
  494. <dt><code>set print repeats <var>number-of-repeats</var></code></dt>
  495. <dt><code>set print repeats unlimited</code></dt>
  496. <dd><a name="index-repeated-array-elements"></a>
  497. <p>Set the threshold for suppressing display of repeated array
  498. elements. When the number of consecutive identical elements of an
  499. array exceeds the threshold, <small>GDB</small> prints the string
  500. <code>&quot;&lt;repeats <var>n</var> times&gt;&quot;</code>, where <var>n</var> is the number of
  501. identical repetitions, instead of displaying the identical elements
  502. themselves. Setting the threshold to <code>unlimited</code> or zero will
  503. cause all elements to be individually printed. The default threshold
  504. is 10.
  505. </p>
  506. </dd>
  507. <dt><code>show print repeats</code></dt>
  508. <dd><p>Display the current threshold for printing repeated identical
  509. elements.
  510. </p>
  511. <a name="set-print-max_002ddepth"></a></dd>
  512. <dt><code>set print max-depth <var>depth</var></code></dt>
  513. <dt><code>set print max-depth unlimited</code></dt>
  514. <dd><a name="index-printing-nested-structures"></a>
  515. <p>Set the threshold after which nested structures are replaced with
  516. ellipsis, this can make visualising deeply nested structures easier.
  517. </p>
  518. <p>For example, given this C code
  519. </p>
  520. <div class="smallexample">
  521. <pre class="smallexample">typedef struct s1 { int a; } s1;
  522. typedef struct s2 { s1 b; } s2;
  523. typedef struct s3 { s2 c; } s3;
  524. typedef struct s4 { s3 d; } s4;
  525. s4 var = { { { { 3 } } } };
  526. </pre></div>
  527. <p>The following table shows how different values of <var>depth</var> will
  528. effect how <code>var</code> is printed by <small>GDB</small>:
  529. </p>
  530. <table>
  531. <thead><tr><th width="30%"><var>depth</var> setting</th><th width="70%">Result of &lsquo;<samp>p var</samp>&rsquo;</th></tr></thead>
  532. <tr><td width="30%">unlimited</td><td width="70%"><code>$1 = {d = {c = {b = {a = 3}}}}</code></td></tr>
  533. <tr><td width="30%"><code>0</code></td><td width="70%"><code>$1 = {...}</code></td></tr>
  534. <tr><td width="30%"><code>1</code></td><td width="70%"><code>$1 = {d = {...}}</code></td></tr>
  535. <tr><td width="30%"><code>2</code></td><td width="70%"><code>$1 = {d = {c = {...}}}</code></td></tr>
  536. <tr><td width="30%"><code>3</code></td><td width="70%"><code>$1 = {d = {c = {b = {...}}}}</code></td></tr>
  537. <tr><td width="30%"><code>4</code></td><td width="70%"><code>$1 = {d = {c = {b = {a = 3}}}}</code></td></tr>
  538. </table>
  539. <p>To see the contents of structures that have been hidden the user can
  540. either increase the print max-depth, or they can print the elements of
  541. the structure that are visible, for example
  542. </p>
  543. <div class="smallexample">
  544. <pre class="smallexample">(gdb) set print max-depth 2
  545. (gdb) p var
  546. $1 = {d = {c = {...}}}
  547. (gdb) p var.d
  548. $2 = {c = {b = {...}}}
  549. (gdb) p var.d.c
  550. $3 = {b = {a = 3}}
  551. </pre></div>
  552. <p>The pattern used to replace nested structures varies based on
  553. language, for most languages <code>{...}</code> is used, but Fortran uses
  554. <code>(...)</code>.
  555. </p>
  556. </dd>
  557. <dt><code>show print max-depth</code></dt>
  558. <dd><p>Display the current threshold after which nested structures are
  559. replaces with ellipsis.
  560. </p>
  561. <a name="set-print-null_002dstop"></a></dd>
  562. <dt><code>set print null-stop</code></dt>
  563. <dd><a name="index-NULL-elements-in-arrays"></a>
  564. <p>Cause <small>GDB</small> to stop printing the characters of an array when the first
  565. <small>NULL</small> is encountered. This is useful when large arrays actually
  566. contain only short strings.
  567. The default is off.
  568. </p>
  569. </dd>
  570. <dt><code>show print null-stop</code></dt>
  571. <dd><p>Show whether <small>GDB</small> stops printing an array on the first
  572. <small>NULL</small> character.
  573. </p>
  574. <a name="set-print-pretty"></a></dd>
  575. <dt><code>set print pretty on</code></dt>
  576. <dd><a name="index-print-structures-in-indented-form"></a>
  577. <a name="index-indentation-in-structure-display"></a>
  578. <p>Cause <small>GDB</small> to print structures in an indented format with one member
  579. per line, like this:
  580. </p>
  581. <div class="smallexample">
  582. <pre class="smallexample">$1 = {
  583. next = 0x0,
  584. flags = {
  585. sweet = 1,
  586. sour = 1
  587. },
  588. meat = 0x54 &quot;Pork&quot;
  589. }
  590. </pre></div>
  591. </dd>
  592. <dt><code>set print pretty off</code></dt>
  593. <dd><p>Cause <small>GDB</small> to print structures in a compact format, like this:
  594. </p>
  595. <div class="smallexample">
  596. <pre class="smallexample">$1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  597. meat = 0x54 &quot;Pork&quot;}
  598. </pre></div>
  599. <p>This is the default format.
  600. </p>
  601. </dd>
  602. <dt><code>show print pretty</code></dt>
  603. <dd><p>Show which format <small>GDB</small> is using to print structures.
  604. </p>
  605. <a name="set-print-raw_002dvalues"></a></dd>
  606. <dt><code>set print raw-values on</code></dt>
  607. <dd><p>Print values in raw form, without applying the pretty
  608. printers for the value.
  609. </p>
  610. </dd>
  611. <dt><code>set print raw-values off</code></dt>
  612. <dd><p>Print values in pretty-printed form, if there is a pretty-printer
  613. for the value (see <a href="Pretty-Printing.html#Pretty-Printing">Pretty Printing</a>),
  614. otherwise print the value in raw form.
  615. </p>
  616. <p>The default setting is &ldquo;off&rdquo;.
  617. </p>
  618. </dd>
  619. <dt><code>show print raw-values</code></dt>
  620. <dd><p>Show whether to print values in raw form.
  621. </p>
  622. </dd>
  623. <dt><code>set print sevenbit-strings on</code></dt>
  624. <dd><a name="index-eight_002dbit-characters-in-strings"></a>
  625. <a name="index-octal-escapes-in-strings"></a>
  626. <p>Print using only seven-bit characters; if this option is set,
  627. <small>GDB</small> displays any eight-bit characters (in strings or
  628. character values) using the notation <code>\</code><var>nnn</var>. This setting is
  629. best if you are working in English (<small>ASCII</small>) and you use the
  630. high-order bit of characters as a marker or &ldquo;meta&rdquo; bit.
  631. </p>
  632. </dd>
  633. <dt><code>set print sevenbit-strings off</code></dt>
  634. <dd><p>Print full eight-bit characters. This allows the use of more
  635. international character sets, and is the default.
  636. </p>
  637. </dd>
  638. <dt><code>show print sevenbit-strings</code></dt>
  639. <dd><p>Show whether or not <small>GDB</small> is printing only seven-bit characters.
  640. </p>
  641. <a name="set-print-union"></a></dd>
  642. <dt><code>set print union on</code></dt>
  643. <dd><a name="index-unions-in-structures_002c-printing"></a>
  644. <p>Tell <small>GDB</small> to print unions which are contained in structures
  645. and other unions. This is the default setting.
  646. </p>
  647. </dd>
  648. <dt><code>set print union off</code></dt>
  649. <dd><p>Tell <small>GDB</small> not to print unions which are contained in
  650. structures and other unions. <small>GDB</small> will print <code>&quot;{...}&quot;</code>
  651. instead.
  652. </p>
  653. </dd>
  654. <dt><code>show print union</code></dt>
  655. <dd><p>Ask <small>GDB</small> whether or not it will print unions which are contained in
  656. structures and other unions.
  657. </p>
  658. <p>For example, given the declarations
  659. </p>
  660. <div class="smallexample">
  661. <pre class="smallexample">typedef enum {Tree, Bug} Species;
  662. typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  663. typedef enum {Caterpillar, Cocoon, Butterfly}
  664. Bug_forms;
  665. struct thing {
  666. Species it;
  667. union {
  668. Tree_forms tree;
  669. Bug_forms bug;
  670. } form;
  671. };
  672. struct thing foo = {Tree, {Acorn}};
  673. </pre></div>
  674. <p>with <code>set print union on</code> in effect &lsquo;<samp>p foo</samp>&rsquo; would print
  675. </p>
  676. <div class="smallexample">
  677. <pre class="smallexample">$1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  678. </pre></div>
  679. <p>and with <code>set print union off</code> in effect it would print
  680. </p>
  681. <div class="smallexample">
  682. <pre class="smallexample">$1 = {it = Tree, form = {...}}
  683. </pre></div>
  684. <p><code>set print union</code> affects programs written in C-like languages
  685. and in Pascal.
  686. </p></dd>
  687. </dl>
  688. <p>These settings are of interest when debugging C<tt>++</tt> programs:
  689. </p>
  690. <dl compact="compact">
  691. <dd><a name="index-demangling-C_002b_002b-names"></a>
  692. </dd>
  693. <dt><code>set print demangle</code></dt>
  694. <dt><code>set print demangle on</code></dt>
  695. <dd><p>Print C<tt>++</tt> names in their source form rather than in the encoded
  696. (&ldquo;mangled&rdquo;) form passed to the assembler and linker for type-safe
  697. linkage. The default is on.
  698. </p>
  699. </dd>
  700. <dt><code>show print demangle</code></dt>
  701. <dd><p>Show whether C<tt>++</tt> names are printed in mangled or demangled form.
  702. </p>
  703. </dd>
  704. <dt><code>set print asm-demangle</code></dt>
  705. <dt><code>set print asm-demangle on</code></dt>
  706. <dd><p>Print C<tt>++</tt> names in their source form rather than their mangled form, even
  707. in assembler code printouts such as instruction disassemblies.
  708. The default is off.
  709. </p>
  710. </dd>
  711. <dt><code>show print asm-demangle</code></dt>
  712. <dd><p>Show whether C<tt>++</tt> names in assembly listings are printed in mangled
  713. or demangled form.
  714. </p>
  715. <a name="index-C_002b_002b-symbol-decoding-style"></a>
  716. <a name="index-symbol-decoding-style_002c-C_002b_002b"></a>
  717. <a name="index-set-demangle_002dstyle"></a>
  718. </dd>
  719. <dt><code>set demangle-style <var>style</var></code></dt>
  720. <dd><p>Choose among several encoding schemes used by different compilers to represent
  721. C<tt>++</tt> names. If you omit <var>style</var>, you will see a list of possible
  722. formats. The default value is <var>auto</var>, which lets <small>GDB</small> choose a
  723. decoding style by inspecting your program.
  724. </p>
  725. </dd>
  726. <dt><code>show demangle-style</code></dt>
  727. <dd><p>Display the encoding style currently in use for decoding C<tt>++</tt> symbols.
  728. </p>
  729. <a name="set-print-object"></a></dd>
  730. <dt><code>set print object</code></dt>
  731. <dt><code>set print object on</code></dt>
  732. <dd><a name="index-derived-type-of-an-object_002c-printing"></a>
  733. <a name="index-display-derived-types"></a>
  734. <p>When displaying a pointer to an object, identify the <em>actual</em>
  735. (derived) type of the object rather than the <em>declared</em> type, using
  736. the virtual function table. Note that the virtual function table is
  737. required&mdash;this feature can only work for objects that have run-time
  738. type identification; a single virtual method in the object&rsquo;s declared
  739. type is sufficient. Note that this setting is also taken into account when
  740. working with variable objects via MI (see <a href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>).
  741. </p>
  742. </dd>
  743. <dt><code>set print object off</code></dt>
  744. <dd><p>Display only the declared type of objects, without reference to the
  745. virtual function table. This is the default setting.
  746. </p>
  747. </dd>
  748. <dt><code>show print object</code></dt>
  749. <dd><p>Show whether actual, or declared, object types are displayed.
  750. </p>
  751. <a name="set-print-static_002dmembers"></a></dd>
  752. <dt><code>set print static-members</code></dt>
  753. <dt><code>set print static-members on</code></dt>
  754. <dd><a name="index-static-members-of-C_002b_002b-objects"></a>
  755. <p>Print static members when displaying a C<tt>++</tt> object. The default is on.
  756. </p>
  757. </dd>
  758. <dt><code>set print static-members off</code></dt>
  759. <dd><p>Do not print static members when displaying a C<tt>++</tt> object.
  760. </p>
  761. </dd>
  762. <dt><code>show print static-members</code></dt>
  763. <dd><p>Show whether C<tt>++</tt> static members are printed or not.
  764. </p>
  765. </dd>
  766. <dt><code>set print pascal_static-members</code></dt>
  767. <dt><code>set print pascal_static-members on</code></dt>
  768. <dd><a name="index-static-members-of-Pascal-objects"></a>
  769. <a name="index-Pascal-objects_002c-static-members-display"></a>
  770. <p>Print static members when displaying a Pascal object. The default is on.
  771. </p>
  772. </dd>
  773. <dt><code>set print pascal_static-members off</code></dt>
  774. <dd><p>Do not print static members when displaying a Pascal object.
  775. </p>
  776. </dd>
  777. <dt><code>show print pascal_static-members</code></dt>
  778. <dd><p>Show whether Pascal static members are printed or not.
  779. </p>
  780. <a name="set-print-vtbl"></a></dd>
  781. <dt><code>set print vtbl</code></dt>
  782. <dt><code>set print vtbl on</code></dt>
  783. <dd><a name="index-pretty-print-C_002b_002b-virtual-function-tables"></a>
  784. <a name="index-virtual-functions-_0028C_002b_002b_0029-display"></a>
  785. <a name="index-VTBL-display"></a>
  786. <p>Pretty print C<tt>++</tt> virtual function tables. The default is off.
  787. (The <code>vtbl</code> commands do not work on programs compiled with the HP
  788. ANSI C<tt>++</tt> compiler (<code>aCC</code>).)
  789. </p>
  790. </dd>
  791. <dt><code>set print vtbl off</code></dt>
  792. <dd><p>Do not pretty print C<tt>++</tt> virtual function tables.
  793. </p>
  794. </dd>
  795. <dt><code>show print vtbl</code></dt>
  796. <dd><p>Show whether C<tt>++</tt> virtual function tables are pretty printed, or not.
  797. </p></dd>
  798. </dl>
  799. <hr>
  800. <div class="header">
  801. <p>
  802. Next: <a href="Pretty-Printing.html#Pretty-Printing" accesskey="n" rel="next">Pretty Printing</a>, Previous: <a href="Auto-Display.html#Auto-Display" accesskey="p" rel="previous">Auto Display</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</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>
  803. </div>
  804. </body>
  805. </html>