3

Say I have a build machine and test machine and the source code is only on the build machine. (Linux)

I have a debug build C/C++ executable and I want to run it with gdb on the test machine.

In the debugger running on the test machine it is still looking for the actual source files which are not there.

Is there a way to have g++ actual include the source in the executable itself with the other debug information so files are not needed?

2 Answers 2

4

There is no way to have the source compiled into the binary to allow gdb debugging in this manner.

Probably the best mechanism in this case is to use gdbserver - which allows you to run the application remotely and debug it on the build machine.

If you can't use remote debugging, then an alternative is to mount the directory containing the source on the test machine, and then use the set substitute-path to map the directory that the test machine has vs. the build machine.

Sign up to request clarification or add additional context in comments.

Comments

2

No, but the good news is that is no necessary. You should set your source path. It should accept a network path.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.