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: Command Options</title>
18
19<meta name="description" content="Debugging with GDB: Command Options">
20<meta name="keywords" content="Debugging with GDB: Command Options">
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="Command-aliases-default-args.html#Command-aliases-default-args" rel="next" title="Command aliases default args">
30<link href="Completion.html#Completion" rel="previous" title="Completion">
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="Command-Options"></a>
65<div class="header">
66<p>
67Next: <a href="Command-aliases-default-args.html#Command-aliases-default-args" accesskey="n" rel="next">Command aliases default args</a>, Previous: <a href="Completion.html#Completion" accesskey="p" rel="previous">Completion</a>, Up: <a href="Commands.html#Commands" accesskey="u" rel="up">Commands</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>
68</div>
69<hr>
70<a name="Command-Options-1"></a>
71<h3 class="section">3.4 Command Options</h3>
72
73<a name="index-command-options"></a>
74<p>Some commands accept options starting with a leading dash.  For
75example, <code>print -pretty</code>.  Similarly to command names, you can
76abbreviate a <small>GDB</small> option to the first few letters of the
77option name, if that abbreviation is unambiguous, and you can also use
78the <tt class="key">TAB</tt> key to get <small>GDB</small> to fill out the rest of a word
79in an option (or to show you the alternatives available, if there is
80more than one possibility).
81</p>
82<a name="index-command-options_002c-raw-input"></a>
83<p>Some commands take raw input as argument.  For example, the print
84command processes arbitrary expressions in any of the languages
85supported by <small>GDB</small>.  With such commands, because raw input may
86start with a leading dash that would be confused with an option or any
87of its abbreviations, e.g. <code>print -p</code> (short for <code>print
88-pretty</code> or printing negative <code>p</code>?), if you specify any command
89option, then you must use a double-dash (<code>--</code>) delimiter to
90indicate the end of options.
91</p>
92<a name="index-command-options_002c-boolean"></a>
93
94<p>Some options are described as accepting an argument which can be
95either <code>on</code> or <code>off</code>.  These are known as <em>boolean
96options</em>.  Similarly to boolean settings commands&mdash;<code>on</code> and
97<code>off</code> are the typical values, but any of <code>1</code>, <code>yes</code> and
98<code>enable</code> can also be used as &ldquo;true&rdquo; value, and any of <code>0</code>,
99<code>no</code> and <code>disable</code> can also be used as &ldquo;false&rdquo; value.  You
100can also omit a &ldquo;true&rdquo; value, as it is implied by default.
101</p>
102<p>For example, these are equivalent:
103</p>
104<div class="smallexample">
105<pre class="smallexample">(gdb) print -object on -pretty off -element unlimited -- *myptr
106(gdb) p -o -p 0 -e u -- *myptr
107</pre></div>
108
109<p>You can discover the set of options some command accepts by completing
110on <code>-</code> after the command name.  For example:
111</p>
112<div class="smallexample">
113<pre class="smallexample">(gdb) print -<span class="key">TAB</span><span class="key">TAB</span>
114-address         -max-depth       -raw-values      -union
115-array           -null-stop       -repeats         -vtbl
116-array-indexes   -object          -static-members
117-elements        -pretty          -symbol
118</pre></div>
119
120<p>Completion will in some cases guide you with a suggestion of what kind
121of argument an option expects.  For example:
122</p>
123<div class="smallexample">
124<pre class="smallexample">(gdb) print -elements <span class="key">TAB</span><span class="key">TAB</span>
125NUMBER     unlimited
126</pre></div>
127
128<p>Here, the option expects a number (e.g., <code>100</code>), not literal
129<code>NUMBER</code>.  Such metasyntactical arguments are always presented in
130uppercase.
131</p>
132<p>(For more on using the <code>print</code> command, see <a href="Data.html#Data">Examining
133Data</a>.)
134</p>
135<hr>
136<div class="header">
137<p>
138Next: <a href="Command-aliases-default-args.html#Command-aliases-default-args" accesskey="n" rel="next">Command aliases default args</a>, Previous: <a href="Completion.html#Completion" accesskey="p" rel="previous">Completion</a>, Up: <a href="Commands.html#Commands" accesskey="u" rel="up">Commands</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>
139</div>
140
141
142
143</body>
144</html>
145