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 Syntax</title>
18
19<meta name="description" content="Debugging with GDB: Command Syntax">
20<meta name="keywords" content="Debugging with GDB: Command Syntax">
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-Settings.html#Command-Settings" rel="next" title="Command Settings">
30<link href="Commands.html#Commands" rel="previous" title="Commands">
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-Syntax"></a>
65<div class="header">
66<p>
67Next: <a href="Command-Settings.html#Command-Settings" accesskey="n" rel="next">Command Settings</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-Syntax-1"></a>
71<h3 class="section">3.1 Command Syntax</h3>
72
73<p>A <small>GDB</small> command is a single line of input.  There is no limit on
74how long it can be.  It starts with a command name, which is followed by
75arguments whose meaning depends on the command name.  For example, the
76command <code>step</code> accepts an argument which is the number of times to
77step, as in &lsquo;<samp>step 5</samp>&rsquo;.  You can also use the <code>step</code> command
78with no arguments.  Some commands do not allow any arguments.
79</p>
80<a name="index-abbreviation"></a>
81<p><small>GDB</small> command names may always be truncated if that abbreviation is
82unambiguous.  Other possible command abbreviations are listed in the
83documentation for individual commands.  In some cases, even ambiguous
84abbreviations are allowed; for example, <code>s</code> is specially defined as
85equivalent to <code>step</code> even though there are other commands whose
86names start with <code>s</code>.  You can test abbreviations by using them as
87arguments to the <code>help</code> command.
88</p>
89<a name="index-repeating-commands"></a>
90<a name="index-RET-_0028repeat-last-command_0029"></a>
91<p>A blank line as input to <small>GDB</small> (typing just <tt class="key">RET</tt>) means to
92repeat the previous command.  Certain commands (for example, <code>run</code>)
93will not repeat this way; these are commands whose unintentional
94repetition might cause trouble and which you are unlikely to want to
95repeat.  User-defined commands can disable this feature; see
96<a href="Define.html#Define">dont-repeat</a>.
97</p>
98<p>The <code>list</code> and <code>x</code> commands, when you repeat them with
99<tt class="key">RET</tt>, construct new arguments rather than repeating
100exactly as typed.  This permits easy scanning of source or memory.
101</p>
102<p><small>GDB</small> can also use <tt class="key">RET</tt> in another way: to partition lengthy
103output, in a way similar to the common utility <code>more</code>
104(see <a href="Screen-Size.html#Screen-Size">Screen Size</a>).  Since it is easy to press one
105<tt class="key">RET</tt> too many in this situation, <small>GDB</small> disables command
106repetition after any command that generates this sort of display.
107</p>
108<a name="index-_0023-_0028a-comment_0029"></a>
109<a name="index-comment"></a>
110<p>Any text from a <kbd>#</kbd> to the end of the line is a comment; it does
111nothing.  This is useful mainly in command files (see <a href="Command-Files.html#Command-Files">Command Files</a>).
112</p>
113<a name="index-repeating-command-sequences"></a>
114<a name="index-Ctrl_002do-_0028operate_002dand_002dget_002dnext_0029"></a>
115<p>The <kbd>Ctrl-o</kbd> binding is useful for repeating a complex sequence of
116commands.  This command accepts the current line, like <tt class="key">RET</tt>, and
117then fetches the next line relative to the current line from the history
118for editing.
119</p>
120
121<hr>
122<div class="header">
123<p>
124Next: <a href="Command-Settings.html#Command-Settings" accesskey="n" rel="next">Command Settings</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>
125</div>
126
127
128
129</body>
130</html>
131