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
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.
Set the GDB working directory to directory. If not given, directory uses '~'.
Print the GDB working directory.
It is generally impossible to find the current working directory of
the process being debugged (since a program can change its directory
during its run). If you work on a system where GDB is
configured with the /proc support, you can use the
proc command (see SVR4 Process Information) to find out the
current working directory of the debuggee.