Gcc / gdb: How to insert an absolute path into the source file in debugging information?

I'm just wondering if I can tell gcc to insert the absolute path to the source file in the debug information, even if I call gcc as

gcc -g ../src/somecode.c -o ../bin/somecode.o 

As I can see, atm, gcc just keeps what you provide, so if you provide a relative path, at the end gdb knows only the relative path.

Is there a way around this without using absolute paths when compiling? for example: let gcc look for the full path?

thanks in advance RTI

+5
source share
2 answers
gcc -fdebug-prefix-map=..=$(readlink -f ..)
+3
source

? , , , , , , , .

-g .

0

All Articles