1) Without symbols
a) The faulting Stack
The stack backtrace of the thread that caused the Divide-ByZero Exception would look like:
0:022> kvn50
# ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
00 01e8f0f4 02032a70 00000001 7a643d73 31765f31 badcom!DllUnregisterServer+0x148b
01 01e8f124 779d7b9d 0040b370 00408be8 00000000 badcom!DllUnregisterServer+0xcf3
02 01e8f140 77a22c42 0040b370 00000024 00000004 OLEAUT32!DispCallFunc+0x15d
03 01e8f1d0 020325d0 000bf7ac 0040b370 00000003 OLEAUT32!ClearCustData+0x588
04 01e8f1f8 6b61dff3 0040b370 00000003 6b659388 badcom!DllUnregisterServer+0x853
05 01e8f274 6b62171a 00408770 0040b370 00000003 vbscript!DllRegisterServer+0x844c
06 01e8f954 01e8b0a0 0040a5e8 00000000 7800ffb8 vbscript!DllRegisterServer+0xbb73
07 00000000 00000000 00000000 00000000 00000000 0x1e8b0a0
In this stack backtrace, it is clear that the culprit is "badCom.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help
from Microsoft, they should open an advisory case to troubleshoot the issue further.
b) The regiters values
0:022> r
eax=00000001 ebx=00000003 ecx=00000000 edx=00000000 esi=78002041 edi=0040ac90
eip=02033208 esp=01e8f0f4 ebp=01e8f0f4 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00010246
badcom!DllUnregisterServer+148b:
02033208 f7f9 idiv ecx
c) The disassmbly code
0:022> u eip
badcom!DllUnregisterServer+148b:
02033208 f7f9 idiv ecx
0203320a eb1d jmp badcom!DllUnregisterServer+0x14ac (02033229)
0203320c 837d0802 cmp dword ptr [ebp+0x8],0x2
02033210 7515 jnz badcom!DllUnregisterServer+0x14aa (02033227)
02033212 8d4508 lea eax,[ebp+0x8]
02033215 50 push eax
02033216 33c0 xor eax,eax
02033218 50 push eax
2) With symbols including public symbols of "badCom.dll"
First, we need to add the private symbol path(company wide symbols) as well as public symbols of our dll a) Using the GUI:
- Click "File"
- Click "Symbol File Path"
- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pub a
nd hit Enter
b) Using the ".sympath+" command:
.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pub
The stack backtrace of the thread that caused the DBZ exception would look like:
0:018> kvn50
# ChildEBP RetAddr Args to Child
00 01e8f0f4 02032a70 00000001 7a643d73 31765f31 badcom!doDZ1+0x1f
01 01e8f124 779d7b9d 0040b370 00408be8 00000000 badcom!CScenarios::processSc+0x226
02 01e8f140 77a22c42 0040b370 00000024 00000004 OLEAUT32!tPushValJmpTab+0xf5 [D:\OA\src\dispatch\WIN32\i386\invoke.asm @ 340]
03 01e8f1d0 020325d0 000bf7ac 0040b370 00000003 OLEAUT32!CTypeInfo2::Invoke+0x244 (CONV: stdcall) [D:\OA\src\typelib2\tiinvoke.cpp @ 629]
04 01e8f1f8 6b61dff3 0040b370 00000003 6b659388 badcom!ATL::IDispatchImpl::Invoke+0x41 (CONV: stdcall) [c:\nt\public\sdk\inc\atl30\atlcom.h @ 4093]
05 01e8f274 6b62171a 00408770 0040b370 00000003 vbscript!CatchIDispatchInvoke+0x9e (CONV: stdcall) [E:\vbscript\src\core\callout.h @ 111]
06 01e8f384 6b604038 0009001f 0000023f 00406060 vbscript!InvokeDispatch+0x330 (FPO: [EBP 0x6b659388] [7,60,4]) (CONV: stdcall) [E:\vbscript\src\vbscript\var.cpp @ 1211]
07 01e8f3c8 6b603156 00406060 0040b370 00000003 vbscript!GetDispatchDispID+0x1cc (FPO: [EBP 0x01e8f954] [4,3,4]) (CONV: stdcall) [E:\vbscript\src\vbscript\var.cpp @ 972]
08 01e8f970 78001045 00000000 0040b7f4 00000009 vbscript!CScriptRuntime::Run+0x3b8d (CONV: thiscall) [E:\vbscript\src\vbscript\interp.cpp @ 3347]
09 01e8f998 6b601ef7 00000009 01e8fa8c 00000000 MSVCRT!_nh_malloc+0x10 (FPO: [2,0,0]) (CONV: cdecl) [malloc.c @ 113]
0a 01e8f9c8 6b601c5c 00000000 00000000 00000000 vbscript!CScriptRuntime::Init+0x2e1 (FPO: [EBP 0x6b658a10] [6,0,4]) (CONV: thiscall) [E:\vbscript\src\vbscript\interp.cpp @ 904]
0b 01e8fb08 6b606fc5 00406060 6b606ef1 0040bfc0 vbscript!CScriptEntryPoint::Call+0x76 (FPO: [5,58,2]) (CONV: thiscall) [E:\vbscript\src\vbscript\entrypnt.cpp @ 40]
0c 01e8fb54 749f2e70 01911e90 6b610c9a 00000000 vbscript!CSession::GetGlobalEntryPoint+0x25 (FPO: [3,0,0]) (CONV: thiscall) [E:\vbscript\src\core\wrapper.cpp @ 485]
0d 01e8fb6c 749f3af0 01912060 01912060 012d1e90 asp!CResponse::Release+0x18 (FPO: [1,0,1]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\response.cpp @ 1716]
0e 01e8fb9c 74a22f5b 00000000 74a32c70 77e873a1 asp!CActiveScriptEngine::TryCall+0x15 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\scrptmgr.cpp @ 2040]
0f 01e8fbe0 749f3a72 00000000 01e8fc28 749f593d asp!CActiveScriptEngine::Call+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\scrptmgr.cpp @ 2005]
10 01e8fbec 749f593d 01e8fc4c 00000000 00000000 asp!CallScriptFunctionOfEngine+0x48 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 1394]
11 01e8fc28 749f54c8 01a11fa0 01591e90 01e8fc94 asp!ExecuteRequest+0x19e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 326]
12 01e8fc70 749fcf9b 01a11fa0 01591e90 01e8fc94 asp!Execute+0x17e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 190]
13 01e8fcc0 749fcc37 00000000 000bd020 01e8fd58 asp!CHitObj::ViperAsyncCallback+0x452 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\hitobj.cpp @ 2487]
14 01e8fcd8 787c214a 00000000 77acd455 01b51e90 asp!CViperAsyncRequest::OnCall+0x3f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\viperint.cpp @ 194]
15 01e8fce0 77acd455 01b51e90 77aa71a0 00000000 COMSVCS!STAActivityWorkHelper+0xa (FPO: [1,0,0]) (CONV: stdcall) [.\stathred.cpp @ 1321]
16 01e8fd24 77acd318 000751d8 00085860 787c2140 ole32!EnterForCallback+0x6a (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1758]
17 01e8fe50 77acd1dd 00085860 787c2140 01b51e90 ole32!SwitchForCallback+0x12b (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1643]
18 01e8fe78 77aac61a 00085860 787c2140 01b51e90 ole32!PerformCallback+0x50 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1558]
19 01e8fed4 77ad1185 000757c0 787c2140 01b51e90 ole32!CObjectContext::InternalContextCallback+0xf5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\context.cxx @ 3942]
1a 01e8fef4 787beff3 000757c0 787c2140 01b51e90 ole32!CObjectContext::DoCallback+0x1a (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\context.cxx @ 3798]
1b 01e8ff24 787c11ad 00010007 00000000 01e8ffec COMSVCS!STAActivityWork::DoWork+0x73 (FPO: [0,4,2]) (CONV: thiscall) [..\inc\STAThred.h @ 340]
1c 01e8ffb4 77e887dd 0088f364 00010007 00000000 COMSVCS!STAThread::STAThreadWorker+0x465 (FPO: [EBP 0x01e8ffec] [1,31,4]) (CONV: stdcall) [.\stathred.cpp @ 628]
1d 01e8ffec 00000000 787c0d48 0088f364 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\support.c @ 460]
Now, with the public symbols lined up, we see that the last call that caused the Divide-By-Zero Exception was to the function "doDZ1"
that was called from the class "CScenarios" by the method "ProcessSc()"
Again, In this call stack, it is clear that the culprit is "badCom.dll". So it is enough to tell the customer to contact the dll vendor to fix it. If it is an in-house component and the customer would like help
from Microsoft, they should open an advisory case to troubleshoot the issue further.
Advanced Technique
Maybe the most interesting finding in theis dump analysis -in addition determining the dll cause of the crash- is to determine the ASP page
the faulting thread was running. There are many ways to find that, let find the running ASP page by dumping the ASP template class.
In frame 12 The first parameter passed to "asp!execute()" is a pointer to the CTempate class.
Note: You could use the "kpn" command instead of "kvn" to see the parameters mane/value passed.
To dump the class CTemplate, do the following:
0:018> dt CTemplate 01a11fa0 -r
+0x000 __VFN_table : 0x749f6a40
+0x004 m_pLinkNext : 0x74a31978
+0x000 __VFN_table : 0x749f2fac
+0x004 m_pLinkNext : 0x01a11fa0
....
....
+0x098 m_rgpFilemaps : 0x01c72be0 -> 0x01a51e90
+0x000 m_szPathInfo : 0x01c72c08 "/IISDebugLabs/App/initcom.asp"
+0x004 m_szPathTranslated : 0x01c72c30 "C:\IISDEBUGLABS\WWW\APP\INITCOM.ASP"
+0x008 m_pfilemapParent : (null)
....
....
This shows that the faulting thread was running the ASP page: "C:\IISDEBUGLABS\WWW\APP\INITCOM.ASP"
To verify that the symbols are lined up properly for theh componsnt, issue this command.
0:016> lmv mbadcom
start end module name
02030000 02038000 badcom (pdb symbols) c:\iisdebuglabs\symbols\pub\badcom.pdb
Loaded symbol image file: badcom.dll
Image path: c:\IISDEB~1\www\app\badcom.dll
Timestamp: Tue Jun 10 22:45:51 2003 (3EE697DF) Checksum: 0000F229
File version: 1.0.0.1
Product version: 1.0.0.1
File flags: 0 (Mask 3F)
File OS: 4 Unknown Win32
File type: 2.0 Dll
File date: 00000000.00000000
CompanyName:
ProductName: badCOM
Module InternalName: badCOM
OriginalFilename: badCOM.DLL
ProductVersion: 1, 0, 0, 1
FileVersion: 1, 0, 0, 1
FileDescription: badCOM Module
LegalCopyright: Copyright 2003
3) with Private Symbols "badCom.dll"
First, we need to add the private symbol path(company wide symbols) as well as private symbols of our dll a) Using the GUI:
- Click "File"
- Click "Symbol File Path"
- Type in SRV*C:\LabSymbols*\\symbols\symbols;C:\IISDebugLabs\symbols\Pri a
nd hit Enter
b) Using the ".sympath+" command:
.sympath+ SRV*C:\LabSymbols*\\symbols\symbols;C :\IISDebugLabs\symbols\Pri
The stack backtrace of the thread that caused the DBZ would look like:
0:018> kvn50
# ChildEBP RetAddr Args to Child
00 01e8f0f4 02032a70 00000001 7a643d73 31765f31 badcom!doDZ1+0x1f (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\comDBG\scenarios.cpp @ 649]
01 01e8f124 779d7b9d 0040b370 00408be8 00000000 badcom!CScenarios::processSc+0x226 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\comDBG\scenarios.cpp @ 170]
02 01e8f140 77a22c42 0040b370 00000024 00000004 OLEAUT32!tPushValJmpTab+0xf5 [D:\OA\src\dispatch\WIN32\i386\invoke.asm @ 340]
03 01e8f1d0 020325d0 000bf7ac 0040b370 00000003 OLEAUT32!CTypeInfo2::Invoke+0x244 (CONV: stdcall) [D:\OA\src\typelib2\tiinvoke.cpp @ 629]
04 01e8f1f8 6b61dff3 0040b370 00000003 6b659388 badcom!ATL::IDispatchImpl::Invoke+0x41 (CONV: stdcall) [c:\nt\public\sdk\inc\atl30\atlcom.h @ 4093]
05 01e8f274 6b62171a 00408770 0040b370 00000003 vbscript!CatchIDispatchInvoke+0x9e (CONV: stdcall) [E:\vbscript\src\core\callout.h @ 111]
06 01e8f384 6b604038 0009001f 0000023f 00406060 vbscript!InvokeDispatch+0x330 (FPO: [EBP 0x6b659388] [7,60,4]) (CONV: stdcall) [E:\vbscript\src\vbscript\var.cpp @ 1211]
07 01e8f3c8 6b603156 00406060 0040b370 00000003 vbscript!GetDispatchDispID+0x1cc (FPO: [EBP 0x01e8f954] [4,3,4]) (CONV: stdcall) [E:\vbscript\src\vbscript\var.cpp @ 972]
08 01e8f970 78001045 00000000 0040b7f4 00000009 vbscript!CScriptRuntime::Run+0x3b8d (CONV: thiscall) [E:\vbscript\src\vbscript\interp.cpp @ 3347]
09 01e8f998 6b601ef7 00000009 01e8fa8c 00000000 MSVCRT!_nh_malloc+0x10 (FPO: [2,0,0]) (CONV: cdecl) [malloc.c @ 113]
0a 01e8f9c8 6b601c5c 00000000 00000000 00000000 vbscript!CScriptRuntime::Init+0x2e1 (FPO: [EBP 0x6b658a10] [6,0,4]) (CONV: thiscall) [E:\vbscript\src\vbscript\interp.cpp @ 904]
0b 01e8fb08 6b606fc5 00406060 6b606ef1 0040bfc0 vbscript!CScriptEntryPoint::Call+0x76 (FPO: [5,58,2]) (CONV: thiscall) [E:\vbscript\src\vbscript\entrypnt.cpp @ 40]
0c 01e8fb54 749f2e70 01911e90 6b610c9a 00000000 vbscript!CSession::GetGlobalEntryPoint+0x25 (FPO: [3,0,0]) (CONV: thiscall) [E:\vbscript\src\core\wrapper.cpp @ 485]
0d 01e8fb6c 749f3af0 01912060 01912060 012d1e90 asp!CResponse::Release+0x18 (FPO: [1,0,1]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\response.cpp @ 1716]
0e 01e8fb9c 74a22f5b 00000000 74a32c70 77e873a1 asp!CActiveScriptEngine::TryCall+0x15 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\scrptmgr.cpp @ 2040]
0f 01e8fbe0 749f3a72 00000000 01e8fc28 749f593d asp!CActiveScriptEngine::Call+0x10c (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\scrptmgr.cpp @ 2005]
10 01e8fbec 749f593d 01e8fc4c 00000000 00000000 asp!CallScriptFunctionOfEngine+0x48 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 1394]
11 01e8fc28 749f54c8 01a11fa0 01591e90 01e8fc94 asp!ExecuteRequest+0x19e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 326]
12 01e8fc70 749fcf9b 01a11fa0 01591e90 01e8fc94 asp!Execute+0x17e (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\exec.cpp @ 190]
13 01e8fcc0 749fcc37 00000000 000bd020 01e8fd58 asp!CHitObj::ViperAsyncCallback+0x452 (FPO: [Non-Fpo]) (CONV: thiscall) [D:\nt\private\inet\iis\svcs\cmp\asp\hitobj.cpp @ 2487]
14 01e8fcd8 787c214a 00000000 77acd455 01b51e90 asp!CViperAsyncRequest::OnCall+0x3f (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\inet\iis\svcs\cmp\asp\viperint.cpp @ 194]
15 01e8fce0 77acd455 01b51e90 77aa71a0 00000000 COMSVCS!STAActivityWorkHelper+0xa (FPO: [1,0,0]) (CONV: stdcall) [.\stathred.cpp @ 1321]
16 01e8fd24 77acd318 000751d8 00085860 787c2140 ole32!EnterForCallback+0x6a (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1758]
17 01e8fe50 77acd1dd 00085860 787c2140 01b51e90 ole32!SwitchForCallback+0x12b (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1643]
18 01e8fe78 77aac61a 00085860 787c2140 01b51e90 ole32!PerformCallback+0x50 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\crossctx.cxx @ 1558]
19 01e8fed4 77ad1185 000757c0 787c2140 01b51e90 ole32!CObjectContext::InternalContextCallback+0xf5 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\context.cxx @ 3942]
1a 01e8fef4 787beff3 000757c0 787c2140 01b51e90 ole32!CObjectContext::DoCallback+0x1a (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\ole32\com\dcomrem\context.cxx @ 3798]
1b 01e8ff24 787c11ad 00010007 00000000 01e8ffec COMSVCS!STAActivityWork::DoWork+0x73 (FPO: [0,4,2]) (CONV: thiscall) [..\inc\STAThred.h @ 340]
1c 01e8ffb4 77e887dd 0088f364 00010007 00000000 COMSVCS!STAThread::STAThreadWorker+0x465 (FPO: [EBP 0x01e8ffec] [1,31,4]) (CONV: stdcall) [.\stathred.cpp @ 628]
1d 01e8ffec 00000000 787c0d48 0088f364 00000000 KERNEL32!BaseThreadStart+0x52 (FPO: [Non-Fpo]) (CONV: stdcall) [D:\nt\private\windows\base\client\support.c @ 460]
Notice in frame 00 and 01 the line of the code as well as the name and location of the source code. Going back to the source code in Scenarios.cpp:
Line 170 looks like
STDMETHODIMP CScenarios::processSc(VARIANT *pVar)
{
.....
.....
else if (!strncmp(szS, "dz1", 3))
{
return doDZ1(Variation); //Line 170
}
.....
.....
}
Line 649 looks like
DWORD doDZ1(int Variation)
{
dwThreadID;
HANDLE hThread;
if (Variation == 1)
{
int i = 0;
int j = 1;
j = j / i; //line 649
return j;
}
if (2 == Variation)
{
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DBZ, NULL, 0, &dwThreadID);
}
return HSE_STATUS_SUCCESS;
}