Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Starting.html
blob6ab4dae9d0d123ab5a4a52ca3d3cb414b7635164
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="Starting">Starting</a>,
13 Next:<a rel="next" accesskey="n" href="Arguments.html#Arguments">Arguments</a>,
14 Previous:<a rel="previous" accesskey="p" href="Compilation.html#Compilation">Compilation</a>,
15 Up:<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Starting your program</h3>
21 <dl>
22 <dt><code>run</code>
23 <dd><dt><code>r</code>
24 <dd>Use the <code>run</code> command to start your program under GDB.
25 You must first specify the program name (except on VxWorks) with an
26 argument to GDB (see <a href="Invocation.html#Invocation">Getting In and Out of GDB</a>), or by using the <code>file</code> or <code>exec-file</code> command
27 (see <a href="Files.html#Files">Commands to specify files</a>).
29 </dl>
31 <p>If you are running your program in an execution environment that
32 supports processes, <code>run</code> creates an inferior process and makes
33 that process run your program. (In environments without processes,
34 <code>run</code> jumps to the start of your program.)
36 <p>The execution of a program is affected by certain information it
37 receives from its superior. GDB provides ways to specify this
38 information, which you must do <em>before</em> starting your program. (You
39 can change it after starting your program, but such changes only affect
40 your program the next time you start it.) This information may be
41 divided into four categories:
43 <dl>
44 <dt>The <em>arguments.</em>
45 <dd>Specify the arguments to give your program as the arguments of the
46 <code>run</code> command. If a shell is available on your target, the shell
47 is used to pass the arguments, so that you may use normal conventions
48 (such as wildcard expansion or variable substitution) in describing
49 the arguments.
50 In Unix systems, you can control which shell is used with the
51 <code>SHELL</code> environment variable.
52 See <a href="Arguments.html#Arguments">Your program's arguments</a>.
54 <br><dt>The <em>environment.</em>
55 <dd>Your program normally inherits its environment from GDB, but you can
56 use the GDB commands <code>set environment</code> and <code>unset
57 environment</code> to change parts of the environment that affect
58 your program. See <a href="Environment.html#Environment">Your program's environment</a>.
60 <br><dt>The <em>working directory.</em>
61 <dd>Your program inherits its working directory from GDB. You can set
62 the GDB working directory with the <code>cd</code> command in GDB.
63 See <a href="Working-Directory.html#Working%20Directory">Your program's working directory</a>.
65 <br><dt>The <em>standard input and output.</em>
66 <dd>Your program normally uses the same device for standard input and
67 standard output as GDB is using. You can redirect input and output
68 in the <code>run</code> command line, or you can use the <code>tty</code> command to
69 set a different device for your program.
70 See <a href="Input-Output.html#Input%2fOutput">Your program's input and output</a>.
72 <p><em>Warning:</em> While input and output redirection work, you cannot use
73 pipes to pass the output of the program you are debugging to another
74 program; if you attempt this, GDB is likely to wind up debugging the
75 wrong program.
76 </dl>
78 <p>When you issue the <code>run</code> command, your program begins to execute
79 immediately. See <a href="Stopping.html#Stopping">Stopping and continuing</a>, for discussion
80 of how to arrange for your program to stop. Once your program has
81 stopped, you may call functions in your program, using the <code>print</code>
82 or <code>call</code> commands. See <a href="Data.html#Data">Examining Data</a>.
84 <p>If the modification time of your symbol file has changed since the last
85 time GDB read its symbols, GDB discards its symbol
86 table, and reads it again. When it does this, GDB tries to retain
87 your current breakpoints.
89 </body></html>