[DEBUG] What does "First chance access violation for current stack trace." mean when main() has leav

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
Hi, Dear All,
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
I have a VS2005 build 32-bit executable files, which contains three static libraries build. (To make it simple, I change the code a little, and keep the relationship still the same.)
<pre class="prettyprint #pragma comment(lib, libA) /*from third party A*/
#pragma comment(lib, libB) /*from third party B*/
#pragma comment(lib, libC) /*from third party C*/

void func(void)
{
CheckADriverState(); /*implement in libA*/
CheckBDriverState(); /*implement in libB*/
CheckCDriverState(); /*implement in libC*/
}

int _tmain()
{
func();
return 0;
}[/code]
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 Its working fine on 32-bit environment until I check the "Create User Mode Stack Trace Database" option in GFlags. Call
Stack for the Access violation as following:
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 (2650.273c): Access violation - code c0000005 (first chance)
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
First chance exceptions are reported before any exception handling.<br/>
This exception may be expected and handled.<br/>
eax=00000000 ebx=00000001 ecx=58b40d48 edx=580e14c0 esi=053f4fe4 edi=00000000<br/>
eip=743319c0 esp=0012ff0c ebp=0012ff3c iopl=0 nv up ei pl nz na pe nc<br/>
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206<br/>
MSVCR80!doexit+0x7e:<br/>
743319c0 393e cmp dword ptr [esi],edi ds:0023:053f4fe4=????????
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px

<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 0:000> kb
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
ChildEBP RetAddr Args to Child <br/>
0012ff3c 74331a4b 00000427 00000000 00000000 MSVCR80!doexit+0x7e [f:ddvctoolscrt_bldself_x86crtsrccrt0dat.c @ 551]<br/>
0012ff4c 004a8b00 00000427 0e6839ec 00000000 MSVCR80!exit+0xd [f:ddvctoolscrt_bldself_x86crtsrccrt0dat.c @ 398]<br/>
WARNING: Stack unwind information not available. Following frames may be wrong.<br/>
0012ff88 757bed6c 7ffdc000 0012ffd4 76fe377b MyTest+0xa8b00<br/>
0012ff94 76fe377b 7ffdc000 76a650cd 00000000 kernel32!BaseThreadInitThunk+0xe<br/>
0012ffd4 76fe374e 004a8c2e 7ffdc000 00000000 ntdll!__RtlUserThreadStart+0x70<br/>
0012ffec 00000000 004a8c2e 7ffdc000 00000000 ntdll!_RtlUserThreadStart+0x1b<br/>
<br/>
If I run it with WinDbg & ApplicationVerifier, the following message displayed after the error happen.<br/>
<br/>
=======================================<br/>
VERIFIER STOP 00000013: pid 0x18B8: First chance access violation for current stack trace. <br/>
<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 05374FE4 : Invalid address causing the exception.<br/>
743319C0 : Code address executing the invalid access.<br/>
0012FC0C : Exception record.<br/>
0012FC28 : Context record.<br/>
=======================================<br/>
This verifier stop is continuable.<br/>
After debugging it use `go to continue.<br/>
=======================================
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; line-height:13px Original, I thought it might be a bug from one of the librarys. After some test, I have found that i<span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 f
I exclude any one of the Check?DriverState(), this error wont happen, and terminate process smoothly. <span style="border:0px; font-style:inherit; font-family:inherit; margin:0px; outline:0px; padding:0px; font-size:0.75em; line-height:1.5 in
the other hand, from the timing, it seems to be a buffer overrun when releasing/destroying the global or static resources. But how can I prove it, and what will be my next debug action?
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
by the way, the same code have no chance running on some win 7 x64 environment, even I dont set any GFlags options or AppVerifier. It always popup a Application Error Message and logged in system event viewer. unless I remark one of the Check?DriverState(). <br/>
<br/>
Any suggestion would be greatly appreciated.
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
--
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px
YenYu.

<br/>
<p style="border:none; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; padding-right:0px; color:#333333; line-height:16.666667938232422px


View the full article
 
Back
Top