views:

169

answers:

3

I built the non-dll version of OpenSSL on my windows box. Per the instructions I modified the build script to include debug symbols. I can link against them fine and they run. But when I try to step into an openssl function from my cpp code it just steps over. I know this is a total noob question but how do I fix this? I have all the source and headers but I think there must be magic invocation I'm missing to tell Visual Studio where they are. Or something.

Thanks! Mac-guy-suffering-in-windows-land

A: 

When you built OpenSSL, where did you specify the symbol file should go? Is it in the same directory as your executable?

jmucchiello
Nope. So should I move it, or can I point VC at it, or do I need to rebuild the lib and have it output everything where VC will expect to find it? Thanks for the quick answer, BTW. Figured it had to be something dumb on my part.
Mike
the symbol (pdb) file does not require to be in the same directory: it's path is hardcoded into the executabe/dll
stijn
What I have is a .lib (2 actually). I'm looking at the file in a hex editor and I don't see the pdb file name - should it be visible? Thanks again for the help!
Mike
A: 

Symbol files (pdb's) only exist for modules (exe's and dll's) not for object files. A library is just a collection of .obj files.

If the source was compiled with debugging information then that is embedded in the .obj files which the linker will pull out into the final pdb. All you need is the pdb for your exe to be able to see symbols for the OpenSSL code.

You will need to set the source path in the debugger to include the OpenSSL directory in order to be able to line these symbols up with source.

If you are using Visual Studio make sure the 'Debug only my code' option (or something like that) is disabled in the debugger settings ... though I don't think this affects code compiled into your exe. More likely the debugger just doesn't know where the source is to step into.

Rob Walker
+1  A: 

You can use dumpbin with the /pdbpath option to locate the symbols file for a binary; if it can't find the symbols, you need to move them to where it can find them.

The PDB path is generally hardcoded into the binary, so you can't move the PDBs after you have built an executable. You can use the (undocumented) /pdbpath:none linker option to have a binary built with a relative path to its PDB file; then you can place the PDB alongside the binary and the debugger should find it.

Note that PDB files are only generated if the binary is linked with the /DEBUG option.

James McNellis