4 ms·
Yes. You can separate the debug info from an object file with objcopy: objcopy --only-keep-debug foo.o foo.o.debug objcopy --strip-debug --add-gnu-debu
by 10000truths 5y ago
Yes. You can separate the debug info from an object file with objcopy:
objcopy --only-keep-debug foo.o foo.o.debug
objcopy --strip-debug --add-gnu-debuglink=foo.o.debug foo.o
And then link foo.o as normal. GDB should automatically be able to pick up the debug file by looking at the debug link.
For more info, here's a link:
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Fil...
You can also use gcc's -gsplit-dwarf command line option when compiling to produce a .dwo file containing your debug information:
https://gcc.gnu.org/wiki/DebugFission https://gcc.gnu.org/wiki/DebugFission
- ceztko 5y agoI wanted to ask you if the "-gsplit-dwarf" is a 100% complete alternative to strip the symbols as done previously. I ask you because some modern projects[1] still prefer to compile with symbols and strip afterward. [1] https://github.com/dotnet/runtime/blob/main/eng/native/functions.cmake https://github.com/dotnet/runtime/blob/main/eng/native/funct...