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=
"Mode%20Options">Mode Options
</a>,
13 Previous:
<a rel=
"previous" accesskey=
"p" href=
"File-Options.html#File%20Options">File Options
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"Invoking-GDB.html#Invoking%20GDB">Invoking GDB
</a>
18 <h4 class=
"subsection">Choosing modes
</h4>
20 <p>You can run GDB in various alternative modes--for example, in
21 batch mode or quiet mode.
25 <dd><dt><code>-n
</code>
26 <dd>Do not execute commands found in any initialization files. Normally,
27 GDB executes the commands in these files after all the command
28 options and arguments have been processed. See
<a href=
"Command-Files.html#Command%20Files">Command files
</a>.
30 <br><dt><code>-quiet
</code>
31 <dd><dt><code>-silent
</code>
32 <dd><dt><code>-q
</code>
33 <dd>"Quiet". Do not print the introductory and copyright messages. These
34 messages are also suppressed in batch mode.
36 <br><dt><code>-batch
</code>
37 <dd>Run in batch mode. Exit with status
<code>0</code> after processing all the
38 command files specified with
<code>-x
</code> (and all commands from
39 initialization files, if not inhibited with
<code>-n
</code>). Exit with
40 nonzero status if an error occurs in executing the GDB commands
43 <p>Batch mode may be useful for running GDB as a filter, for
44 example to download and run a program on another computer; in order to
45 make this more useful, the message
47 <pre class=
"example"> Program exited normally.
50 <p>(which is ordinarily issued whenever a program running under
51 GDB control terminates) is not issued when running in batch
54 <br><dt><code>-nowindows
</code>
55 <dd><dt><code>-nw
</code>
56 <dd>"No windows". If GDB comes with a graphical user interface
57 (GUI) built in, then this option tells GDB to only use the command-line
58 interface. If no GUI is available, this option has no effect.
60 <br><dt><code>-windows
</code>
61 <dd><dt><code>-w
</code>
62 <dd>If GDB includes a GUI, then this option requires it to be
65 <br><dt><code>-cd
</code><var>directory
</var><code></code>
66 <dd>Run GDB using
<var>directory
</var> as its working directory,
67 instead of the current directory.
69 <br><dt><code>-fullname
</code>
70 <dd><dt><code>-f
</code>
71 <dd><small>GNU
</small> Emacs sets this option when it runs GDB as a
72 subprocess. It tells GDB to output the full file name and line
73 number in a standard, recognizable fashion each time a stack frame is
74 displayed (which includes each time your program stops). This
75 recognizable format looks like two
<code>\
032</code> characters, followed by
76 the file name, line number and character position separated by colons,
77 and a newline. The Emacs-to-GDB interface program uses the two
78 <code>\
032</code> characters as a signal to display the source code for the
81 <br><dt><code>-epoch
</code>
82 <dd>The Epoch Emacs-GDB interface sets this option when it runs
83 GDB as a subprocess. It tells GDB to modify its print
84 routines so as to allow Epoch to display values of expressions in a
87 <br><dt><code>-annotate
</code><var>level
</var><code></code>
88 <dd>This option sets the
<dfn>annotation level
</dfn> inside GDB. Its
89 effect is identical to using
<code>set annotate
</code><var>level
</var><code></code>
90 (see
<a href=
"Annotations.html#Annotations">Annotations
</a>).
91 Annotation level controls how much information does GDB print
92 together with its prompt, values of expressions, source lines, and other
93 types of output. Level
0 is the normal, level
1 is for use when
94 GDB is run as a subprocess of
<small>GNU
</small> Emacs, level
2 is the
95 maximum annotation suitable for programs that control GDB.
97 <br><dt><code>-async
</code>
98 <dd>Use the asynchronous event loop for the command-line interface.
99 GDB processes all events, such as user keyboard input, via a
100 special event loop. This allows GDB to accept and process user
101 commands in parallel with the debugged process being
102 run
<a rel=
"footnote" href=
"#fn-1"><sup>1</sup></a>, so you don't need to wait for
103 control to return to GDB before you type the next command.
104 (
<em>Note:
</em> as of version
5.1, the target side of the asynchronous
105 operation is not yet in place, so
<code>-async
</code> does not work fully
108 <p>When the standard input is connected to a terminal device, GDB
109 uses the asynchronous event loop by default, unless disabled by the
110 <code>-noasync
</code> option.
112 <br><dt><code>-noasync
</code>
113 <dd>Disable the asynchronous event loop for the command-line interface.
115 <br><dt><code>--args
</code>
116 <dd>Change interpretation of command line so that arguments following the
117 executable file are passed as command line arguments to the inferior.
118 This option stops option processing.
120 <br><dt><code>-baud
</code><var>bps
</var><code></code>
121 <dd><dt><code>-b
</code><var>bps
</var><code></code>
122 <dd>Set the line speed (baud rate or bits per second) of any serial
123 interface used by GDB for remote debugging.
125 <br><dt><code>-tty
</code><var>device
</var><code></code>
126 <dd><dt><code>-t
</code><var>device
</var><code></code>
127 <dd>Run using
<var>device
</var> for your program's standard input and output.
129 <br><dt><code>-tui
</code>
130 <dd>Activate the Terminal User Interface when starting.
131 The Terminal User Interface manages several text windows on the terminal,
132 showing source, assembly, registers and GDB command outputs
133 (see
<a href=
"TUI.html#TUI">GDB Text User Interface
</a>).
134 Do not use this option if you run GDB from Emacs
135 (see
<a href=
"Emacs.html#Emacs">Using GDB under
<small>GNU
</small> Emacs
</a>).
137 <br><dt><code>-interpreter
</code><var>interp
</var><code></code>
138 <dd>Use the interpreter
<var>interp
</var> for interface with the controlling
139 program or device. This option is meant to be set by programs which
140 communicate with GDB using it as a back end.
142 <p><code>--interpreter=mi
</code> (or
<code>--interpreter=mi1
</code>) causes
143 GDB to use the
<dfn>gdb/mi interface
</dfn> (see
<a href=
"GDB-MI.html#GDB%2fMI">The
<small>GDB/MI
</small> Interface
</a>). The older
<small>GDB/MI
</small> interface, included in
144 GDB version
5.0 can be selected with
<code>--interpreter=mi0
</code>.
146 <br><dt><code>-write
</code>
147 <dd>Open the executable and core files for both reading and writing. This
148 is equivalent to the
<code>set write on
</code> command inside GDB
149 (see
<a href=
"Patching.html#Patching">Patching
</a>).
151 <br><dt><code>-statistics
</code>
152 <dd>This option causes GDB to print statistics about time and
153 memory usage after it completes each command and returns to the prompt.
155 <br><dt><code>-version
</code>
156 <dd>This option causes GDB to print its version number and
157 no-warranty blurb, and exit.
161 <div class=
"footnote">
165 <li><a name=
"fn-1"></a>
166 <p>GDB built with
<small>DJGPP
</small> tools for
167 MS-DOS/MS-Windows supports this mode of operation, but the event loop is
168 suspended when the debuggee runs.
</p>