|Debugging with GDB|
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.
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.