GCC includes the path to the source file that was used to generate an object file in its DWARF debug information (when compiled with -g).
However, GDB's search rules mean that I have to use the lesser-known set subsitute-path
if I moved the source-code to a different subdirectory. Alternatively, maybe I want to hide some path information of my source files, of maybe just shorten it.
Does GCC provide an option to change the source path it includes in debug information of a binary?
Use the -fdebug-prefix-map=old_path=new_path
option to GCC.
As far as I can find, LLVM/Clang does not provide an equivalent option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With