1

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

Cinder Biscuits
  • 4,577
  • 29
  • 47
Cascades
  • 529
  • 5
  • 15
  • If the lib files are statically linked then you will probably want the PDB files. If they are just for the linker and DLL's, then they are pointless and will never be generated, these LIB's are just `ar` archives storing all of the exported function names. – van dench Jan 23 '19 at 14:15
  • EXE's is enough, the pdb entries for the static library are merged into it. As long as you don't use the /DEBUG:FASTLINK linker option. – Hans Passant Jan 23 '19 at 17:15

1 Answers1

1

Check this answer. There are compile options.

If you use /ZI or /Zi (C/C++ -> General -> Debug Information Format), then the vc$(PlatformToolsetVersion).pdb is created, which contains the debug info for all of the .obj files created. If alternately you use /Z7, the debug info will be embedded into the .obj file, and then embedded into the .lib. This is probably the easiest way to distribute the debug info for a static library.

Michael Chourdakis
  • 9,693
  • 2
  • 38
  • 66