Reputation: 21
anyone knows the relative path within the debug info depends on compiler or makefile ?
i like relative info, because i can put my project everywhere;
but sometimes, debugger can't find source code due to the dismatching path.
I don't know who controls using relative path or absolute path in debug info, maybe the compiler, maybe makefile, and maybe both;
anyone knows exactly?
Upvotes: -1
Views: 325
Reputation: 213879
anyone knows exactly?
You didn't provide sufficient details in your question to answer it exactly.
The Makefile
defines the command your make will execute.
If you execute $(CC) -g -c foo.c -o foo.o
, then most compilers will
encode relative path foo.c
into the object file. Some compilers
will also encode current compilation directory, so the debugger can
find the original foo.c
even after you've copied the binary
somewhere else (gcc
on Linux will do that, as would most other
compilers that use DWARF
debug info).
On the other hand, if you Makefile
executes $(CC) -g -c /path/to/src-directory/foo.c -o /path/to/obj-dir/foo.o
, then most compilers will encode full path into the object file.
Upvotes: 0
Reputation: 99154
Your question is a little fuzzy around the edges, but...
With the compiler and debugger I use, the choice of relative or absolute is determined by the paths passed to the compiler. So if you want to change the behavior, you have to change the command which invokes the compiler, which means changing the command in the makefile.
Upvotes: 0