Game Development Community

Small Exception Bug & Question

by Jon Wilsdon · in Torque Game Engine Advanced · 06/19/2006 (1:50 pm) · 3 replies

I noticed that when I was running TSE in Debug mode in Visual Studio (2003) that I keep getting

First-chance exception at 0x7c910806 in TSE_DEBUG.exe: 0xC0000006: In page error.

Does anyone have any idea what could be causing that? I enabled breaking on first-chance exceptions but the call stack is always in NTDLL.dll which really doesn't help me out much since all that is available is the disassembly.

That leads me to the small exception bug, which is simply that DInputManager::disable() in winDirectInput.cpp gets called and it tries to FreeLibrary(mXInputLib) when mXInputLib is not ever initialized. So in debug mode this actually generates an exception (which transparently gets handled if you don't have it breaking on exceptions). To fix this I simply initialize mXInputLib to NULL around line 34 of winDirectInput.cpp.

mXInputLib		 = NULL;

Oh, and for anyone who doesn't know how to enable breaking on exceptions in Visual Studio (I didn't before today); I found out how by following these steps.

Edit: I suppose I should mention that instead of following the directions in that link explicitly I just set Visual Studio up to break on any of the exception families, not just the Common Language Runtime ones.

#1
06/21/2006 (3:51 pm)
Not sure what "In page error" is - you might find more info on MSDN. Is this a clean, stock TSE build, or have you modified it? Errors like that can occur if you have some bad code in a global class's constructor.

Thanks for the feedback on the exception there Jon. XInput is a relatively new addition, and someone must have forgot to initialize when they put that in there. That fix will go up with 3.5 (coming soon).
#2
06/21/2006 (5:25 pm)
I had only tested it on a modified version of TSE, but now I tested it on a clean, stock TSE build and I still get 6 or 7 In Page Error exceptions while starting the game in Debug mode. (The exceptions are visible in the Output window normally, which is why they caught my eye to begin with, but you can break on them as mentioned in my first post). It seems slightly difficult to actually find anything on exactly "In Page Error" exceptions, so I am assuming that EXCEPTION_IN_PAGE_ERROR is the real underlying exception. If that is the case, then this msdn page has a description of why the exception happens.

I suppose the next step in debugging this will be to try and find out what the engine is really trying to do when it is generating the exception and the only good way I know of to do that is to more or less step through the engine as it is starting up and see where it is happening. I'll try and take a look at this tomorrow when I get into work and see what I can find.

Edit: Changed the link since the first link pointed to an article about embedded systems.
#3
06/22/2006 (2:35 pm)
Ok, I tracked down where the exceptions are happening:

2 exceptions:
hr = m_pDxDiagRoot->GetChildContainer( name0, ppChild );
in:
DXDiagNVUtil::GetChildContainer()
from:
DXDiagNVUtil::GetProperty()
GFXD3DDevice::getDXVersion()
GFXD3DDevice::enumerateAdapters()
GFXInit::enumerateAdapters()
Platform::initWindow()

then 1 exception:
CoUninitialize();
in:
DXDiagNVUtil::FreeIDxDiagContainer()
from:
GFXD3DDevice::getDXVersion()
GFXD3DDevice::enumerateAdapters()
GFXInit::enumerateAdapters()
Platform::initWindow()

then 2 exceptions:
hr = m_pDxDiagRoot->GetChildContainer( name0, ppChild );
in:
DXDiagNVUtil::GetChildContainer()
from:
DXDiagNVUtil::GetDisplayDeviceNode()
DXDiagNVUtil::GetDisplayDeviceManufacturer()
GFXD3DCardProfiler::init()
GFXD3DDevice::init()
Platform::initWindow()

then 2 exceptions:
hr = m_pDxDiagRoot->GetChildContainer( name0, ppChild );
in:
DXDiagNVUtil::GetChildContainer()
from:
DXDiagNVUtil::GetNumDisplayDevices()
GFXD3DTextureManager::_getTotalVideoMemory()
GFXTextureManager::getTotalVideoMemory()
GFXTextureManager::validateTextureMemory()
....
constructNewFont()

then it gives 2 exceptions 2 more times exactly as above.

I have an ATI FireGL V3100 card, so it is possible that it has something to do with that, seeing as it is making calls to DXDiagNVUtil (although they only seem to be calls querying DirectX). I have the April 2006 DirectX SDK.