0

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
sigil
  • 9,370
  • 40
  • 119
  • 199
  • can you give full call stack when error occurs? – Iłya Bursov Nov 01 '13 at 18:26
  • @IlyaBursov, just posted it. – sigil Nov 01 '13 at 18:36
  • `0062430d() Unknown` looks suspicious, but cannot tell for sure, try another approach: run excel without debug, then use studio to `attach to process`, then try to execute excel macro – Iłya Bursov Nov 01 '13 at 18:39
  • @IlyaBursov, when I do that, none of the breakpoints are hit and Excel just quits. However, the DLL calls from the macro are executing--one of them involves creating a file, and that file is being generated. – sigil Nov 01 '13 at 18:56
  • Try following: at the very start of dll function add call to winapi [DebugBreak](http://msdn.microsoft.com/en-us/library/windows/desktop/ms679297(v=vs.85).aspx), compile your dll in debug mode, try to run excel and macro, you will get a message about breakpoint reached and then click debug/retry - don't remember exactly which button will appear – Iłya Bursov Nov 01 '13 at 19:06
  • Ok, I tried that. I didn't get a message about breakpoint reached; all I got was "Microsoft Excel has stopped working." – sigil Nov 01 '13 at 19:39
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/40397/discussion-between-sigil-and-ilya-bursov) – sigil Nov 01 '13 at 19:42

1 Answers1

3

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.

Community
  • 1
  • 1
BlueTrin
  • 9,610
  • 12
  • 49
  • 78
  • I downloaded Process Monitor, and I ran the same debugging method I described above. I'm not sure how to interpret the messages. Towards the end, there are a lot of WDEXPRESS.EXE and EXCEL.EXE messages that say "Close File". What should I be looking for? – sigil Nov 01 '13 at 19:25
  • It is hard to tell because you do not have enough information to narrow down at the moment. Did you try to stop on exceptions in visual studio ? Do you have the code of the DLL you called ? Try to filter in ProcMon on the DLL as well. – BlueTrin Nov 02 '13 at 03:00