rainers / cv2pdb

converter of DMD CodeView/DWARF debug information to PDB files
Artistic License 2.0
472 stars 109 forks source link

Using separate DWARF debugging symbols as input #17

Open jtanx opened 7 years ago

jtanx commented 7 years ago

If I have a stripped executable with its DWARF debugging symbols as a separate file (stripped via objcopy), would it be possible to convert those into PDB symbols instead? Thanks!

rainers commented 7 years ago

What's your command line for keeping debug symbols in a separate file? I haven't found anything appropriate with --help.

If you want to ship an executable with stripped debug info, but keep the PDB for later crash dump analysis, have you tried to reverse the steps? Generate the PDB with cv2pdb, then strip DWARF info could work (or need a lot less changes).

jtanx commented 7 years ago

I am using mingw-w64 from the msys2 project, specifically objcopy and strip from the binutils package (mingw-w64-i686-binutils).

To extract the symbols, I run:

objcopy --only-keep-debug my-binary.exe my-binary.debug

To strip the binary, I run:

strip my-binary.exe -so my-stripped-binary.exe

But I think you can also just make use of objcopy only, maybe:

objcopy --strip-all my-binary.exe my-stripped-binary.exe

I hadn't thought about the reverse method of generating the PDB first, then stripping the DWARF symbols - I'll keep that in mind, thanks!

foxeed commented 7 years ago

@jtanx hello, is the suggested method of converting to PDB and only then stripping the debug symbols working? I am facing the same problem and wonder if I need to modify the cv2pdb or not.

jtanx commented 7 years ago

@foxeed I'm unaware of any changes to converting separate DWARF symbols. I haven't tried the other method, but I don't see why it won't work

excitoon commented 2 years ago

You can not use separate DWARF symbols because you have to understand exactly where linker relocates the object data to.

By mistake