3 <title>Debugging with GDB
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Debugging with GDB">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Command%20Syntax">Command Syntax
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Completion.html#Completion">Completion
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"Commands.html#Commands">Commands
</a>
18 <h3 class=
"section">Command syntax
</h3>
20 <p>A GDB command is a single line of input. There is no limit on
21 how long it can be. It starts with a command name, which is followed by
22 arguments whose meaning depends on the command name. For example, the
23 command
<code>step
</code> accepts an argument which is the number of times to
24 step, as in
<code>step
5</code>. You can also use the
<code>step
</code> command
25 with no arguments. Some commands do not allow any arguments.
27 GDB command names may always be truncated if that abbreviation is
28 unambiguous. Other possible command abbreviations are listed in the
29 documentation for individual commands. In some cases, even ambiguous
30 abbreviations are allowed; for example,
<code>s
</code> is specially defined as
31 equivalent to
<code>step
</code> even though there are other commands whose
32 names start with
<code>s
</code>. You can test abbreviations by using them as
33 arguments to the
<code>help
</code> command.
35 <p>A blank line as input to GDB (typing just
<RET
>) means to
36 repeat the previous command. Certain commands (for example,
<code>run
</code>)
37 will not repeat this way; these are commands whose unintentional
38 repetition might cause trouble and which you are unlikely to want to
41 <p>The
<code>list
</code> and
<code>x
</code> commands, when you repeat them with
42 <RET
>, construct new arguments rather than repeating
43 exactly as typed. This permits easy scanning of source or memory.
45 GDB can also use
<RET
> in another way: to partition lengthy
46 output, in a way similar to the common utility
<code>more
</code>
47 (see
<a href=
"Screen-Size.html#Screen%20Size">Screen size
</a>). Since it is easy to press one
48 <RET
> too many in this situation, GDB disables command
49 repetition after any command that generates this sort of display.
51 <p>Any text from a
<kbd>#
</kbd> to the end of the line is a comment; it does
52 nothing. This is useful mainly in command files (see
<a href=
"Command-Files.html#Command%20Files">Command files
</a>).
54 <p>The
<kbd>C-o
</kbd> binding is useful for repeating a complex sequence of
55 commands. This command accepts the current line, like
<kbd>RET
</kbd>, and
56 then fetches the next line relative to the current line from the history