How do I trace into an externally-compiled lib in Visual C++
I built开发者_如何学Python 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
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.
When you built OpenSSL, where did you specify the symbol file should go? Is it in the same directory as your executable?
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.
精彩评论