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: Help</title> 18 19<meta name="description" content="Debugging with GDB: Help"> 20<meta name="keywords" content="Debugging with GDB: Help"> 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="Commands.html#Commands" rel="up" title="Commands"> 29<link href="Running.html#Running" rel="next" title="Running"> 30<link href="Command-aliases-default-args.html#Command-aliases-default-args" rel="previous" title="Command aliases default args"> 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="Help"></a> 65<div class="header"> 66<p> 67Previous: <a href="Command-aliases-default-args.html#Command-aliases-default-args" accesskey="p" rel="previous">Command aliases default args</a>, Up: <a href="Commands.html#Commands" accesskey="u" rel="up">Commands</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="Getting-Help"></a> 71<h3 class="section">3.6 Getting Help</h3> 72<a name="index-online-documentation"></a> 73<a name="index-help"></a> 74 75<p>You can always ask <small>GDB</small> itself for information on its commands, 76using the command <code>help</code>. 77</p> 78<dl compact="compact"> 79<dd><a name="index-h-_0028help_0029"></a> 80</dd> 81<dt><code>help</code></dt> 82<dt><code>h</code></dt> 83<dd><p>You can use <code>help</code> (abbreviated <code>h</code>) with no arguments to 84display a short list of named classes of commands: 85</p> 86<div class="smallexample"> 87<pre class="smallexample">(gdb) help 88List of classes of commands: 89 90aliases -- User-defined aliases of other commands 91breakpoints -- Making program stop at certain points 92data -- Examining data 93files -- Specifying and examining files 94internals -- Maintenance commands 95obscure -- Obscure features 96running -- Running the program 97stack -- Examining the stack 98status -- Status inquiries 99support -- Support facilities 100tracepoints -- Tracing of program execution without 101 stopping the program 102user-defined -- User-defined commands 103 104Type "help" followed by a class name for a list of 105commands in that class. 106Type "help" followed by command name for full 107documentation. 108Command name abbreviations are allowed if unambiguous. 109(gdb) 110</pre></div> 111 112</dd> 113<dt><code>help <var>class</var></code></dt> 114<dd><p>Using one of the general help classes as an argument, you can get a 115list of the individual commands in that class. If a command has 116aliases, the aliases are given after the command name, separated by 117commas. If an alias has default arguments, the full definition of 118the alias is given after the first line. 119For example, here is the help display for the class <code>status</code>: 120</p> 121<div class="smallexample"> 122<pre class="smallexample">(gdb) help status 123Status inquiries. 124 125List of commands: 126 127info, inf, i -- Generic command for showing things 128 about the program being debugged 129info address, iamain -- Describe where symbol SYM is stored. 130 alias iamain = info address main 131info all-registers -- List of all registers and their contents, 132 for selected stack frame. 133... 134show, info set -- Generic command for showing things 135 about the debugger 136 137Type "help" followed by command name for full 138documentation. 139Command name abbreviations are allowed if unambiguous. 140(gdb) 141</pre></div> 142 143</dd> 144<dt><code>help <var>command</var></code></dt> 145<dd><p>With a command name as <code>help</code> argument, <small>GDB</small> displays a 146short paragraph on how to use that command. If that command has 147one or more aliases, <small>GDB</small> will display a first line with 148the command name and all its aliases separated by commas. 149This first line will be followed by the full definition of all aliases 150having default arguments. 151</p> 152<a name="index-apropos"></a> 153</dd> 154<dt><code>apropos [-v] <var>regexp</var></code></dt> 155<dd><p>The <code>apropos</code> command searches through all of the <small>GDB</small> 156commands, and their documentation, for the regular expression specified in 157<var>args</var>. It prints out all matches found. The optional flag ‘<samp>-v</samp>’, 158which stands for ‘<samp>verbose</samp>’, indicates to output the full documentation 159of the matching commands and highlight the parts of the documentation 160matching <var>regexp</var>. For example: 161</p> 162<div class="smallexample"> 163<pre class="smallexample">apropos alias 164</pre></div> 165 166<p>results in: 167</p> 168<div class="smallexample"> 169<pre class="smallexample">alias -- Define a new command that is an alias of an existing command 170aliases -- User-defined aliases of other commands 171</pre></div> 172 173<p>while 174</p> 175<div class="smallexample"> 176<pre class="smallexample">apropos -v cut.*thread apply 177</pre></div> 178 179<p>results in the below output, where ‘<samp>cut for 'thread apply</samp>’ 180is highlighted if styling is enabled. 181</p> 182<div class="smallexample"> 183<pre class="smallexample">taas -- Apply a command to all threads (ignoring errors 184and empty output). 185Usage: taas COMMAND 186shortcut for 'thread apply all -s COMMAND' 187 188tfaas -- Apply a command to all frames of all threads 189(ignoring errors and empty output). 190Usage: tfaas COMMAND 191shortcut for 'thread apply all -s frame apply all -s COMMAND' 192</pre></div> 193 194<a name="index-complete"></a> 195</dd> 196<dt><code>complete <var>args</var></code></dt> 197<dd><p>The <code>complete <var>args</var></code> command lists all the possible completions 198for the beginning of a command. Use <var>args</var> to specify the beginning of the 199command you want completed. For example: 200</p> 201<div class="smallexample"> 202<pre class="smallexample">complete i 203</pre></div> 204 205<p>results in: 206</p> 207<div class="smallexample"> 208<pre class="smallexample">if 209ignore 210info 211inspect 212</pre></div> 213 214<p>This is intended for use by <small>GNU</small> Emacs. 215</p></dd> 216</dl> 217 218<p>In addition to <code>help</code>, you can use the <small>GDB</small> commands <code>info</code> 219and <code>show</code> to inquire about the state of your program, or the state 220of <small>GDB</small> itself. Each command supports many topics of inquiry; this 221manual introduces each of them in the appropriate context. The listings 222under <code>info</code> and under <code>show</code> in the Command, Variable, and 223Function Index point to all the sub-commands. See <a href="Command-and-Variable-Index.html#Command-and-Variable-Index">Command and Variable Index</a>. 224</p> 225<dl compact="compact"> 226<dd><a name="index-info"></a> 227<a name="index-i-_0028info_0029"></a> 228</dd> 229<dt><code>info</code></dt> 230<dd><p>This command (abbreviated <code>i</code>) is for describing the state of your 231program. For example, you can show the arguments passed to a function 232with <code>info args</code>, list the registers currently in use with <code>info 233registers</code>, or list the breakpoints you have set with <code>info breakpoints</code>. 234You can get a complete list of the <code>info</code> sub-commands with 235<code>help info</code><!-- /@w -->. 236</p> 237<a name="index-set"></a> 238</dd> 239<dt><code>set</code></dt> 240<dd><p>You can assign the result of an expression to an environment variable with 241<code>set</code>. For example, you can set the <small>GDB</small> prompt to a $-sign with 242<code>set prompt $</code>. 243</p> 244<a name="index-show"></a> 245</dd> 246<dt><code>show</code></dt> 247<dd><p>In contrast to <code>info</code>, <code>show</code> is for describing the state of 248<small>GDB</small> itself. 249You can change most of the things you can <code>show</code>, by using the 250related command <code>set</code>; for example, you can control what number 251system is used for displays with <code>set radix</code>, or simply inquire 252which is currently in use with <code>show radix</code>. 253</p> 254<a name="index-info-set"></a> 255<p>To display all the settable parameters and their current 256values, you can use <code>show</code> with no arguments; you may also use 257<code>info set</code>. Both commands produce the same display. 258</p></dd> 259</dl> 260 261<p>Here are several miscellaneous <code>show</code> subcommands, all of which are 262exceptional in lacking corresponding <code>set</code> commands: 263</p> 264<dl compact="compact"> 265<dd><a name="index-show-version"></a> 266<a name="index-GDB-version-number"></a> 267</dd> 268<dt><code>show version</code></dt> 269<dd><p>Show what version of <small>GDB</small> is running. You should include this 270information in <small>GDB</small> bug-reports. If multiple versions of 271<small>GDB</small> are in use at your site, you may need to determine which 272version of <small>GDB</small> you are running; as <small>GDB</small> evolves, new 273commands are introduced, and old ones may wither away. Also, many 274system vendors ship variant versions of <small>GDB</small>, and there are 275variant versions of <small>GDB</small> in <small>GNU</small>/Linux distributions as well. 276The version number is the same as the one announced when you start 277<small>GDB</small>. 278</p> 279<a name="index-show-copying"></a> 280<a name="index-info-copying"></a> 281<a name="index-display-GDB-copyright"></a> 282</dd> 283<dt><code>show copying</code></dt> 284<dt><code>info copying</code></dt> 285<dd><p>Display information about permission for copying <small>GDB</small>. 286</p> 287<a name="index-show-warranty"></a> 288<a name="index-info-warranty"></a> 289</dd> 290<dt><code>show warranty</code></dt> 291<dt><code>info warranty</code></dt> 292<dd><p>Display the <small>GNU</small> “NO WARRANTY” statement, or a warranty, 293if your version of <small>GDB</small> comes with one. 294</p> 295<a name="index-show-configuration"></a> 296</dd> 297<dt><code>show configuration</code></dt> 298<dd><p>Display detailed information about the way <small>GDB</small> was configured 299when it was built. This displays the optional arguments passed to the 300<samp>configure</samp> script and also configuration parameters detected 301automatically by <code>configure</code>. When reporting a <small>GDB</small> 302bug (see <a href="GDB-Bugs.html#GDB-Bugs">GDB Bugs</a>), it is important to include this information in 303your report. 304</p> 305</dd> 306</dl> 307 308<hr> 309<div class="header"> 310<p> 311Previous: <a href="Command-aliases-default-args.html#Command-aliases-default-args" accesskey="p" rel="previous">Command aliases default args</a>, Up: <a href="Commands.html#Commands" accesskey="u" rel="up">Commands</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> 312</div> 313 314 315 316</body> 317</html> 318