c++compilationdwarf

Can different .dwo files be combined into a single one?


Background:

I have a need of the debugging information of the code in our project. The following two approaches are available:

  1. Compile using -g and afterwards use GNU binary utilities strip and objcopy to strip the debugging information into a separate file.
  2. Compile using -gsplit-dwarf

Question

The second approach creates a .dwo for each translation unit in the application. Although this would improve the linker time. But with the huge number of translation files, this would create management headache for us.

Is there a way to combine all the .dwo files into a single file per binary ?

System Info

Compiler : GCC toolchain.

OS: CentOS/RH 7/8


Solution

  • The tool you're looking for is called dwp. It collects your .dwo files into a .dwp file ("DWARF package"). .dwp files can themselves be combined into larger .dwp files if needed.

    It should come with non-ancient binutils packages.