I can set a breakpoint in main and debug the code with the correct source code, but I don\'t know where GDB is taking the source code from.
The source code is not pr
Use
(gdb) show directories
If you don't know where those directories are set, check your .gdbinit file to see if there are statements like
directory /path/to/source
See also this other Stack Overflow question about GDB.