Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VS debugger – Identify DLL function names from DLL exports (no PDB available)

I have a segfault in a mess of DLLs that I unfortunately cannot acquire .pdb files for. While I have a stack trace, this is unhelpful as I can’t pin down exactly where things are going wrong. I am wondering if there’s any way to use the DLL to associate sections of the code with specific exported functions, preferably automatically.

For instance, it seems to me that I could GetProcAddress on all the exported functions listed in dumpbin /exports problematicDll.dll, and then manually compare the resulting function pointers to the location the code actually jumps to. This would identify (exported) functions in the stack trace.

Does any tool like this already exist? Am I missing an important step of the DLL load process that would make this impossible? Thanks!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can have VS resolve the exports, go into Tools -> Options, then Debugging -> General.

Make sure the "Load dll exports (Native only)" item is checked.

Note that this will only resolve functions that are actually exported. If the exported function calls some non-exported function in the DLL you won’t be getting a name for that function. Also, there are some (rare) ways to generate code at run-time that this also won’t resolve, but those shouldn’t be exported, at most you would be getting such a function as a function pointer used as a callback.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading