Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / File-Options.html
blob3a6890c452bc2e8d2172a529a804b144f6ca47a4
1 <html lang="en">
2 <head>
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">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="File%20Options">File Options</a>,
13 Next:<a rel="next" accesskey="n" href="Mode-Options.html#Mode%20Options">Mode Options</a>,
14 Up:<a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking%20GDB">Invoking GDB</a>
15 <hr><br>
16 </div>
18 <h4 class="subsection">Choosing files</h4>
20 <p>When GDB starts, it reads any arguments other than options as
21 specifying an executable file and core file (or process ID). This is
22 the same as if the arguments were specified by the <code>-se</code> and
23 <code>-c</code> (or <code>-p</code> options respectively. (GDB reads the
24 first argument that does not have an associated option flag as
25 equivalent to the <code>-se</code> option followed by that argument; and the
26 second argument that does not have an associated option flag, if any, as
27 equivalent to the <code>-c</code>/<code>-p</code> option followed by that argument.)
28 If the second argument begins with a decimal digit, GDB will
29 first attempt to attach to it as a process, and if that fails, attempt
30 to open it as a corefile. If you have a corefile whose name begins with
31 a digit, you can prevent GDB from treating it as a pid by
32 prefixing it with <code>./</code>, eg. <code>./12345</code>.
34 <p>If GDB has not been configured to included core file support,
35 such as for most embedded targets, then it will complain about a second
36 argument and ignore it.
38 <p>Many options have both long and short forms; both are shown in the
39 following list. GDB also recognizes the long forms if you truncate
40 them, so long as enough of the option is present to be unambiguous.
41 (If you prefer, you can flag option arguments with <code>--</code> rather
42 than <code>-</code>, though we illustrate the more usual convention.)
44 <dl>
45 <dt><code>-symbols </code><var>file</var><code></code>
46 <dd><dt><code>-s </code><var>file</var><code></code>
47 <dd>Read symbol table from file <var>file</var>.
49 <br><dt><code>-exec </code><var>file</var><code></code>
50 <dd><dt><code>-e </code><var>file</var><code></code>
51 <dd>Use file <var>file</var> as the executable file to execute when appropriate,
52 and for examining pure data in conjunction with a core dump.
54 <br><dt><code>-se </code><var>file</var><code></code>
55 <dd>Read symbol table from file <var>file</var> and use it as the executable
56 file.
58 <br><dt><code>-core </code><var>file</var><code></code>
59 <dd><dt><code>-c </code><var>file</var><code></code>
60 <dd>Use file <var>file</var> as a core dump to examine.
62 <br><dt><code>-c </code><var>number</var><code></code>
63 <dd><br><dt><code>-pid </code><var>number</var><code></code>
64 <dd><dt><code>-p </code><var>number</var><code></code>
65 <dd>Connect to process ID <var>number</var>, as with the <code>attach</code> command.
66 If there is no such process, GDB will attempt to open a core
67 file named <var>number</var>.
69 <br><dt><code>-command </code><var>file</var><code></code>
70 <dd><dt><code>-x </code><var>file</var><code></code>
71 <dd>Execute GDB commands from file <var>file</var>. See <a href="Command-Files.html#Command%20Files">Command files</a>.
73 <br><dt><code>-directory </code><var>directory</var><code></code>
74 <dd><dt><code>-d </code><var>directory</var><code></code>
75 <dd>Add <var>directory</var> to the path to search for source files.
77 <br><dt><code>-m</code>
78 <dd><dt><code>-mapped</code>
79 <dd><em>Warning: this option depends on operating system facilities that are not
80 supported on all systems.</em><br>
81 If memory-mapped files are available on your system through the <code>mmap</code>
82 system call, you can use this option
83 to have GDB write the symbols from your
84 program into a reusable file in the current directory. If the program you are debugging is
85 called <code>/tmp/fred</code>, the mapped symbol file is <code>/tmp/fred.syms</code>.
86 Future GDB debugging sessions notice the presence of this file,
87 and can quickly map in symbol information from it, rather than reading
88 the symbol table from the executable program.
90 <p>The <code>.syms</code> file is specific to the host machine where GDB
91 is run. It holds an exact image of the internal GDB symbol
92 table. It cannot be shared across multiple host platforms.
94 <br><dt><code>-r</code>
95 <dd><dt><code>-readnow</code>
96 <dd>Read each symbol file's entire symbol table immediately, rather than
97 the default, which is to read it incrementally as it is needed.
98 This makes startup slower, but makes future operations faster.
100 </dl>
102 <p>You typically combine the <code>-mapped</code> and <code>-readnow</code> options in
103 order to build a <code>.syms</code> file that contains complete symbol
104 information. (See <a href="Files.html#Files">Commands to specify files</a>, for information
105 on <code>.syms</code> files.) A simple GDB invocation to do nothing
106 but build a <code>.syms</code> file for future use is:
108 <pre class="example"> gdb -batch -nx -mapped -readnow programname
109 </pre>
111 </body></html>