The gdb command
file lets you choose with program to debug.
(gdbslet) file prog
gdb then attempts to read the symbol table of prog. gdb locates the file by searching the directories listed in the command search path. If the file was compiled with debug information (option ‘-g’), source files will be searched as well. gdb locates the source files by searching the directories listed in the directory search path (see Your Program's Environment). If it fails to find a file, it displays a message such as:
prog: No such file or directory.
When this happens, add the appropriate directories to the search paths with
the gdb commands
dir, and execute the
target command again.