Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Environment.html
blobb49bc295ecfd7b1e11d278685f685fdcdee66ef7
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="Environment">Environment</a>,
13 Next:<a rel="next" accesskey="n" href="Working-Directory.html#Working%20Directory">Working Directory</a>,
14 Previous:<a rel="previous" accesskey="p" href="Arguments.html#Arguments">Arguments</a>,
15 Up:<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Your program's environment</h3>
21 <p>The <dfn>environment</dfn> consists of a set of environment variables and
22 their values. Environment variables conventionally record such things as
23 your user name, your home directory, your terminal type, and your search
24 path for programs to run. Usually you set up environment variables with
25 the shell and they are inherited by all the other programs you run. When
26 debugging, it can be useful to try running your program with a modified
27 environment without having to start GDB over again.
29 <dl>
30 <dt><code>path </code><var>directory</var><code></code>
31 <dd>Add <var>directory</var> to the front of the <code>PATH</code> environment variable
32 (the search path for executables) that will be passed to your program.
33 The value of <code>PATH</code> used by GDB does not change.
34 You may specify several directory names, separated by whitespace or by a
35 system-dependent separator character (<code>:</code> on Unix, <code>;</code> on
36 MS-DOS and MS-Windows). If <var>directory</var> is already in the path, it
37 is moved to the front, so it is searched sooner.
39 <p>You can use the string <code>$cwd</code> to refer to whatever is the current
40 working directory at the time GDB searches the path. If you
41 use <code>.</code> instead, it refers to the directory where you executed the
42 <code>path</code> command. GDB replaces <code>.</code> in the
43 <var>directory</var> argument (with the current path) before adding
44 <var>directory</var> to the search path.
46 <br><dt><code>show paths</code>
47 <dd>Display the list of search paths for executables (the <code>PATH</code>
48 environment variable).
50 <br><dt><code>show environment </code>[<code></code><var>varname</var><code></code>]<code></code>
51 <dd>Print the value of environment variable <var>varname</var> to be given to
52 your program when it starts. If you do not supply <var>varname</var>,
53 print the names and values of all environment variables to be given to
54 your program. You can abbreviate <code>environment</code> as <code>env</code>.
56 <br><dt><code>set environment </code><var>varname</var><code> </code>[<code>=</code><var>value</var><code></code>]<code></code>
57 <dd>Set environment variable <var>varname</var> to <var>value</var>. The value
58 changes for your program only, not for GDB itself. <var>value</var> may
59 be any string; the values of environment variables are just strings, and
60 any interpretation is supplied by your program itself. The <var>value</var>
61 parameter is optional; if it is eliminated, the variable is set to a
62 null value.
64 <p>For example, this command:
66 <pre class="example"> set env USER = foo
67 </pre>
69 <p>tells the debugged program, when subsequently run, that its user is named
70 <code>foo</code>. (The spaces around <code>=</code> are used for clarity here; they
71 are not actually required.)
73 <br><dt><code>unset environment </code><var>varname</var><code></code>
74 <dd>Remove variable <var>varname</var> from the environment to be passed to your
75 program. This is different from <code>set env </code><var>varname</var><code> =</code>;
76 <code>unset environment</code> removes the variable from the environment,
77 rather than assigning it an empty value.
78 </dl>
80 <p><em>Warning:</em> On Unix systems, GDB runs your program using
81 the shell indicated
82 by your <code>SHELL</code> environment variable if it exists (or
83 <code>/bin/sh</code> if not). If your <code>SHELL</code> variable names a shell
84 that runs an initialization file--such as <code>.cshrc</code> for C-shell, or
85 <code>.bashrc</code> for BASH--any variables you set in that file affect
86 your program. You may wish to move setting of environment variables to
87 files that are only run when you sign on, such as <code>.login</code> or
88 <code>.profile</code>.
90 </body></html>