Relocate files in .debug_line section

265 Views Asked by At

Is it possible to change the file paths in a .debug_line section in an ELF file?

I'm trying to set up Debug Fission, so far I have my_library.so (in release mode, with no debug info) and my_library.so.dbg (with debug symbols). I've linked the two with

objcopy --add-gnu-debuglink=my_library.so.dbg

And I can see that gdb is correctly picking up symbols and line info from my_library.so.dbg both via manual inspection and checking the file accesses via

strace -o log gdb program_that_loads_my_library.so
cat log | grep my_library.so.dbg  # I see a 'stat' that returns a file

However, the build for my_library.so.dbg encodes file paths at a different location than I use to debug. Is there a way to relocate the file paths in my_library.so.dbg so that I can point it to an arbitrary directory? More specifically, all the files are in some directory during the build, say /build_dir/..., but when debugging I want to replace this with /home/myuser/local_checkout/.... Is this possible with objcopy? I didn't see anything about it in the manual

0

There are 0 best solutions below