[CMake] Relative paths in debug info

Mathias Lafeldt misfire at debugon.org
Fri Jul 2 05:49:22 EDT 2010


Michael Wild wrote:
> On 2. Jul, 2010, at 9:46 , Mathias Lafeldt wrote:
> 
>> Hello,
>>
>> is it possible to tell CMake to write relative source file paths in the
>> debug information of an object file (aka .mdebug section)?
>>
>> Here's a sample object file:
>>
>> $ strings -a build/CMakeFiles/config.dir/src/strbuf.c.o | grep home
>> /home/foo/bar/src/strbuf.c
>>
>> Instead of the absolute file path, I'd like to see "src/strbuf.c" or
>> "strbuf.c".
>>
>> This is especially interesting when providing binaries that can be
>> debugged by other people with different file paths.
>>
>> Maybe it's a special gcc option?
>>
>> Btw, CMAKE_USE_RELATIVE_PATHS doesn't do it.
>>
>> -Mathias
> 
> 
> I never used it, but the GCC option -fdebug-prefix-map=old=new might be what you need. But actually, that's the wrong list to ask ;-)
> 
> HTH
> 
> Michael

Though this option looks promising, my cross gcc version (3.2.2) doesn't
support it.

Thanks anyway.

-Mathias


More information about the CMake mailing list