• 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>Environment - 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="Running.html#Running" title="Running">
9<link rel="prev" href="Arguments.html#Arguments" title="Arguments">
10<link rel="next" href="Working-Directory.html#Working-Directory" title="Working Directory">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Free Software'' and ``Free Software Needs
19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
20and with the Back-Cover Texts as in (a) below.
21
22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
23this GNU Manual.  Buying copies from GNU Press supports the FSF in
24developing GNU and promoting software freedom.''
25-->
26<meta http-equiv="Content-Style-Type" content="text/css">
27<style type="text/css"><!--
28  pre.display { font-family:inherit }
29  pre.format  { font-family:inherit }
30  pre.smalldisplay { font-family:inherit; font-size:smaller }
31  pre.smallformat  { font-family:inherit; font-size:smaller }
32  pre.smallexample { font-size:smaller }
33  pre.smalllisp    { font-size:smaller }
34  span.sc    { font-variant:small-caps }
35  span.roman { font-family:serif; font-weight:normal; } 
36  span.sansserif { font-family:sans-serif; font-weight:normal; } 
37--></style>
38<link rel="stylesheet" type="text/css" href="../cs.css">
39</head>
40<body>
41<div class="node">
42<a name="Environment"></a>
43<p>
44Next:&nbsp;<a rel="next" accesskey="n" href="Working-Directory.html#Working-Directory">Working Directory</a>,
45Previous:&nbsp;<a rel="previous" accesskey="p" href="Arguments.html#Arguments">Arguments</a>,
46Up:&nbsp;<a rel="up" accesskey="u" href="Running.html#Running">Running</a>
47<hr>
48</div>
49
50<h3 class="section">4.4 Your Program's Environment</h3>
51
52<p><a name="index-environment-_0028of-your-program_0029-121"></a>The <dfn>environment</dfn> consists of a set of environment variables and
53their values.  Environment variables conventionally record such things as
54your user name, your home directory, your terminal type, and your search
55path for programs to run.  Usually you set up environment variables with
56the shell and they are inherited by all the other programs you run.  When
57debugging, it can be useful to try running your program with a modified
58environment without having to start <span class="sc">gdb</span> over again.
59
60     
61<a name="index-path-122"></a>
62<dl><dt><code>path </code><var>directory</var><dd>Add <var>directory</var> to the front of the <code>PATH</code> environment variable
63(the search path for executables) that will be passed to your program. 
64The value of <code>PATH</code> used by <span class="sc">gdb</span> does not change. 
65You may specify several directory names, separated by whitespace or by a
66system-dependent separator character (&lsquo;<samp><span class="samp">:</span></samp>&rsquo; on Unix, &lsquo;<samp><span class="samp">;</span></samp>&rsquo; on
67MS-DOS and MS-Windows).  If <var>directory</var> is already in the path, it
68is moved to the front, so it is searched sooner.
69
70     <p>You can use the string &lsquo;<samp><span class="samp">$cwd</span></samp>&rsquo; to refer to whatever is the current
71working directory at the time <span class="sc">gdb</span> searches the path.  If you
72use &lsquo;<samp><span class="samp">.</span></samp>&rsquo; instead, it refers to the directory where you executed the
73<code>path</code> command.  <span class="sc">gdb</span> replaces &lsquo;<samp><span class="samp">.</span></samp>&rsquo; in the
74<var>directory</var> argument (with the current path) before adding
75<var>directory</var> to the search path. 
76<!-- 'path' is explicitly nonrepeatable, but RMS points out it is silly to -->
77<!-- document that, since repeating it would be a no-op. -->
78
79     <p><a name="index-show-paths-123"></a><br><dt><code>show paths</code><dd>Display the list of search paths for executables (the <code>PATH</code>
80environment variable).
81
82     <p><a name="index-show-environment-124"></a><br><dt><code>show environment </code><span class="roman">[</span><var>varname</var><span class="roman">]</span><dd>Print the value of environment variable <var>varname</var> to be given to
83your program when it starts.  If you do not supply <var>varname</var>,
84print the names and values of all environment variables to be given to
85your program.  You can abbreviate <code>environment</code> as <code>env</code>.
86
87     <p><a name="index-set-environment-125"></a><br><dt><code>set environment </code><var>varname</var> <span class="roman">[</span><code>=</code><var>value</var><span class="roman">]</span><dd>Set environment variable <var>varname</var> to <var>value</var>.  The value
88changes for your program only, not for <span class="sc">gdb</span> itself.  <var>value</var> may
89be any string; the values of environment variables are just strings, and
90any interpretation is supplied by your program itself.  The <var>value</var>
91parameter is optional; if it is eliminated, the variable is set to a
92null value. 
93<!-- "any string" here does not include leading, trailing -->
94<!-- blanks. Gnu asks: does anyone care? -->
95
96     <p>For example, this command:
97
98     <pre class="smallexample">          set env USER = foo
99</pre>
100     <p class="noindent">tells the debugged program, when subsequently run, that its user is named
101&lsquo;<samp><span class="samp">foo</span></samp>&rsquo;.  (The spaces around &lsquo;<samp><span class="samp">=</span></samp>&rsquo; are used for clarity here; they
102are not actually required.)
103
104     <p><a name="index-unset-environment-126"></a><br><dt><code>unset environment </code><var>varname</var><dd>Remove variable <var>varname</var> from the environment to be passed to your
105program.  This is different from &lsquo;<samp><span class="samp">set env </span><var>varname</var><span class="samp"> =</span></samp>&rsquo;;
106<code>unset environment</code> removes the variable from the environment,
107rather than assigning it an empty value. 
108</dl>
109
110   <p><em>Warning:</em> On Unix systems, <span class="sc">gdb</span> runs your program using
111the shell indicated
112by your <code>SHELL</code> environment variable if it exists (or
113<code>/bin/sh</code> if not).  If your <code>SHELL</code> variable names a shell
114that runs an initialization file&mdash;such as <samp><span class="file">.cshrc</span></samp> for C-shell, or
115<samp><span class="file">.bashrc</span></samp> for BASH&mdash;any variables you set in that file affect
116your program.  You may wish to move setting of environment variables to
117files that are only run when you sign on, such as <samp><span class="file">.login</span></samp> or
118<samp><span class="file">.profile</span></samp>.
119
120   </body></html>
121
122