Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are .pdb files required for .lib (static libraries) or are the dll/exe's pdb files enough?

I know, roughly, that when statically linking to a .lib from an .exe the code is placed in the .exe (missing some detail of course).

But when getting a stack trace from something like WinDbg, do i need to have a pdb for both the exe AND the lib, or will the pdb for the exe contain the information from the pdb for the lib (in the same way the exe contains the lib)?

I'm asking because in Debug building with MSVC (using CMake) I get pdbs for my .libs, .ddls, .exes but in release I can only get ones for the .dlls and .exes

like image 395
Cascades Avatar asked Nov 01 '25 20:11

Cascades


1 Answers

My company builds releases with debug info enabled,
But embedding the debug info (with /Z7) was not an option for us,
because we don't want to make Reverse-engineering simple.

Hence, we tested manually, like:

  • We created a very small App.
  • Then, built it once as is, to generate App's *.pdb file.
  • And built it another time, but with linking to a huge static library, to generate App's *.pdb again.
  • Where said static library had it's own *.pdb file.
  • At last, we compared the size of *.pdb files.

Conclusion:

The size of the said App's *.pdb file became huge,
meaning, the static library's *.pdb file was embedded.

Either that, or MSVC has huge bugs ;-)

One could go even further, and add an intentional crash to said static-library, to see if *.dmp file's stack-trace can really be converted to file-path and line-number, but above was enough evidence for us.

like image 72
Top-Master Avatar answered Nov 04 '25 20:11

Top-Master



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!