• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>File 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="next" href="Mode-Options.html#Mode-Options" title="Mode Options">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1988-2013 Free Software Foundation, Inc.
13
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with the
17Invariant Sections being ``Free Software'' and ``Free Software Needs
18Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
19and with the Back-Cover Texts as in (a) below.
20
21(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
22this GNU Manual.  Buying copies from GNU Press supports the FSF in
23developing GNU and promoting software freedom.''
24-->
25<meta http-equiv="Content-Style-Type" content="text/css">
26<style type="text/css"><!--
27  pre.display { font-family:inherit }
28  pre.format  { font-family:inherit }
29  pre.smalldisplay { font-family:inherit; font-size:smaller }
30  pre.smallformat  { font-family:inherit; font-size:smaller }
31  pre.smallexample { font-size:smaller }
32  pre.smalllisp    { font-size:smaller }
33  span.sc    { font-variant:small-caps }
34  span.roman { font-family:serif; font-weight:normal; } 
35  span.sansserif { font-family:sans-serif; font-weight:normal; } 
36--></style>
37<link rel="stylesheet" type="text/css" href="../cs.css">
38</head>
39<body>
40<div class="node">
41<a name="File-Options"></a>
42<p>
43Next:&nbsp;<a rel="next" accesskey="n" href="Mode-Options.html#Mode-Options">Mode Options</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking-GDB">Invoking GDB</a>
45<hr>
46</div>
47
48<h4 class="subsection">2.1.1 Choosing Files</h4>
49
50<p>When <span class="sc">gdb</span> starts, it reads any arguments other than options as
51specifying an executable file and core file (or process ID).  This is
52the same as if the arguments were specified by the &lsquo;<samp><span class="samp">-se</span></samp>&rsquo; and
53&lsquo;<samp><span class="samp">-c</span></samp>&rsquo; (or &lsquo;<samp><span class="samp">-p</span></samp>&rsquo;) options respectively.  (<span class="sc">gdb</span> reads the
54first argument that does not have an associated option flag as
55equivalent to the &lsquo;<samp><span class="samp">-se</span></samp>&rsquo; option followed by that argument; and the
56second argument that does not have an associated option flag, if any, as
57equivalent to the &lsquo;<samp><span class="samp">-c</span></samp>&rsquo;/&lsquo;<samp><span class="samp">-p</span></samp>&rsquo; option followed by that argument.) 
58If the second argument begins with a decimal digit, <span class="sc">gdb</span> will
59first attempt to attach to it as a process, and if that fails, attempt
60to open it as a corefile.  If you have a corefile whose name begins with
61a digit, you can prevent <span class="sc">gdb</span> from treating it as a pid by
62prefixing it with <samp><span class="file">./</span></samp>, e.g. <samp><span class="file">./12345</span></samp>.
63
64   <p>If <span class="sc">gdb</span> has not been configured to included core file support,
65such as for most embedded targets, then it will complain about a second
66argument and ignore it.
67
68   <p>Many options have both long and short forms; both are shown in the
69following list.  <span class="sc">gdb</span> also recognizes the long forms if you truncate
70them, so long as enough of the option is present to be unambiguous. 
71(If you prefer, you can flag option arguments with &lsquo;<samp><span class="samp">--</span></samp>&rsquo; rather
72than &lsquo;<samp><span class="samp">-</span></samp>&rsquo;, though we illustrate the more usual convention.)
73
74<!-- NOTE: the @cindex entries here use double dashes ON PURPOSE.  This -->
75<!-- way, both those who look for -foo and -foo in the index, will find -->
76<!-- it. -->
77     <dl>
78<dt><code>-symbols </code><var>file</var><dt><code>-s </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dsymbols_007d-4"></a><a name="index-g_t_0040code_007b_002ds_007d-5"></a>Read symbol table from file <var>file</var>.
79
80     <br><dt><code>-exec </code><var>file</var><dt><code>-e </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dexec_007d-6"></a><a name="index-g_t_0040code_007b_002de_007d-7"></a>Use file <var>file</var> as the executable file to execute when appropriate,
81and for examining pure data in conjunction with a core dump.
82
83     <br><dt><code>-se </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dse_007d-8"></a>Read symbol table from file <var>file</var> and use it as the executable
84file.
85
86     <br><dt><code>-core </code><var>file</var><dt><code>-c </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dcore_007d-9"></a><a name="index-g_t_0040code_007b_002dc_007d-10"></a>Use file <var>file</var> as a core dump to examine.
87
88     <br><dt><code>-pid </code><var>number</var><dt><code>-p </code><var>number</var><dd><a name="index-g_t_0040code_007b_002d_002dpid_007d-11"></a><a name="index-g_t_0040code_007b_002dp_007d-12"></a>Connect to process ID <var>number</var>, as with the <code>attach</code> command.
89
90     <br><dt><code>-command </code><var>file</var><dt><code>-x </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dcommand_007d-13"></a><a name="index-g_t_0040code_007b_002dx_007d-14"></a>Execute commands from file <var>file</var>.  The contents of this file is
91evaluated exactly as the <code>source</code> command would. 
92See <a href="Command-Files.html#Command-Files">Command files</a>.
93
94     <br><dt><code>-eval-command </code><var>command</var><dt><code>-ex </code><var>command</var><dd><a name="index-g_t_0040code_007b_002d_002deval_002dcommand_007d-15"></a><a name="index-g_t_0040code_007b_002dex_007d-16"></a>Execute a single <span class="sc">gdb</span> command.
95
96     <p>This option may be used multiple times to call multiple commands.  It may
97also be interleaved with &lsquo;<samp><span class="samp">-command</span></samp>&rsquo; as required.
98
99     <pre class="smallexample">          gdb -ex 'target sim' -ex 'load' \
100             -x setbreakpoints -ex 'run' a.out
101</pre>
102     <br><dt><code>-init-command </code><var>file</var><dt><code>-ix </code><var>file</var><dd><a name="index-g_t_0040code_007b_002d_002dinit_002dcommand_007d-17"></a><a name="index-g_t_0040code_007b_002dix_007d-18"></a>Execute commands from file <var>file</var> before loading the inferior (but
103after loading gdbinit files). 
104See <a href="Startup.html#Startup">Startup</a>.
105
106     <br><dt><code>-init-eval-command </code><var>command</var><dt><code>-iex </code><var>command</var><dd><a name="index-g_t_0040code_007b_002d_002dinit_002deval_002dcommand_007d-19"></a><a name="index-g_t_0040code_007b_002diex_007d-20"></a>Execute a single <span class="sc">gdb</span> command before loading the inferior (but
107after loading gdbinit files). 
108See <a href="Startup.html#Startup">Startup</a>.
109
110     <br><dt><code>-directory </code><var>directory</var><dt><code>-d </code><var>directory</var><dd><a name="index-g_t_0040code_007b_002d_002ddirectory_007d-21"></a><a name="index-g_t_0040code_007b_002dd_007d-22"></a>Add <var>directory</var> to the path to search for source and script files.
111
112     <br><dt><code>-r</code><dt><code>-readnow</code><dd><a name="index-g_t_0040code_007b_002d_002dreadnow_007d-23"></a><a name="index-g_t_0040code_007b_002dr_007d-24"></a>Read each symbol file's entire symbol table immediately, rather than
113the default, which is to read it incrementally as it is needed. 
114This makes startup slower, but makes future operations faster.
115
116   </dl>
117
118   </body></html>
119
120