How to debug code of static library (libeay32.lib

2019-07-20 03:43发布

问题:

I have built openssl static libraries(libeay32.lib and ssleay32.lib) with openssl source code using VC++ compiler. I use them in a VS2010 project and they works well.

#pragma comment( lib, "libeay32.lib" )
#pragma comment( lib, "ssleay32.lib" )

Then problem is I want to debug the source code of openssl libraries in VS2010(step into, step over...). For example, set a breakpoint in the openssl api and then step into the openssl source file. how can I achieve that?

I have tried to use VS compiler option 'Zi' to generate some .pdb files when building openssl static libraries, but I don't know how to use them. I tried to add the path of those .pdb files in Option->Debugging->Symbols->Symbol file location, but seems it doesn't work.

回答1:

See Jared's answer at How to debug external class library projects in visual studio?. In short:

  • Debug -> Windows -> Modules
  • Find the DLL for the project you are interested in
  • Right Click -> Load Symbols -> Select the Path to the .PDB for your other project

Also, make sure the PDB files are in the same directory as libeay32.lib and ssleay32.lib.

Finally, if you are really having trouble, try Thomas Hruska's The Win32 OpenSSL Installation Project. Thomas prebuilds everything for you and packages it in a Windows installer.