Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDB files with Libraries in Visual Studio 10

When building a static library (.LIB) in MS Visual Studio 10 with debug information, the .PDB is always named vc100.pdb.
(as opposed to building a .DLL, where the debug info is [MyProjectName].pdb)

This is a problem for me because I'm trying to copy several different libraries (and their debug symbols) to a directory of "PublishedLibraries", but all the vc100.pdb names obviously collide.

I'm sure I can change the names of each .PDB to match its .LIB, but for me the bigger question is why does Visual Studio think vc100.pdb is a better name than projectA.pdb??
How are we intended to work with Debug Info from multiple libraries if all the names conflict?

like image 412
abelenky Avatar asked Jun 11 '13 19:06

abelenky


People also ask

How do I use PDB files in Visual Studio?

The easiest way to use the PDB file is to let Visual Studio do the heavy lifting - either launch your program with Visual Studio's "Debug" command (F5 by default), or run the program and use the "Attach to Process" item in Visual Studio's Debug menu.

What does PDB file contains?

A typical PDB formatted file includes a large "header" section of text that summarizes the protein, citation information, and the details of the structure solution, followed by the sequence and a long list of the atoms and their coordinates.

How do I open a PDB file in Visual Studio?

In Visual Studio, open Tools > Options > Debugging > Symbols (or Debug > Options > Symbols).


1 Answers

If you use /Z7 (instead of /ZI or /Zi) [ in the UI C/C++ -> General -> Debug Information Format] then the debug information is embedded in the lib file itself, instead of a separate pdb, which means you don't need to worry about the same name.

When you build your final executable (.exe or .dll) then you'll get a merged pdb from all the little embedded pdbs.

see this question for more info

Its the way I've always managed this issue on my team, as you can't lose the debug information during the build process. It bloats the libs somewhat [but no more in total than having both lib and pdb], but as you probably don't ship libs you shouldn't worry to much about this.

like image 167
Mike Vine Avatar answered Oct 02 '22 22:10

Mike Vine