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!
CodePudding user response:
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.