1<html lang="en"> 2<head> 3<title>Mode Options - 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.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Invoking-GDB.html#Invoking-GDB" title="Invoking GDB"> 9<link rel="prev" href="File-Options.html#File-Options" title="File Options"> 10<link rel="next" href="Startup.html#Startup" title="Startup"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 141998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 15Free Software Foundation, Inc. 16 17Permission is granted to copy, distribute and/or modify this document 18under the terms of the GNU Free Documentation License, Version 1.3 or 19any later version published by the Free Software Foundation; with the 20Invariant Sections being ``Free Software'' and ``Free Software Needs 21Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 22and with the Back-Cover Texts as in (a) below. 23 24(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 25this GNU Manual. Buying copies from GNU Press supports the FSF in 26developing GNU and promoting software freedom.''--> 27<meta http-equiv="Content-Style-Type" content="text/css"> 28<style type="text/css"><!-- 29 pre.display { font-family:inherit } 30 pre.format { font-family:inherit } 31 pre.smalldisplay { font-family:inherit; font-size:smaller } 32 pre.smallformat { font-family:inherit; font-size:smaller } 33 pre.smallexample { font-size:smaller } 34 pre.smalllisp { font-size:smaller } 35 span.sc { font-variant:small-caps } 36 span.roman { font-family:serif; font-weight:normal; } 37 span.sansserif { font-family:sans-serif; font-weight:normal; } 38--></style> 39<link rel="stylesheet" type="text/css" href="../cs.css"> 40</head> 41<body> 42<div class="node"> 43<a name="Mode-Options"></a> 44<p> 45Next: <a rel="next" accesskey="n" href="Startup.html#Startup">Startup</a>, 46Previous: <a rel="previous" accesskey="p" href="File-Options.html#File-Options">File Options</a>, 47Up: <a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking-GDB">Invoking GDB</a> 48<hr> 49</div> 50 51<h4 class="subsection">2.1.2 Choosing Modes</h4> 52 53<p>You can run <span class="sc">gdb</span> in various alternative modes—for example, in 54batch mode or quiet mode. 55 56 <dl> 57<dt><code>-nx</code><dt><code>-n</code><dd><a name="index-g_t_0040code_007b_002d_002dnx_007d-21"></a><a name="index-g_t_0040code_007b_002dn_007d-22"></a>Do not execute commands found in any initialization files. Normally, 58<span class="sc">gdb</span> executes the commands in these files after all the command 59options and arguments have been processed. See <a href="Command-Files.html#Command-Files">Command Files</a>. 60 61 <br><dt><code>-quiet</code><dt><code>-silent</code><dt><code>-q</code><dd><a name="index-g_t_0040code_007b_002d_002dquiet_007d-23"></a><a name="index-g_t_0040code_007b_002d_002dsilent_007d-24"></a><a name="index-g_t_0040code_007b_002dq_007d-25"></a>“Quiet”. Do not print the introductory and copyright messages. These 62messages are also suppressed in batch mode. 63 64 <br><dt><code>-batch</code><dd><a name="index-g_t_0040code_007b_002d_002dbatch_007d-26"></a>Run in batch mode. Exit with status <code>0</code> after processing all the 65command files specified with ‘<samp><span class="samp">-x</span></samp>’ (and all commands from 66initialization files, if not inhibited with ‘<samp><span class="samp">-n</span></samp>’). Exit with 67nonzero status if an error occurs in executing the <span class="sc">gdb</span> commands 68in the command files. Batch mode also disables pagination, sets unlimited 69terminal width and height see <a href="Screen-Size.html#Screen-Size">Screen Size</a>, and acts as if <kbd>set confirm 70off</kbd> were in effect (see <a href="Messages_002fWarnings.html#Messages_002fWarnings">Messages/Warnings</a>). 71 72 <p>Batch mode may be useful for running <span class="sc">gdb</span> as a filter, for 73example to download and run a program on another computer; in order to 74make this more useful, the message 75 76 <pre class="smallexample"> Program exited normally. 77</pre> 78 <p class="noindent">(which is ordinarily issued whenever a program running under 79<span class="sc">gdb</span> control terminates) is not issued when running in batch 80mode. 81 82 <br><dt><code>-batch-silent</code><dd><a name="index-g_t_0040code_007b_002d_002dbatch_002dsilent_007d-27"></a>Run in batch mode exactly like ‘<samp><span class="samp">-batch</span></samp>’, but totally silently. All 83<span class="sc">gdb</span> output to <code>stdout</code> is prevented (<code>stderr</code> is 84unaffected). This is much quieter than ‘<samp><span class="samp">-silent</span></samp>’ and would be useless 85for an interactive session. 86 87 <p>This is particularly useful when using targets that give ‘<samp><span class="samp">Loading section</span></samp>’ 88messages, for example. 89 90 <p>Note that targets that give their output via <span class="sc">gdb</span>, as opposed to 91writing directly to <code>stdout</code>, will also be made silent. 92 93 <br><dt><code>-return-child-result</code><dd><a name="index-g_t_0040code_007b_002d_002dreturn_002dchild_002dresult_007d-28"></a>The return code from <span class="sc">gdb</span> will be the return code from the child 94process (the process being debugged), with the following exceptions: 95 96 <ul> 97<li><span class="sc">gdb</span> exits abnormally. E.g., due to an incorrect argument or an 98internal error. In this case the exit code is the same as it would have been 99without ‘<samp><span class="samp">-return-child-result</span></samp>’. 100<li>The user quits with an explicit value. E.g., ‘<samp><span class="samp">quit 1</span></samp>’. 101<li>The child process never runs, or is not allowed to terminate, in which case 102the exit code will be -1. 103</ul> 104 105 <p>This option is useful in conjunction with ‘<samp><span class="samp">-batch</span></samp>’ or ‘<samp><span class="samp">-batch-silent</span></samp>’, 106when <span class="sc">gdb</span> is being used as a remote program loader or simulator 107interface. 108 109 <br><dt><code>-nowindows</code><dt><code>-nw</code><dd><a name="index-g_t_0040code_007b_002d_002dnowindows_007d-29"></a><a name="index-g_t_0040code_007b_002dnw_007d-30"></a>“No windows”. If <span class="sc">gdb</span> comes with a graphical user interface 110(GUI) built in, then this option tells <span class="sc">gdb</span> to only use the command-line 111interface. If no GUI is available, this option has no effect. 112 113 <br><dt><code>-windows</code><dt><code>-w</code><dd><a name="index-g_t_0040code_007b_002d_002dwindows_007d-31"></a><a name="index-g_t_0040code_007b_002dw_007d-32"></a>If <span class="sc">gdb</span> includes a GUI, then this option requires it to be 114used if possible. 115 116 <br><dt><code>-cd </code><var>directory</var><dd><a name="index-g_t_0040code_007b_002d_002dcd_007d-33"></a>Run <span class="sc">gdb</span> using <var>directory</var> as its working directory, 117instead of the current directory. 118 119 <br><dt><code>-fullname</code><dt><code>-f</code><dd><a name="index-g_t_0040code_007b_002d_002dfullname_007d-34"></a><a name="index-g_t_0040code_007b_002df_007d-35"></a><span class="sc">gnu</span> Emacs sets this option when it runs <span class="sc">gdb</span> as a 120subprocess. It tells <span class="sc">gdb</span> to output the full file name and line 121number in a standard, recognizable fashion each time a stack frame is 122displayed (which includes each time your program stops). This 123recognizable format looks like two ‘<samp><span class="samp">\032</span></samp>’ characters, followed by 124the file name, line number and character position separated by colons, 125and a newline. The Emacs-to-<span class="sc">gdb</span> interface program uses the two 126‘<samp><span class="samp">\032</span></samp>’ characters as a signal to display the source code for the 127frame. 128 129 <br><dt><code>-epoch</code><dd><a name="index-g_t_0040code_007b_002d_002depoch_007d-36"></a>The Epoch Emacs-<span class="sc">gdb</span> interface sets this option when it runs 130<span class="sc">gdb</span> as a subprocess. It tells <span class="sc">gdb</span> to modify its print 131routines so as to allow Epoch to display values of expressions in a 132separate window. 133 134 <br><dt><code>-annotate </code><var>level</var><dd><a name="index-g_t_0040code_007b_002d_002dannotate_007d-37"></a>This option sets the <dfn>annotation level</dfn> inside <span class="sc">gdb</span>. Its 135effect is identical to using ‘<samp><span class="samp">set annotate </span><var>level</var></samp>’ 136(see <a href="Annotations.html#Annotations">Annotations</a>). The annotation <var>level</var> controls how much 137information <span class="sc">gdb</span> prints together with its prompt, values of 138expressions, source lines, and other types of output. Level 0 is the 139normal, level 1 is for use when <span class="sc">gdb</span> is run as a subprocess of 140<span class="sc">gnu</span> Emacs, level 3 is the maximum annotation suitable for programs 141that control <span class="sc">gdb</span>, and level 2 has been deprecated. 142 143 <p>The annotation mechanism has largely been superseded by <span class="sc">gdb/mi</span> 144(see <a href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>). 145 146 <br><dt><code>--args</code><dd><a name="index-g_t_0040code_007b_002d_002dargs_007d-38"></a>Change interpretation of command line so that arguments following the 147executable file are passed as command line arguments to the inferior. 148This option stops option processing. 149 150 <br><dt><code>-baud </code><var>bps</var><dt><code>-b </code><var>bps</var><dd><a name="index-g_t_0040code_007b_002d_002dbaud_007d-39"></a><a name="index-g_t_0040code_007b_002db_007d-40"></a>Set the line speed (baud rate or bits per second) of any serial 151interface used by <span class="sc">gdb</span> for remote debugging. 152 153 <br><dt><code>-l </code><var>timeout</var><dd><a name="index-g_t_0040code_007b_002dl_007d-41"></a>Set the timeout (in seconds) of any communication used by <span class="sc">gdb</span> 154for remote debugging. 155 156 <br><dt><code>-tty </code><var>device</var><dt><code>-t </code><var>device</var><dd><a name="index-g_t_0040code_007b_002d_002dtty_007d-42"></a><a name="index-g_t_0040code_007b_002dt_007d-43"></a>Run using <var>device</var> for your program's standard input and output. 157<!-- FIXME: kingdon thinks there is more to -tty. Investigate. --> 158 159 <!-- resolve the situation of these eventually --> 160 <br><dt><code>-tui</code><dd><a name="index-g_t_0040code_007b_002d_002dtui_007d-44"></a>Activate the <dfn>Text User Interface</dfn> when starting. The Text User 161Interface manages several text windows on the terminal, showing 162source, assembly, registers and <span class="sc">gdb</span> command outputs 163(see <a href="TUI.html#TUI"><span class="sc">gdb</span> Text User Interface</a>). Alternatively, the 164Text User Interface can be enabled by invoking the program 165‘<samp><span class="samp">gdbtui</span></samp>’. Do not use this option if you run <span class="sc">gdb</span> from 166Emacs (see <a href="Emacs.html#Emacs">Using <span class="sc">gdb</span> under <span class="sc">gnu</span> Emacs</a>). 167 168 <!-- @item -xdb --> 169 <!-- @cindex @code{-xdb} --> 170 <!-- Run in XDB compatibility mode, allowing the use of certain XDB commands. --> 171 <!-- For information, see the file @file{xdb_trans.html}, which is usually --> 172 <!-- installed in the directory @code{/opt/langtools/wdb/doc} on HP-UX --> 173 <!-- systems. --> 174 <br><dt><code>-interpreter </code><var>interp</var><dd><a name="index-g_t_0040code_007b_002d_002dinterpreter_007d-45"></a>Use the interpreter <var>interp</var> for interface with the controlling 175program or device. This option is meant to be set by programs which 176communicate with <span class="sc">gdb</span> using it as a back end. 177See <a href="Interpreters.html#Interpreters">Command Interpreters</a>. 178 179 <p>‘<samp><span class="samp">--interpreter=mi</span></samp>’ (or ‘<samp><span class="samp">--interpreter=mi2</span></samp>’) causes 180<span class="sc">gdb</span> to use the <span class="sc">gdb/mi</span><dfn> interface</dfn> (see <a href="GDB_002fMI.html#GDB_002fMI">The <span class="sc">gdb/mi</span> Interface</a>) included since <span class="sc">gdb</span> version 6.0. The 181previous <span class="sc">gdb/mi</span> interface, included in <span class="sc">gdb</span> version 5.3 and 182selected with ‘<samp><span class="samp">--interpreter=mi1</span></samp>’, is deprecated. Earlier 183<span class="sc">gdb/mi</span> interfaces are no longer supported. 184 185 <br><dt><code>-write</code><dd><a name="index-g_t_0040code_007b_002d_002dwrite_007d-46"></a>Open the executable and core files for both reading and writing. This 186is equivalent to the ‘<samp><span class="samp">set write on</span></samp>’ command inside <span class="sc">gdb</span> 187(see <a href="Patching.html#Patching">Patching</a>). 188 189 <br><dt><code>-statistics</code><dd><a name="index-g_t_0040code_007b_002d_002dstatistics_007d-47"></a>This option causes <span class="sc">gdb</span> to print statistics about time and 190memory usage after it completes each command and returns to the prompt. 191 192 <br><dt><code>-version</code><dd><a name="index-g_t_0040code_007b_002d_002dversion_007d-48"></a>This option causes <span class="sc">gdb</span> to print its version number and 193no-warranty blurb, and exit. 194 195 </dl> 196 197 </body></html> 198 199