Debug Labs


Divide-By-Zero Exception in Component Code  

This lab will demonstrate an Integer Divide-By-Zero exception in a component. In this scenarion, a DBZ Exception in the COM Component "badCom.dll".

This scenario is presented in 2 variations, the 1st variation shows the exception in a COMSVCS thread  running the object, while the second variation shows the exception in a spawned thread other than the one running the object.

1- Lab Setup
	

Note: This lab assumes that you have already installed the necessary lab files to run it.

1- Verify the site is running in medium protection

2- Verify that the process "dllhost.exe" mapped to the out of process pooled application is running and note down its PID

To find the PID of the desired dllhost, do the follwing:

- Open Component Services

- Expand "Component Services" Node

- Expand "Computers" Node

- Expand "My Computer" Node

- Select "COM+ Applications"

- Click "Status View" icon and notice the PID column on the right hand pane

 

3- Attach windbg to the dllhost process with the PID found in step 2

a) Using the GUI:

- Click "File"

- Click "Attach to Process"

- Select "dllhost.exe" with the PID found in step 2 and click "OK"

b) Using the command prompt:

- Switch to thr folder where the debugging tools for windows is installed

- Type in "windbg -p <PID>" and hit Enter 

4- In windbg command line, type in "g" with no quotation marks and press Enter

 

 

2- Run Scenario

1- Click the "Invoke Component" button to load the COM Component in the dllhost process memory space. You should see the COM Component "badCom.dll"among the list of modules loaded in dllhost.exe
2- Click the "Cause DBZ Exception V:1" button the first time to cause a 1st chance Integer Divide-By-Zero Exception in dllhost.exe.
 Note that the debugger breaks and diplays 
	a- Comments about the exception
b- The value of the registers
c- The module where the AV happened
d- The assembly line that caused the AV
3- To study the second variation of this lab, click the "Cause DBZ Exception V:2" button.

                                                                           

                                                                                         

1) Integer Divide-By-Zero Exception in the main thread running HttpExtensionProc:  (Variation 1)

1- Debug Annotation

 

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 and 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 and 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;

}

 

 

1) Integer Divide-By-Zero Exception in a spawned thread: (Variation 2)

1- Debug Annotation

 

1) Without symbols

 

a) The faulting Stack

 

The stack backtrace of the thread that caused the Divide-ByZero Exception would look like:

 

0:016> kvn

# ChildEBP RetAddr Args to Child WARNING: Stack unwind information not available. Following frames may be wrong.

00 0218ffec 00000000 020332c1 00000000 00000000 badcom!DllUnregisterServer+0x154a

 

 

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:016> r

eax=00000001 ebx=00000000 ecx=00000000 edx=00000000 esi=01e4edc4 edi=000bfd68

eip=020332c7 esp=0218ffb8 ebp=0218ffec 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+154a:

020332c7 f7f9 idiv ecx  

  

c) The disassmbly code

 

0:016> u eip

badcom!DllUnregisterServer+154a:

020332c7 f7f9 idiv ecx

020332c9 c3 ret

020332ca ff259c100302 jmp dword ptr [badcom+0x109c (0203109c)]

020332d0 51 push ecx

020332d1 3d00100000 cmp eax,0x1000

020332d6 8d4c2408 lea ecx,[esp+0x8]

020332da 7214 jb badcom!DllUnregisterServer+0x1573 (020332f0)

020332dc 81e900100000 sub ecx,0x1000

 

 

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 and 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:016> kvn50

# ChildEBP RetAddr Args to Child

00 0218ffec 00000000 020332c1 00000000 00000000 badcom!DBZ+0x6

 

 

Now, with the public symbols lined up, we see that the last call that caused the Divide-By-Zero Exception was to the function "DBZ()".

 

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.

 

 

3) with Private Symbols "badCom.dll"

The stack backtrace of the thread that caused the DBZ would look like:

 

 

0:016> kvn50

# ChildEBP RetAddr Args to Child

00 0218ffec 00000000 020332c1 00000000 00000000 badcom!DBZ+0x6 (CONV: stdcall) [H:\nT\PRIVATE\inet\iis\svcs\w3\gateways\comDBG\scenarios.cpp @ 726]

 

 

 

Notice in frame 00 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 726 looks like

 

 

DWORD DBZ()

{

int i = 0;

int j = 1;

j = j / i; //line 726

return j;

}


- Microsoft Confidential -