Reputation: 149
I use another machine for development and deploy on another machine. How to set the source path in gdb to a different machine?
Note: The executable and the source program are on different machines. gdb only shows line number and shows error : no such file or directory
Upvotes: 0
Views: 1088
Reputation: 4781
If you want to view the source code on the development machine from the deployment machine you'll first need to provide access to the source code in some way outside of GDB, for example using network filesystem to mount the development machine's file system onto the deployment machine.
Alternatively you could copy the source code over along with the executable.
Once the source code is visible on the deployment machine, inside GDB you can use the directory
command to tell GDB were to find the source code.
For example, if on the development machine your source code is located in /project/file.c
, and on the deployment machine you mount and make this available as /mnt/devel-machine/project/file.c
, then in GDB you'd just do this:
(gdb) directory /mnt/devel-machine
after which GDB should be able to find the source code.
Upvotes: 2