Re: How to debug a .LIB that is linked to an EXE?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




In addition to what Gary and David have already said, it might be important
to know how to produce debug information for the .lib file. You can use
either /Z7 compiler option, or /Zi together with /Fd (they can be set up also
in the IDE).

If you compile the library with /Z7, debug information gets embedded into
the .lib file, and thus cannot be lost if you e.g. distribute the library to others,
or save it in a source control system.

If you compile with /Zi, debug information will be stored in a separate file
(vcxx.pdb by default, where "xx" is the version number of VS), and you
have to store/copy this file with the library to make sure that it is not lost.
Usually it also makes sense to use /Fd option to change the default name of
the .pdb file to something that contains the name of the library.

By default, debug builds of library projects use yet another option,
/ZI, which is the same as /Zi but also puts Edit&Continue information
into the resulting .pdb file.

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]




.



Relevant Pages

  • Re: failing application registering weird messages in the event log
    ... Make sure that the .PDB file is not copied to the target machines. ... debug information can be either in the executable ... The recommended way is to use the following linker options: ...
    (microsoft.public.vc.language)
  • Re: StackWalk64 doesnt work without pdb files?!?
    ... > I run my compiled prograwm and it prints her stack trace. ... > when i remove the pdb file - the trace is partially printed ... VC++ 2003 linker cannot put debug information into the executable. ... Even if you use /Z7 compiler option, ...
    (microsoft.public.vsnet.debugging)
  • Re: Visual C++ 6.0, Debug Symbols, XP SP2
    ... > it must open the pdb file to make this determination. ... In brief, the executable contains debug information record, ... which describes what debug information format is used, ...
    (microsoft.public.vc.debugger)
  • Re: Is it possible to have debug information in Release build completely separated
    ... I understand that at least path to pdb file should be ... generate separate debug information in Release build resulted in significant ... Regards, ...
    (microsoft.public.vc.debugger)
  • Re: debug infromation missing.
    ... I searched for debug information file, and i saw that a .pdb file was ... breakpoints, and when it stops in these points, the code is not ...
    (microsoft.public.windowsce.platbuilder)