Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
around '=' are used for clarity here; they are not
actually required.)
unset environment varname Remove variable varname from the environment
to be passed to your program. This is different
from 'set env varname ='; unset
environment removes the variable from the
environment, rather than assigning it an empty
value.
path directory Add directory to the front of the PATH
environment variable (the search path for
executables), for both GDB and your program.
You may specify several directory names,
separated by whitespace or by a
system-dependent separator character (`:' on Unix,
`;' on MS-DOS and MS-Windows). If directory
is already in the path, it is moved to the front, so
it is searched sooner.
You can use the string '$cwd' to refer to whatever is the current working directory at the
time GDB searches the path. If you use '.' instead, it refers to the directory where you
executed the path command. GDB replaces '.' in the directory argument (with the current
path) before adding directory to the search path.
4.5 Working directory
Each time you start your program with run, it inherits its working directory from the
current working directory of GDB. The GDB working directory is initially whatever it
inherited from its parent process (typically the shell), but you can specify a new working
directory in GDB with the cd command.
The GDB working directory also serves as a default for the commands that specify files
for GDB to operate on. See “Commands to specify files” (page 118).
Following commands are used to set the working directory for your program:
cd directory Set the GDB working directory to directory.
pwd Print the GDB working directory.
4.6 Program Input and Output
By default, the program you run under GDB does input and output to the same terminal
that GDB uses. GDB switches the terminal to its own terminal modes to interact with you,
but it records the terminal modes your program was using and switches back to them
when you continue running your program.
Following commands are used for redirecting the input and output:
38 Running Programs Under GDB