First time using PIX and it crashes.

Started by
6 comments, last by jffortin 16 years, 2 months ago
Hi, I have a problem with my code at the moment but can't find it so I decided to give PIX a try (my first time using that tool). But this didn't give me any good results, in fact it looks like PIX crashes. When I attach a debugger to my program running in PIX I can see that it stopped somewhere in PIXHelper.dll. The Call Stack looks like this:
 	PIXHelper.dll!CArrayList::EnsureSpace()  + 0x72 bytes	
 	PIXHelper.dll!CArrayList::Add()  + 0x12 bytes	
 	PIXHelper.dll!CHookedObject::AddChild()  + 0x15 bytes	
 	PIXHelper.dll!CHookMgr::CreateHookedObjectEx()  + 0x77 bytes	
 	PIXHelper.dll!CHookedD3DX9Top::D3DXCreateEffectEx()  + 0x4e bytes	
 	PIXHelper.dll!CSpyHookedD3DX9Top::D3DXCreateEffectEx()  + 0x7f bytes	
 	PIXHelper.dll!HookedD3DXCreateEffectEx()  + 0x50 bytes	
 	PIXHelper.dll!HookedD3DXCreateEffectEx_36Debug()  + 0x2a bytes	
 	D3DX9d_36.dll!_D3DXCreateEffect@36()  + 0x27 bytes	
 	PIXHelper.dll!CHookedD3DX9Top::D3DXCreateEffect()  + 0x2f bytes	
 	PIXHelper.dll!CSpyHookedD3DX9Top::D3DXCreateEffect()  + 0x78 bytes	
 	PIXHelper.dll!HookedD3DXCreateEffect()  + 0x4d bytes	
 	PIXHelper.dll!HookedD3DXCreateEffect_36Debug()  + 0x27 bytes	
> 	SampleApplication.exe!gfx::D3D9ShaderProgram::Compile()  Line 27 + 0x57 bytes	C++

It stops on a "D3DXCreateEffect" call in my D3D9ShaderProgram class saying than an unhandled exception occurred.

First-chance exception at 0x00269600 (PIXHelper.dll) in SampleApplication.exe: 0xC0000005: Access violation reading location 0x80000000.
Unhandled exception at 0x00269600 (PIXHelper.dll) in SampleApplication.exe: 0xC0000005: Access violation reading location 0x80000000.

PIX Diagnostic Log:

PIX Logfile created at: 12:38:29 AM

Frame 000001 ....PRE: Frame(1)
Trigger 'Program Start' fired
Created event tracing log file
Created PIXRun file at: C:\Users\jffortin\AppData\Local\Temp\PIX92E2.tmp
D3DX: (INFO) Using AMD optimizations

Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.
Direct3D9: (INFO) :======================= Hal HWVP device selected


Direct3D9: (INFO) :HalDevice Driver Style b


Direct3D9: (INFO) :Using FF to VS converter


Direct3D9: (INFO) :Using FF to PS converter


Direct3D9: (INFO) :Enabling multi-processor optimizations
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: DebugSetMute(TRUE)
Frame 000001 ........POST: <> DebugSetMute(TRUE)
Frame 000001 ........PRE: DebugSetMute(FALSE)
Frame 000001 ........POST: <> DebugSetMute(FALSE)
Frame 000001 ........PRE: D3DXCreateEffect(0x0DCCEF00, 0x02864958, 2390, NULL, NULL, 0x00000000, NULL, 0x0028E988, 0x0017F9C0)
Frame 000001 ............PRE: D3DXCreateEffectEx(0x0DCCEF00, 0x02864958, 2390, NULL, NULL, NULL, 0x00000000, NULL, 0x0017F29C, 0x0017F9C0)
Frame 000001 ................PRE: Direct3DShaderValidatorCreate9()
Frame 000001 ................POST: <0x005707E0> Direct3DShaderValidatorCreate9()
Frame 000001 ................PRE: Direct3DShaderValidatorCreate9()
Frame 000001 ................POST: <0x005707E0> Direct3DShaderValidatorCreate9()
Frame 000001 ................PRE: DebugSetMute(TRUE)
Frame 000001 ................POST: <> DebugSetMute(TRUE)
Frame 000001 ................PRE: DebugSetMute(FALSE)
Frame 000001 ................POST: <> DebugSetMute(FALSE)
Frame 000001 ................PRE: DebugSetMute(TRUE)
Frame 000001 ................POST: <> DebugSetMute(TRUE)
Frame 000001 ................PRE: DebugSetMute(FALSE)
Frame 000001 ................POST: <> DebugSetMute(FALSE)
An unhandled exception occurred.
Closing Run File

The whole application run correctly without PIX, I'm currently running with the Debugging runtime and the debug output level almost to max (was just showing redundant state calls at max). I'm running Vista 64-bits but running PIX 32-bits (along with my 32-bits application). With a GeForce 7900GS with latest instrumentation drivers from NVidia (was also crashing with the latest "normal" drivers from NVidia). ... I'm stuck to that point now. Trying to figure out if I can do anything to fix that and hoping someone on these forum can guide me. JFF
Advertisement
Your best bet is to report this to directx@microsoft.com, you'll probably have to send a repro program as well so they can see the same results. Just looking at the stack trace it looks like something bad is happening while allocating objects when creating the effect. Are you doing anything on multiple threads? Are you running low on memory?
Quote:Original post by Jalibr
Are you doing anything on multiple threads? Are you running low on memory?


No. Only single threaded and still have more than 1Gb of ram free...

JFF
Just an off chance but are your effects and other files in the same path as PIX? I used to have a similar problem that was the result of PIX not finding my shaders. If not, sorry to waste time ;-).
Jesse
Quote:Original post by laeuchli
Just an off chance but are your effects and other files in the same path as PIX? I used to have a similar problem that was the result of PIX not finding my shaders. If not, sorry to waste time ;-).
Jesse


You mean you had to put your shaders in the same folder as PIX?

Anyway, I manually load the file in some kind of buffers before calling D3DXCreateEffect and I just checked the buffer and all the data is in it.

JFF
Make sure you check all hresults etc..

And make sure the program runs fine stand-alone (not run from inside the compiler)
So you know all the paths work fine.

Chances are it's your program not pix.
Quote:Original post by marius1930
Make sure you check all hresults etc..

And make sure the program runs fine stand-alone (not run from inside the compiler)
So you know all the paths work fine.

Chances are it's your program not pix.


Also, my program runs fine stand-alone... now... I managed to fix my bug without PIX but PIX still crashes.

I don't check all HRESULTs at the moment... I guess I'll try to do that.

JFF
Quote:Original post by jff_f
I don't check all HRESULTs at the moment... I guess I'll try to do that.
JFF


I added HRESULT checks on all D3D functions I could find, and add a "if(FAILED(result)" that throws an exception whenever they fail.

It still crashes when run with PIX. And when I attach a debugger I see that it is almost the same. I mean the error is the same, but since I now load my shaders in a different order it's not the shader that causes the error.

result = D3DXCreateEffect(d3d9Device, fileBuffer->GetPointer(), (UINT)fileBuffer->GetSize(), NULL, NULL, 0, NULL, &shader, &errorBuffer);


The fileBuffer object is just an array in which I read the shader file asynchronously. Also forgot if I had mentionned it, but I also checked the content of this buffer and it is valid.

JFF

This topic is closed to new replies.

Advertisement