sigil
sigil

Reputation: 9546

Trying to debug VBA that calls a C++ DLL, "wntdll.pdb not loaded"

This is kind of a long explanation, but I'm not exactly sure where the problem is in my debugging process.

I have an Excel macro that calls a function in a C++ DLL. Every time it calls this function, the Excel instance abruptly force-quits with no warning or error message. I'm trying to track down what's happening by setting the debugging in Visual Studio Express as follows:

Configuration Properties->Debugging->Command: C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE

Configuration Properties->C/C++->Browse information->Enable Browse Information: Yes (/FR)

I then start debugging by clicking on the function I want to test, setting a breakpoint, and pressing F5. I get an error message telling me that debugging information is not available for Excel.exe, and I click "Yes" to continue debugging.

An Excel instance opens. The C++ breakpoint has now changed to a white "breakpoint will not be hit" circle. I open the workbook with my macro in it, and run the macro.

In Visual Studio, I get a message that EXCEL.EXE has triggered a breakpoint, which I guess is the breakpoint that I set in the C++ code, and I click on "Break". A new tab opens up, with the a message:

wntdll.pdb not loaded

At this point, the debugger will not continue, so I manually stop it, and Excel force-quits; the output window says

EXCEL.EXE has exited with code 0

I go into Debug options->Symbols and check the "Microsoft Symbol Server" box; I don't know which DLLs I will need symbols for, so I select "Automatically load symbols for all modules". I start the debugger.

I get the same message about debugging information not available for Excel, and then the Excel instance opens. I open the workbook again and start the macro. In the meantime, in VS there are a lot of DLLs' symbols getting loaded.

A tab pops up in VS that says:

Source not available
Source information is missing from the debug information in this module.

Maybe the right DLL's symbols haven't been loaded yet, but I don't want to wait for all the symbols to load; I tried that before and 10 minutes went by and the symbols were still loading.

Looking at the call stack, the following calls are most recent:

ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4()    Unknown
ntdll.dll!_RtlpLogHeapFailure@24()  Unknown

None of my C++ app's code has been called yet; these calls come immediately after the VBE7 and ole32 calls.

I just want to be able to debug my code and figure out why Excel is quitting. Can anyone make sense of what's happening here?

EDIT: here is the full call stack when the error occurs:

ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4()    Unknown
ntdll.dll!_RtlpLogHeapFailure@24()  Unknown
ntdll.dll!_RtlSizeHeap@12() Unknown
ole32.dll!CRetailMalloc_GetSize(IMalloc * pThis, void * pv) Line 710    C++
oleaut32.dll!APP_DATA::FreeCachedMem(void *,unsigned long)  Unknown
oleaut32.dll!_SysFreeString@4() Unknown
VBE7.DLL!_lblEX_FFreeStr()  Unknown
VBE7.DLL!_lblEX_VCallHresult()  Unknown
VBE7.DLL!_lblEX_ImpAdCall() Unknown
VBE7.DLL!InvokeImmedSub(struct RTMI *,class GEN_PROJECT *,class EXFRAME *,struct IDispatch *)   Unknown
VBE7.DLL!WATCHMGR::ExecuteImmedLogln(char * *,unsigned int,int,class GEN_PROJECT *,unsigned long,int,int,class WATCH *) Unknown
VBE7.DLL!ExecProcUnderCursor(void)  Unknown
VBE7.DLL!_EbInvokeItem@4()  Unknown
VBE7.DLL!CmdFDispatchCommand(unsigned short)    Unknown
VBE7.DLL!FTranslateAccelerator(struct tagMSG *,int) Unknown
VBE7.DLL!FRubyMsg(struct tagMSG *)  Unknown
VBE7.DLL!MainFTranslateMessage(struct tagMSG *,unsigned long)   Unknown
VBE7.DLL!CMsoComponent::FPreTranslateMessage(struct tagMSG *)   Unknown
EXCEL.EXE!2f9f874a()    Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for EXCEL.EXE] 
EXCEL.EXE!2f9f73f4()    Unknown
MSO.DLL!637b77f1()  Unknown
MSO.DLL!637e0143()  Unknown
EXCEL.EXE!2f990ec5()    Unknown
msvcr90.dll!___set_flsgetvalue()    Unknown
msvcr90.dll!__getptd_noexit()   Unknown
msvcr90.dll!__getptd()  Unknown
msvcr90.dll!_LocaleUpdate::_LocaleUpdate(struct localeinfo_struct *)    Unknown
msvcr90.dll!__ismbcalpha()  Unknown
msvcr90.dll!__ismbblead()   Unknown
0062430d()  Unknown
kernel32.dll!@BaseThreadInitThunk@12()  Unknown
ntdll.dll!___RtlUserThreadStart@8() Unknown
ntdll.dll!__RtlUserThreadStart@8()  Unknown

Upvotes: 0

Views: 17990

Answers (1)

BlueTrin
BlueTrin

Reputation: 10063

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program. Visual Studio is simply telling you that he could not find the related debugging information to allow you to debug with the source code.

I think wntdll.pdb relates to ntdll.dll, you can set the symbols directories in VS by going in Tools -> Options -> Debugging -> Symbols.

This page has some info, especially the part about using symchk.exe to download symbols:

Windows Debugging Symbols - Not Loading

Instructions about how to use symchk.exe are in:

http://support.microsoft.com/kb/311503

Now this problem may not be related to your crashes, I recommend you to use Process Monitor to monitor for messages from the process. This may greatly help you to pin point what went wrong.

Upvotes: 3

Related Questions