views:

59

answers:

3

Visual Studio compiles the projects into dlls as I want it to, but when I inspect these dlls with dumpbin, then they do not have an entry for their pdbs, which is probably the reason why I cannot debug any of those dlls if I load them at runtime and their pdbs are never loaded. How can I get VS to write these paths?

Visual Studio, C++.

Edit: C++/General/Debug Information format ist set to "Program Database (/Zi)" and Linker/Debugging/Generate Debug Info are on "Yes (/DEBUG)", which I believe are correct.

A: 

The pdbs aren't referenced in the dll, they get searched by Visual Studio. If they are in the same directory, it should find them.

Femaref
I have tried to copy them into the same directory, but they would not get loaded. This might be a different issue though, that the dynamic loading through winbase::LoadLibrary() does not load them in the first place?
Kdansky
This might be possible.
Femaref
A: 

You can direct Visual Studio on where to look for your symbols per this article. In summary:

Click Symbol File Path on the File menu to display, set, or append to the symbol path.

A more comprehensive overview of how symbols get used is here.

There should be info in the Output window on what happened when your DLL got loaded. Perhaps it's not the version you expected?

Steve Townsend
A: 

If dumpbin /headers shows no entry in the Debug Directories, it is probably because you did not enable debug information generation at compile and link time. You should check the C++/General/Debug Information format and the Linker/Debugging/Generate Debug Info options.

If these options are set, you may check if the dll and the pdb in the output directory of Visual match. With the Debugging Tools for Windows, you can use the command symchk /v yourdll /s folder_containing_pdb to verify if the pdb can be found by the debugger engine. It will check if the dll does not contain debug information, in which case you are missing an option in Visual Studio, or if the pdb file is not complete. You can also use Windbg with the command !sym noisy. See here for detailed instructions.

plodoc
C++/General/Debug Information format ist set to "Program Database (/Zi)" and Linker/Debugging/Generate Debug Info are on "Yes (/DEBUG)".As far as I know, these are the correct values. I hoped this was the issue, but sadly, it is not.
Kdansky
So the pdb file are generated, and you can find them beside the dll files ?
plodoc
symchk cannot find them, even when I point it to the exact path of the pdb file (after doing a plain old file search to actually find it myself).
Kdansky
I made some tests with Visual Studio 2010 C++ projects. As soon as the linker /DEBUG option is set, a pdb file is generated and a debug section is added to the dll referencing the pdb file. To me it seems the pdb you are seing is not the one associated to the configuration that compiled the dll.
plodoc