1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Maintenance Commands</title> 18 19<meta name="description" content="Debugging with GDB: Maintenance Commands"> 20<meta name="keywords" content="Debugging with GDB: Maintenance Commands"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="index.html#Top" rel="up" title="Top"> 29<link href="Remote-Protocol.html#Remote-Protocol" rel="next" title="Remote Protocol"> 30<link href="System_002dwide-Configuration-Scripts.html#System_002dwide-Configuration-Scripts" rel="previous" title="System-wide Configuration Scripts"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Maintenance-Commands"></a> 65<div class="header"> 66<p> 67Next: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="n" rel="next">Remote Protocol</a>, Previous: <a href="Installing-GDB.html#Installing-GDB" accesskey="p" rel="previous">Installing GDB</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 68</div> 69<hr> 70<a name="Maintenance-Commands-1"></a> 71<h2 class="appendix">Appendix D Maintenance Commands</h2> 72<a name="index-maintenance-commands"></a> 73<a name="index-internal-commands"></a> 74 75<p>In addition to commands intended for <small>GDB</small> users, <small>GDB</small> 76includes a number of commands intended for <small>GDB</small> developers, 77that are not documented elsewhere in this manual. These commands are 78provided here for reference. (For commands that turn on debugging 79messages, see <a href="Debugging-Output.html#Debugging-Output">Debugging Output</a>.) 80</p> 81<dl compact="compact"> 82<dd><a name="index-maint-agent"></a> 83<a name="index-maint-agent_002deval"></a> 84</dd> 85<dt><code>maint agent <span class="roman">[</span>-at <var>location</var><span class="roman">,</span><span class="roman">]</span> <var>expression</var></code></dt> 86<dt><code>maint agent-eval <span class="roman">[</span>-at <var>location</var><span class="roman">,</span><span class="roman">]</span> <var>expression</var></code></dt> 87<dd><p>Translate the given <var>expression</var> into remote agent bytecodes. 88This command is useful for debugging the Agent Expression mechanism 89(see <a href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>). The ‘<samp>agent</samp>’ version produces an 90expression useful for data collection, such as by tracepoints, while 91‘<samp>maint agent-eval</samp>’ produces an expression that evaluates directly 92to a result. For instance, a collection expression for <code>globa + 93globb</code> will include bytecodes to record four bytes of memory at each 94of the addresses of <code>globa</code> and <code>globb</code>, while discarding 95the result of the addition, while an evaluation expression will do the 96addition and return the sum. 97If <code>-at</code> is given, generate remote agent bytecode for <var>location</var>. 98If not, generate remote agent bytecode for current frame PC address. 99</p> 100<a name="index-maint-agent_002dprintf"></a> 101</dd> 102<dt><code>maint agent-printf <var>format</var>,<var>expr</var>,...</code></dt> 103<dd><p>Translate the given format string and list of argument expressions 104into remote agent bytecodes and display them as a disassembled list. 105This command is useful for debugging the agent version of dynamic 106printf (see <a href="Dynamic-printf.html#Dynamic-printf">Dynamic printf</a>). 107</p> 108<a name="index-maint-info-breakpoints"></a> 109</dd> 110<dt><code><a name="maint-info-breakpoints"></a>maint info breakpoints</code></dt> 111<dd><p>Using the same format as ‘<samp>info breakpoints</samp>’, display both the 112breakpoints you’ve set explicitly, and those <small>GDB</small> is using for 113internal purposes. Internal breakpoints are shown with negative 114breakpoint numbers. The type column identifies what kind of breakpoint 115is shown: 116</p> 117<dl compact="compact"> 118<dt><code>breakpoint</code></dt> 119<dd><p>Normal, explicitly set breakpoint. 120</p> 121</dd> 122<dt><code>watchpoint</code></dt> 123<dd><p>Normal, explicitly set watchpoint. 124</p> 125</dd> 126<dt><code>longjmp</code></dt> 127<dd><p>Internal breakpoint, used to handle correctly stepping through 128<code>longjmp</code> calls. 129</p> 130</dd> 131<dt><code>longjmp resume</code></dt> 132<dd><p>Internal breakpoint at the target of a <code>longjmp</code>. 133</p> 134</dd> 135<dt><code>until</code></dt> 136<dd><p>Temporary internal breakpoint used by the <small>GDB</small> <code>until</code> command. 137</p> 138</dd> 139<dt><code>finish</code></dt> 140<dd><p>Temporary internal breakpoint used by the <small>GDB</small> <code>finish</code> command. 141</p> 142</dd> 143<dt><code>shlib events</code></dt> 144<dd><p>Shared library events. 145</p> 146</dd> 147</dl> 148 149<a name="index-maint-info-btrace"></a> 150</dd> 151<dt><code>maint info btrace</code></dt> 152<dd><p>Pint information about raw branch tracing data. 153</p> 154<a name="index-maint-btrace-packet_002dhistory"></a> 155</dd> 156<dt><code>maint btrace packet-history</code></dt> 157<dd><p>Print the raw branch trace packets that are used to compute the 158execution history for the ‘<samp>record btrace</samp>’ command. Both the 159information and the format in which it is printed depend on the btrace 160recording format. 161</p> 162<dl compact="compact"> 163<dt><code>bts</code></dt> 164<dd><p>For the BTS recording format, print a list of blocks of sequential 165code. For each block, the following information is printed: 166</p> 167<dl compact="compact"> 168<dt>Block number</dt> 169<dd><p>Newer blocks have higher numbers. The oldest block has number zero. 170</p></dd> 171<dt>Lowest ‘<samp>PC</samp>’</dt> 172<dt>Highest ‘<samp>PC</samp>’</dt> 173</dl> 174 175</dd> 176<dt><code>pt</code></dt> 177<dd><p>For the Intel Processor Trace recording format, print a list of 178Intel Processor Trace packets. For each packet, the following 179information is printed: 180</p> 181<dl compact="compact"> 182<dt>Packet number</dt> 183<dd><p>Newer packets have higher numbers. The oldest packet has number zero. 184</p></dd> 185<dt>Trace offset</dt> 186<dd><p>The packet’s offset in the trace stream. 187</p></dd> 188<dt>Packet opcode and payload</dt> 189</dl> 190</dd> 191</dl> 192 193<a name="index-maint-btrace-clear_002dpacket_002dhistory"></a> 194</dd> 195<dt><code>maint btrace clear-packet-history</code></dt> 196<dd><p>Discards the cached packet history printed by the ‘<samp>maint btrace 197packet-history</samp>’ command. The history will be computed again when 198needed. 199</p> 200<a name="index-maint-btrace-clear"></a> 201</dd> 202<dt><code>maint btrace clear</code></dt> 203<dd><p>Discard the branch trace data. The data will be fetched anew and the 204branch trace will be recomputed when needed. 205</p> 206<p>This implicitly truncates the branch trace to a single branch trace 207buffer. When updating branch trace incrementally, the branch trace 208available to <small>GDB</small> may be bigger than a single branch trace 209buffer. 210</p> 211<a name="index-maint-set-btrace-pt-skip_002dpad"></a> 212</dd> 213<dt><code>maint set btrace pt skip-pad</code></dt> 214<dd><a name="index-maint-show-btrace-pt-skip_002dpad"></a> 215</dd> 216<dt><code>maint show btrace pt skip-pad</code></dt> 217<dd><p>Control whether <small>GDB</small> will skip PAD packets when computing the 218packet history. 219</p> 220<a name="index-set-displaced_002dstepping"></a> 221<a name="index-show-displaced_002dstepping"></a> 222<a name="index-displaced-stepping-support"></a> 223<a name="index-out_002dof_002dline-single_002dstepping"></a> 224</dd> 225<dt><code>set displaced-stepping</code></dt> 226<dt><code>show displaced-stepping</code></dt> 227<dd><p>Control whether or not <small>GDB</small> will do <em>displaced stepping</em> 228if the target supports it. Displaced stepping is a way to single-step 229over breakpoints without removing them from the inferior, by executing 230an out-of-line copy of the instruction that was originally at the 231breakpoint location. It is also known as out-of-line single-stepping. 232</p> 233<dl compact="compact"> 234<dt><code>set displaced-stepping on</code></dt> 235<dd><p>If the target architecture supports it, <small>GDB</small> will use 236displaced stepping to step over breakpoints. 237</p> 238</dd> 239<dt><code>set displaced-stepping off</code></dt> 240<dd><p><small>GDB</small> will not use displaced stepping to step over breakpoints, 241even if such is supported by the target architecture. 242</p> 243<a name="index-non_002dstop-mode_002c-and-set-displaced_002dstepping"></a> 244</dd> 245<dt><code>set displaced-stepping auto</code></dt> 246<dd><p>This is the default mode. <small>GDB</small> will use displaced stepping 247only if non-stop mode is active (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>) and the target 248architecture supports displaced stepping. 249</p></dd> 250</dl> 251 252<a name="index-maint-check_002dpsymtabs"></a> 253</dd> 254<dt><code>maint check-psymtabs</code></dt> 255<dd><p>Check the consistency of currently expanded psymtabs versus symtabs. 256Use this to check, for example, whether a symbol is in one but not the other. 257</p> 258<a name="index-maint-check_002dsymtabs"></a> 259</dd> 260<dt><code>maint check-symtabs</code></dt> 261<dd><p>Check the consistency of currently expanded symtabs. 262</p> 263<a name="index-maint-expand_002dsymtabs"></a> 264</dd> 265<dt><code>maint expand-symtabs [<var>regexp</var>]</code></dt> 266<dd><p>Expand symbol tables. 267If <var>regexp</var> is specified, only expand symbol tables for file 268names matching <var>regexp</var>. 269</p> 270<a name="index-maint-set-catch_002ddemangler_002dcrashes"></a> 271<a name="index-maint-show-catch_002ddemangler_002dcrashes"></a> 272<a name="index-demangler-crashes"></a> 273</dd> 274<dt><code>maint set catch-demangler-crashes [on|off]</code></dt> 275<dt><code>maint show catch-demangler-crashes</code></dt> 276<dd><p>Control whether <small>GDB</small> should attempt to catch crashes in the 277symbol name demangler. The default is to attempt to catch crashes. 278If enabled, the first time a crash is caught, a core file is created, 279the offending symbol is displayed and the user is presented with the 280option to terminate the current session. 281</p> 282<a name="index-maint-cplus-first_005fcomponent"></a> 283</dd> 284<dt><code>maint cplus first_component <var>name</var></code></dt> 285<dd><p>Print the first C<tt>++</tt> class/namespace component of <var>name</var>. 286</p> 287<a name="index-maint-cplus-namespace"></a> 288</dd> 289<dt><code>maint cplus namespace</code></dt> 290<dd><p>Print the list of possible C<tt>++</tt> namespaces. 291</p> 292<a name="index-maint-deprecate"></a> 293<a name="index-maint-undeprecate"></a> 294<a name="index-deprecated-commands"></a> 295</dd> 296<dt><code>maint deprecate <var>command</var> <span class="roman">[</span><var>replacement</var><span class="roman">]</span></code></dt> 297<dt><code>maint undeprecate <var>command</var></code></dt> 298<dd><p>Deprecate or undeprecate the named <var>command</var>. Deprecated commands 299cause <small>GDB</small> to issue a warning when you use them. The optional 300argument <var>replacement</var> says which newer command should be used in 301favor of the deprecated one; if it is given, <small>GDB</small> will mention 302the replacement as part of the warning. 303</p> 304<a name="index-maint-dump_002dme"></a> 305</dd> 306<dt><code>maint dump-me</code></dt> 307<dd><a name="index-SIGQUIT-signal_002c-dump-core-of-GDB"></a> 308<p>Cause a fatal signal in the debugger and force it to dump its core. 309This is supported only on systems which support aborting a program 310with the <code>SIGQUIT</code> signal. 311</p> 312<a name="index-maint-internal_002derror"></a> 313<a name="index-maint-internal_002dwarning"></a> 314<a name="index-maint-demangler_002dwarning"></a> 315<a name="index-demangler-crashes-1"></a> 316</dd> 317<dt><code>maint internal-error <span class="roman">[</span><var>message-text</var><span class="roman">]</span></code></dt> 318<dt><code>maint internal-warning <span class="roman">[</span><var>message-text</var><span class="roman">]</span></code></dt> 319<dt><code>maint demangler-warning <span class="roman">[</span><var>message-text</var><span class="roman">]</span></code></dt> 320<dd> 321<p>Cause <small>GDB</small> to call the internal function <code>internal_error</code>, 322<code>internal_warning</code> or <code>demangler_warning</code> and hence behave 323as though an internal problem has been detected. In addition to 324reporting the internal problem, these functions give the user the 325opportunity to either quit <small>GDB</small> or (for <code>internal_error</code> 326and <code>internal_warning</code>) create a core file of the current 327<small>GDB</small> session. 328</p> 329<p>These commands take an optional parameter <var>message-text</var> that is 330used as the text of the error or warning message. 331</p> 332<p>Here’s an example of using <code>internal-error</code>: 333</p> 334<div class="smallexample"> 335<pre class="smallexample">(gdb) <kbd>maint internal-error testing, 1, 2</kbd> 336…/maint.c:121: internal-error: testing, 1, 2 337A problem internal to GDB has been detected. Further 338debugging may prove unreliable. 339Quit this debugging session? (y or n) <kbd>n</kbd> 340Create a core file? (y or n) <kbd>n</kbd> 341(gdb) 342</pre></div> 343 344<a name="index-GDB-internal-error"></a> 345<a name="index-internal-errors_002c-control-of-GDB-behavior"></a> 346<a name="index-demangler-crashes-2"></a> 347 348<a name="index-maint-set-internal_002derror"></a> 349<a name="index-maint-show-internal_002derror"></a> 350<a name="index-maint-set-internal_002dwarning"></a> 351<a name="index-maint-show-internal_002dwarning"></a> 352<a name="index-maint-set-demangler_002dwarning"></a> 353<a name="index-maint-show-demangler_002dwarning"></a> 354</dd> 355<dt><code>maint set internal-error <var>action</var> [ask|yes|no]</code></dt> 356<dt><code>maint show internal-error <var>action</var></code></dt> 357<dt><code>maint set internal-warning <var>action</var> [ask|yes|no]</code></dt> 358<dt><code>maint show internal-warning <var>action</var></code></dt> 359<dt><code>maint set demangler-warning <var>action</var> [ask|yes|no]</code></dt> 360<dt><code>maint show demangler-warning <var>action</var></code></dt> 361<dd><p>When <small>GDB</small> reports an internal problem (error or warning) it 362gives the user the opportunity to both quit <small>GDB</small> and create a 363core file of the current <small>GDB</small> session. These commands let you 364override the default behaviour for each particular <var>action</var>, 365described in the table below. 366</p> 367<dl compact="compact"> 368<dt>‘<samp>quit</samp>’</dt> 369<dd><p>You can specify that <small>GDB</small> should always (yes) or never (no) 370quit. The default is to ask the user what to do. 371</p> 372</dd> 373<dt>‘<samp>corefile</samp>’</dt> 374<dd><p>You can specify that <small>GDB</small> should always (yes) or never (no) 375create a core file. The default is to ask the user what to do. Note 376that there is no <code>corefile</code> option for <code>demangler-warning</code>: 377demangler warnings always create a core file and this cannot be 378disabled. 379</p></dd> 380</dl> 381 382<a name="index-maint-packet"></a> 383</dd> 384<dt><code>maint packet <var>text</var></code></dt> 385<dd><p>If <small>GDB</small> is talking to an inferior via the serial protocol, 386then this command sends the string <var>text</var> to the inferior, and 387displays the response packet. <small>GDB</small> supplies the initial 388‘<samp>$</samp>’ character, the terminating ‘<samp>#</samp>’ character, and the 389checksum. 390</p> 391<a name="index-maint-print-architecture"></a> 392</dd> 393<dt><code>maint print architecture <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 394<dd><p>Print the entire architecture configuration. The optional argument 395<var>file</var> names the file where the output goes. 396</p> 397<a name="index-maint-print-c_002dtdesc-_005bfile_005d"></a> 398</dd> 399<dt><code>maint print c-tdesc</code></dt> 400<dd><p>Print the target description (see <a href="Target-Descriptions.html#Target-Descriptions">Target Descriptions</a>) as 401a C source file. By default, the target description is for the current 402target, but if the optional argument <var>file</var> is provided, that file 403is used to produce the description. The <var>file</var> should be an XML 404document, of the form described in <a href="Target-Description-Format.html#Target-Description-Format">Target Description Format</a>. 405The created source file is built into <small>GDB</small> when <small>GDB</small> is 406built again. This command is used by developers after they add or 407modify XML target descriptions. 408</p> 409<a name="index-maint-print-xml_002dtdesc"></a> 410</dd> 411<dt><code>maint print xml-tdesc <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 412<dd><p>Print the target description (see <a href="Target-Descriptions.html#Target-Descriptions">Target Descriptions</a>) as an XML 413file. By default print the target description for the current target, 414but if the optional argument <var>file</var> is provided, then that file is 415read in by GDB and then used to produce the description. The 416<var>file</var> should be an XML document, of the form described in 417<a href="Target-Description-Format.html#Target-Description-Format">Target Description Format</a>. 418</p> 419<a name="index-maint-check-xml_002ddescriptions"></a> 420</dd> 421<dt><code>maint check xml-descriptions <var>dir</var></code></dt> 422<dd><p>Check that the target descriptions dynamically created by <small>GDB</small> 423equal the descriptions created from XML files found in <var>dir</var>. 424</p> 425<a name="maint-check-libthread_002ddb"></a><a name="index-maint-check-libthread_002ddb"></a> 426</dd> 427<dt><code>maint check libthread-db</code></dt> 428<dd><p>Run integrity checks on the current inferior’s thread debugging 429library. This exercises all <code>libthread_db</code> functionality used by 430<small>GDB</small> on GNU/Linux systems, and by extension also exercises the 431<code>proc_service</code> functions provided by <small>GDB</small> that 432<code>libthread_db</code> uses. Note that parts of the test may be skipped 433on some platforms when debugging core files. 434</p> 435<a name="index-maint-print-core_002dfile_002dbacked_002dmappings"></a> 436<a name="index-memory-address-space-mappings-1"></a> 437</dd> 438<dt><code>maint print core-file-backed-mappings</code></dt> 439<dd><p>Print the file-backed mappings which were loaded from a core file note. 440This output represents state internal to <small>GDB</small> and should be 441similar to the mappings displayed by the <code>info proc mappings</code> 442command. 443</p> 444<a name="index-maint-print-dummy_002dframes"></a> 445</dd> 446<dt><code>maint print dummy-frames</code></dt> 447<dd><p>Prints the contents of <small>GDB</small>’s internal dummy-frame stack. 448</p> 449<div class="smallexample"> 450<pre class="smallexample">(gdb) <kbd>b add</kbd> 451… 452(gdb) <kbd>print add(2,3)</kbd> 453Breakpoint 2, add (a=2, b=3) at … 45458 return (a + b); 455The program being debugged stopped while in a function called from GDB. 456… 457(gdb) <kbd>maint print dummy-frames</kbd> 4580xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353 459(gdb) 460</pre></div> 461 462<p>Takes an optional file parameter. 463</p> 464<a name="index-maint-print-registers"></a> 465<a name="index-maint-print-raw_002dregisters"></a> 466<a name="index-maint-print-cooked_002dregisters"></a> 467<a name="index-maint-print-register_002dgroups"></a> 468<a name="index-maint-print-remote_002dregisters"></a> 469</dd> 470<dt><code>maint print registers <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 471<dt><code>maint print raw-registers <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 472<dt><code>maint print cooked-registers <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 473<dt><code>maint print register-groups <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 474<dt><code>maint print remote-registers <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 475<dd><p>Print <small>GDB</small>’s internal register data structures. 476</p> 477<p>The command <code>maint print raw-registers</code> includes the contents of 478the raw register cache; the command <code>maint print 479cooked-registers</code> includes the (cooked) value of all registers, 480including registers which aren’t available on the target nor visible 481to user; the command <code>maint print register-groups</code> includes the 482groups that each register is a member of; and the command <code>maint 483print remote-registers</code> includes the remote target’s register numbers 484and offsets in the ‘G’ packets. 485</p> 486<p>These commands take an optional parameter, a file name to which to 487write the information. 488</p> 489<a name="index-maint-print-reggroups"></a> 490</dd> 491<dt><code>maint print reggroups <span class="roman">[</span><var>file</var><span class="roman">]</span></code></dt> 492<dd><p>Print <small>GDB</small>’s internal register group data structures. The 493optional argument <var>file</var> tells to what file to write the 494information. 495</p> 496<p>The register groups info looks like this: 497</p> 498<div class="smallexample"> 499<pre class="smallexample">(gdb) <kbd>maint print reggroups</kbd> 500 Group Type 501 general user 502 float user 503 all user 504 vector user 505 system user 506 save internal 507 restore internal 508</pre></div> 509 510<a name="index-flushregs"></a> 511</dd> 512<dt><code>flushregs</code></dt> 513<dd><p>This command forces <small>GDB</small> to flush its internal register cache. 514</p> 515<a name="index-maint-print-objfiles"></a> 516<a name="index-info-for-known-object-files"></a> 517</dd> 518<dt><code>maint print objfiles <span class="roman">[</span><var>regexp</var><span class="roman">]</span></code></dt> 519<dd><p>Print a dump of all known object files. 520If <var>regexp</var> is specified, only print object files whose names 521match <var>regexp</var>. For each object file, this command prints its name, 522address in memory, and all of its psymtabs and symtabs. 523</p> 524<a name="index-maint-print-user_002dregisters"></a> 525<a name="index-user-registers"></a> 526</dd> 527<dt><code>maint print user-registers</code></dt> 528<dd><p>List all currently available <em>user registers</em>. User registers 529typically provide alternate names for actual hardware registers. They 530include the four “standard” registers <code>$fp</code>, <code>$pc</code>, 531<code>$sp</code>, and <code>$ps</code>. See <a href="Registers.html#standard-registers">standard registers</a>. User 532registers can be used in expressions in the same way as the canonical 533register names, but only the latter are listed by the <code>info 534registers</code> and <code>maint print registers</code> commands. 535</p> 536<a name="index-maint-print-section_002dscripts"></a> 537<a name="index-info-for-known-_002edebug_005fgdb_005fscripts_002dloaded-scripts"></a> 538</dd> 539<dt><code>maint print section-scripts [<var>regexp</var>]</code></dt> 540<dd><p>Print a dump of scripts specified in the <code>.debug_gdb_section</code> section. 541If <var>regexp</var> is specified, only print scripts loaded by object files 542matching <var>regexp</var>. 543For each script, this command prints its name as specified in the objfile, 544and the full path if known. 545See <a href="dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section">dotdebug_gdb_scripts section</a>. 546</p> 547<a name="index-maint-print-statistics"></a> 548<a name="index-bcache-statistics"></a> 549</dd> 550<dt><code>maint print statistics</code></dt> 551<dd><p>This command prints, for each object file in the program, various data 552about that object file followed by the byte cache (<em>bcache</em>) 553statistics for the object file. The objfile data includes the number 554of minimal, partial, full, and stabs symbols, the number of types 555defined by the objfile, the number of as yet unexpanded psym tables, 556the number of line tables and string tables, and the amount of memory 557used by the various tables. The bcache statistics include the counts, 558sizes, and counts of duplicates of all and unique objects, max, 559average, and median entry size, total memory used and its overhead and 560savings, and various measures of the hash table size and chain 561lengths. 562</p> 563<a name="index-maint-print-target_002dstack"></a> 564<a name="index-target-stack-description"></a> 565</dd> 566<dt><code>maint print target-stack</code></dt> 567<dd><p>A <em>target</em> is an interface between the debugger and a particular 568kind of file or process. Targets can be stacked in <em>strata</em>, 569so that more than one target can potentially respond to a request. 570In particular, memory accesses will walk down the stack of targets 571until they find a target that is interested in handling that particular 572address. 573</p> 574<p>This command prints a short description of each layer that was pushed on 575the <em>target stack</em>, starting from the top layer down to the bottom one. 576</p> 577<a name="index-maint-print-type"></a> 578<a name="index-type-chain-of-a-data-type"></a> 579</dd> 580<dt><code>maint print type <var>expr</var></code></dt> 581<dd><p>Print the type chain for a type specified by <var>expr</var>. The argument 582can be either a type name or a symbol. If it is a symbol, the type of 583that symbol is described. The type chain produced by this command is 584a recursive definition of the data type as stored in <small>GDB</small>’s 585data structures, including its flags and contained types. 586</p> 587<a name="index-maint-selftest"></a> 588<a name="index-self-tests"></a> 589</dd> 590<dt><code>maint selftest <span class="roman">[</span><var>filter</var><span class="roman">]</span></code></dt> 591<dd><p>Run any self tests that were compiled in to <small>GDB</small>. This will 592print a message showing how many tests were run, and how many failed. 593If a <var>filter</var> is passed, only the tests with <var>filter</var> in their 594name will by ran. 595</p> 596<a name="index-maint-info-selftests"></a> 597<a name="index-self-tests-1"></a> 598</dd> 599<dt><code>maint info selftests</code></dt> 600<dd><p>List the selftests compiled in to <small>GDB</small>. 601</p> 602<a name="index-maint-set-dwarf-always_002ddisassemble"></a> 603<a name="index-maint-show-dwarf-always_002ddisassemble"></a> 604</dd> 605<dt><code>maint set dwarf always-disassemble</code></dt> 606<dt><code>maint show dwarf always-disassemble</code></dt> 607<dd><p>Control the behavior of <code>info address</code> when using DWARF debugging 608information. 609</p> 610<p>The default is <code>off</code>, which means that <small>GDB</small> should try to 611describe a variable’s location in an easily readable format. When 612<code>on</code>, <small>GDB</small> will instead display the DWARF location 613expression in an assembly-like format. Note that some locations are 614too complex for <small>GDB</small> to describe simply; in this case you will 615always see the disassembly form. 616</p> 617<p>Here is an example of the resulting disassembly: 618</p> 619<div class="smallexample"> 620<pre class="smallexample">(gdb) info addr argc 621Symbol "argc" is a complex DWARF expression: 622 1: DW_OP_fbreg 0 623</pre></div> 624 625<p>For more information on these expressions, see 626<a href="http://www.dwarfstd.org/">the DWARF standard</a>. 627</p> 628<a name="index-maint-set-dwarf-max_002dcache_002dage"></a> 629<a name="index-maint-show-dwarf-max_002dcache_002dage"></a> 630</dd> 631<dt><code>maint set dwarf max-cache-age</code></dt> 632<dt><code>maint show dwarf max-cache-age</code></dt> 633<dd><p>Control the DWARF compilation unit cache. 634</p> 635<a name="index-DWARF-compilation-units-cache"></a> 636<p>In object files with inter-compilation-unit references, such as those 637produced by the GCC option ‘<samp>-feliminate-dwarf2-dups</samp>’, the DWARF 638reader needs to frequently refer to previously read compilation units. 639This setting controls how long a compilation unit will remain in the 640cache if it is not referenced. A higher limit means that cached 641compilation units will be stored in memory longer, and more total 642memory will be used. Setting it to zero disables caching, which will 643slow down <small>GDB</small> startup, but reduce memory consumption. 644</p> 645<a name="index-maint-set-dwarf-unwinders"></a> 646<a name="index-maint-show-dwarf-unwinders"></a> 647</dd> 648<dt><code>maint set dwarf unwinders</code></dt> 649<dt><code>maint show dwarf unwinders</code></dt> 650<dd><p>Control use of the DWARF frame unwinders. 651</p> 652<a name="index-DWARF-frame-unwinders"></a> 653<p>Many targets that support DWARF debugging use <small>GDB</small>’s DWARF 654frame unwinders to build the backtrace. Many of these targets will 655also have a second mechanism for building the backtrace for use in 656cases where DWARF information is not available, this second mechanism 657is often an analysis of a function’s prologue. 658</p> 659<p>In order to extend testing coverage of the second level stack 660unwinding mechanisms it is helpful to be able to disable the DWARF 661stack unwinders, this can be done with this switch. 662</p> 663<p>In normal use of <small>GDB</small> disabling the DWARF unwinders is not 664advisable, there are cases that are better handled through DWARF than 665prologue analysis, and the debug experience is likely to be better 666with the DWARF frame unwinders enabled. 667</p> 668<p>If DWARF frame unwinders are not supported for a particular target 669architecture, then enabling this flag does not cause them to be used. 670</p> 671<a name="index-maint-set-worker_002dthreads"></a> 672<a name="index-maint-show-worker_002dthreads"></a> 673</dd> 674<dt><code>maint set worker-threads</code></dt> 675<dt><code>maint show worker-threads</code></dt> 676<dd><p>Control the number of worker threads that may be used by <small>GDB</small>. 677On capable hosts, <small>GDB</small> may use multiple threads to speed up 678certain CPU-intensive operations, such as demangling symbol names. 679While the number of threads used by <small>GDB</small> may vary, this 680command can be used to set an upper bound on this number. The default 681is <code>unlimited</code>, which lets <small>GDB</small> choose a reasonable 682number. Note that this only controls worker threads started by 683<small>GDB</small> itself; libraries used by <small>GDB</small> may start threads 684of their own. 685</p> 686<a name="index-maint-set-profile"></a> 687<a name="index-maint-show-profile"></a> 688<a name="index-profiling-GDB"></a> 689</dd> 690<dt><code>maint set profile</code></dt> 691<dt><code>maint show profile</code></dt> 692<dd><p>Control profiling of <small>GDB</small>. 693</p> 694<p>Profiling will be disabled until you use the ‘<samp>maint set profile</samp>’ 695command to enable it. When you enable profiling, the system will begin 696collecting timing and execution count data; when you disable profiling or 697exit <small>GDB</small>, the results will be written to a log file. Remember that 698if you use profiling, <small>GDB</small> will overwrite the profiling log file 699(often called <samp>gmon.out</samp>). If you have a record of important profiling 700data in a <samp>gmon.out</samp> file, be sure to move it to a safe location. 701</p> 702<p>Configuring with ‘<samp>--enable-profiling</samp>’ arranges for <small>GDB</small> to be 703compiled with the ‘<samp>-pg</samp>’ compiler option. 704</p> 705<a name="index-maint-set-show_002ddebug_002dregs"></a> 706<a name="index-maint-show-show_002ddebug_002dregs"></a> 707<a name="index-hardware-debug-registers"></a> 708</dd> 709<dt><code>maint set show-debug-regs</code></dt> 710<dt><code>maint show show-debug-regs</code></dt> 711<dd><p>Control whether to show variables that mirror the hardware debug 712registers. Use <code>on</code> to enable, <code>off</code> to disable. If 713enabled, the debug registers values are shown when <small>GDB</small> inserts or 714removes a hardware breakpoint or watchpoint, and when the inferior 715triggers a hardware-assisted breakpoint or watchpoint. 716</p> 717<a name="index-maint-set-show_002dall_002dtib"></a> 718<a name="index-maint-show-show_002dall_002dtib"></a> 719</dd> 720<dt><code>maint set show-all-tib</code></dt> 721<dt><code>maint show show-all-tib</code></dt> 722<dd><p>Control whether to show all non zero areas within a 1k block starting 723at thread local base, when using the ‘<samp>info w32 thread-information-block</samp>’ 724command. 725</p> 726<a name="index-maint-set-target_002dasync"></a> 727<a name="index-maint-show-target_002dasync"></a> 728</dd> 729<dt><code>maint set target-async</code></dt> 730<dt><code>maint show target-async</code></dt> 731<dd><p>This controls whether <small>GDB</small> targets operate in synchronous or 732asynchronous mode (see <a href="Background-Execution.html#Background-Execution">Background Execution</a>). Normally the 733default is asynchronous, if it is available; but this can be changed 734to more easily debug problems occurring only in synchronous mode. 735</p> 736<a name="index-maint-set-target_002dnon_002dstop-mode-_005bon_007coff_007cauto_005d"></a> 737<a name="index-maint-show-target_002dnon_002dstop"></a> 738</dd> 739<dt><code>maint set target-non-stop</code></dt> 740<dt><code>maint show target-non-stop</code></dt> 741<dd> 742<p>This controls whether <small>GDB</small> targets always operate in non-stop 743mode even if <code>set non-stop</code> is <code>off</code> (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>). The default is <code>auto</code>, meaning non-stop mode is enabled 744if supported by the target. 745</p> 746<dl compact="compact"> 747<dt><code>maint set target-non-stop auto</code></dt> 748<dd><p>This is the default mode. <small>GDB</small> controls the target in 749non-stop mode if the target supports it. 750</p> 751</dd> 752<dt><code>maint set target-non-stop on</code></dt> 753<dd><p><small>GDB</small> controls the target in non-stop mode even if the target 754does not indicate support. 755</p> 756</dd> 757<dt><code>maint set target-non-stop off</code></dt> 758<dd><p><small>GDB</small> does not control the target in non-stop mode even if the 759target supports it. 760</p></dd> 761</dl> 762 763<a name="index-maint-set-tui_002dresize_002dmessage"></a> 764<a name="index-maint-show-tui_002dresize_002dmessage"></a> 765</dd> 766<dt><code>maint set tui-resize-message</code></dt> 767<dt><code>maint show tui-resize-message</code></dt> 768<dd><p>Control whether <small>GDB</small> displays a message each time the terminal 769is resized when in TUI mode. The default is <code>off</code>, which means 770that <small>GDB</small> is silent during resizes. When <code>on</code>, 771<small>GDB</small> will display a message after a resize is completed; the 772message will include a number indicating how many times the terminal 773has been resized. This setting is intended for use by the test suite, 774where it would otherwise be difficult to determine when a resize and 775refresh has been completed. 776</p> 777<a name="index-maint-set-per_002dcommand"></a> 778<a name="index-maint-show-per_002dcommand"></a> 779</dd> 780<dt><code>maint set per-command</code></dt> 781<dt><code>maint show per-command</code></dt> 782<dd><a name="index-resources-used-by-commands"></a> 783 784<p><small>GDB</small> can display the resources used by each command. 785This is useful in debugging performance problems. 786</p> 787<dl compact="compact"> 788<dt><code>maint set per-command space [on|off]</code></dt> 789<dt><code>maint show per-command space</code></dt> 790<dd><p>Enable or disable the printing of the memory used by GDB for each command. 791If enabled, <small>GDB</small> will display how much memory each command 792took, following the command’s own output. 793This can also be requested by invoking <small>GDB</small> with the 794<samp>--statistics</samp> command-line switch (see <a href="Mode-Options.html#Mode-Options">Mode Options</a>). 795</p> 796</dd> 797<dt><code>maint set per-command time [on|off]</code></dt> 798<dt><code>maint show per-command time</code></dt> 799<dd><p>Enable or disable the printing of the execution time of <small>GDB</small> 800for each command. 801If enabled, <small>GDB</small> will display how much time it 802took to execute each command, following the command’s own output. 803Both CPU time and wallclock time are printed. 804Printing both is useful when trying to determine whether the cost is 805CPU or, e.g., disk/network latency. 806Note that the CPU time printed is for <small>GDB</small> only, it does not include 807the execution time of the inferior because there’s no mechanism currently 808to compute how much time was spent by <small>GDB</small> and how much time was 809spent by the program been debugged. 810This can also be requested by invoking <small>GDB</small> with the 811<samp>--statistics</samp> command-line switch (see <a href="Mode-Options.html#Mode-Options">Mode Options</a>). 812</p> 813</dd> 814<dt><code>maint set per-command symtab [on|off]</code></dt> 815<dt><code>maint show per-command symtab</code></dt> 816<dd><p>Enable or disable the printing of basic symbol table statistics 817for each command. 818If enabled, <small>GDB</small> will display the following information: 819</p> 820<ol> 821<li> number of symbol tables 822</li><li> number of primary symbol tables 823</li><li> number of blocks in the blockvector 824</li></ol> 825</dd> 826</dl> 827 828<a name="index-maint-set-check_002dlibthread_002ddb"></a> 829<a name="index-maint-show-check_002dlibthread_002ddb"></a> 830</dd> 831<dt><code>maint set check-libthread-db [on|off]</code></dt> 832<dt><code>maint show check-libthread-db</code></dt> 833<dd><p>Control whether <small>GDB</small> should run integrity checks on inferior 834specific thread debugging libraries as they are loaded. The default 835is not to perform such checks. If any check fails <small>GDB</small> will 836unload the library and continue searching for a suitable candidate as 837described in <a href="Threads.html#set-libthread_002ddb_002dsearch_002dpath">set libthread-db-search-path</a>. For more information 838about the tests, see <a href="#maint-check-libthread_002ddb">maint check libthread-db</a>. 839</p> 840<a name="index-maint-space"></a> 841<a name="index-memory-used-by-commands"></a> 842</dd> 843<dt><code>maint space <var>value</var></code></dt> 844<dd><p>An alias for <code>maint set per-command space</code>. 845A non-zero value enables it, zero disables it. 846</p> 847<a name="index-maint-time"></a> 848<a name="index-time-of-command-execution"></a> 849</dd> 850<dt><code>maint time <var>value</var></code></dt> 851<dd><p>An alias for <code>maint set per-command time</code>. 852A non-zero value enables it, zero disables it. 853</p> 854<a name="index-maint-translate_002daddress"></a> 855</dd> 856<dt><code>maint translate-address <span class="roman">[</span><var>section</var><span class="roman">]</span> <var>addr</var></code></dt> 857<dd><p>Find the symbol stored at the location specified by the address 858<var>addr</var> and an optional section name <var>section</var>. If found, 859<small>GDB</small> prints the name of the closest symbol and an offset from 860the symbol’s location to the specified address. This is similar to 861the <code>info address</code> command (see <a href="Symbols.html#Symbols">Symbols</a>), except that this 862command also allows to find symbols in other sections. 863</p> 864<p>If section was not specified, the section in which the symbol was found 865is also printed. For dynamically linked executables, the name of 866executable or shared library containing the symbol is printed as well. 867</p> 868<a name="index-maint-test_002doptions"></a> 869</dd> 870<dt><code>maint test-options require-delimiter</code></dt> 871<dt><code>maint test-options unknown-is-error</code></dt> 872<dt><code>maint test-options unknown-is-operand</code></dt> 873<dd><p>These commands are used by the testsuite to validate the command 874options framework. The <code>require-delimiter</code> variant requires a 875double-dash delimiter to indicate end of options. The 876<code>unknown-is-error</code> and <code>unknown-is-operand</code> do not. The 877<code>unknown-is-error</code> variant throws an error on unknown option, 878while <code>unknown-is-operand</code> treats unknown options as the start of 879the command’s operands. When run, the commands output the result of 880the processed options. When completed, the commands store the 881internal result of completion in a variable exposed by the <code>maint 882show test-options-completion-result</code> command. 883</p> 884<a name="index-maint-show-test_002doptions_002dcompletion_002dresult"></a> 885</dd> 886<dt><code>maint show test-options-completion-result</code></dt> 887<dd><p>Shows the result of completing the <code>maint test-options</code> 888subcommands. This is used by the testsuite to validate completion 889support in the command options framework. 890</p> 891<a name="index-maint-set-test_002dsettings"></a> 892<a name="index-maint-show-test_002dsettings"></a> 893</dd> 894<dt><code>maint set test-settings <var>kind</var></code></dt> 895<dt><code>maint show test-settings <var>kind</var></code></dt> 896<dd><p>These are representative commands for each <var>kind</var> of setting type 897<small>GDB</small> supports. They are used by the testsuite for exercising 898the settings infrastructure. 899</p> 900<a name="index-maint-with"></a> 901</dd> 902<dt><code>maint with <var>setting</var> [<var>value</var>] [-- <var>command</var>]</code></dt> 903<dd><p>Like the <code>with</code> command, but works with <code>maintenance set</code> 904variables. This is used by the testsuite to exercise the <code>with</code> 905command’s infrastructure. 906</p> 907</dd> 908</dl> 909 910<p>The following command is useful for non-interactive invocations of 911<small>GDB</small>, such as in the test suite. 912</p> 913<dl compact="compact"> 914<dt><code>set watchdog <var>nsec</var></code></dt> 915<dd><a name="index-set-watchdog"></a> 916<a name="index-watchdog-timer"></a> 917<a name="index-timeout-for-commands"></a> 918<p>Set the maximum number of seconds <small>GDB</small> will wait for the 919target operation to finish. If this time expires, <small>GDB</small> 920reports and error and the command is aborted. 921</p> 922</dd> 923<dt><code>show watchdog</code></dt> 924<dd><p>Show the current setting of the target wait timeout. 925</p></dd> 926</dl> 927 928<hr> 929<div class="header"> 930<p> 931Next: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="n" rel="next">Remote Protocol</a>, Previous: <a href="Installing-GDB.html#Installing-GDB" accesskey="p" rel="previous">Installing GDB</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 932</div> 933 934 935 936</body> 937</html> 938