Stack overflow exception in Windows Mobile 6 Professional emulator
- From: Dilip <rdilipk@xxxxxxxxx>
- Date: Thu, 1 Oct 2009 09:13:58 -0700 (PDT)
I am running into a stack overflow exception while testing a .NET
application that talks to unmanaged C code via a P/Invoke layer (it
runs on Windows Mobile 6.0 professional **emulator**). I have reached
a point where my skillsets aren't deep enough to look at CPU registers/
assembly and see if the stack or frame pointers are looking funny.
The stack overflow occurs when the unmanaged code tries to spawn a
worker thread from inside another worker thread (using the
CreateThread Win32 API). So:
void SomeThread(void* threadArg)
{
// lot of blah
// CreateThread(AnotherThread, .......);
WaitForAnotherThreadToInitialize(5000); // 5 seconds
}
void AnotherThread(void* threadArg)
{
// declare local variables
// KABOOM here...
}
Before the CreateThread API is called, the registers look like this
inside SomeThread:
R0 = 0x00000001 R1 = 0x00000002 R2 = 0x00000010 R3 = 0x00000001
R4 = 0x0122bd10 R5 = 0x1e06f560 R6 = 0x88044520 R7 = 0x88046d24
R8 = 0x00000000 R9 = 0x80000004 R10 = 0x00000001 R11 = 0x00499930
R12 = 0x03f65770 Sp = 0x1e5cfc8c Lr = 0x01221900 Pc = 0x012219e0
Psr = 0x20000010
When, the stack overflow occurs in AnotherThread and debugger breaks
into it, here is what the registers look like:
R0 = 0x01482130 R1 = 0x00000000 R2 = 0x1627a107 R3 = 0x00000000
R4 = 0x012259a8 R5 = 0x01482130 R6 = 0x88044520 R7 = 0x88046d24
R8 = 0x00000000 R9 = 0x80000004 R10 = 0x00000001 R11 = 0x16153a9e
R12 = 0x1e5eeed0 Sp = 0x1e5e0ed0 Lr = 0x03f6b334 Pc = 0x01225ed4
Psr = 0x80000010
In addition the output window logs this:
[Stack fault]: Thread=96edd000 Proc=80096f40 'TestMobile.exe'
AKY=00004001 PC=01225ed4(unmanagedCode.dll+0x00005ed4) RA=03f6b334
(coredll.dll+0x0001d334) BVA=1e5e0ea4 FSR=00000407
First-chance exception at 0x01225ed4 in TestMobile.exe: 0xC00000FD:
Stack overflow.
I have been banging my head on this for a week and not making any
progress.
Can anyone see anything funny in the above data? Is there any other
approach I can take?
.
- Follow-Ups:
- Prev by Date: RE: Another CE 6 R3 related issue
- Next by Date: Re: Project management WINCE Platform Builder
- Previous by thread: Height issue in Device Emulator
- Next by thread: RE: Stack overflow exception in Windows Mobile 6 Professional emulator
- Index(es):
Relevant Pages
|