在进入我的主函数之前加载 3rdparty Windows DLL 时,我遇到了“第一次机会异常”,即“访问冲突 -code c0000005”。我们能否确定问题出在我的代码还是 3rdparty 代码上?
下面是windbg的日志:
Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: D:\risc\rlx_vm\trunk\msvc80\debug\test_rlxvm_ovpsim_dma_ocp_tl2.exe
Symbol search path is: D:\risc\rlx_vm\trunk\msvc80\debugwithreleasecrt;D:\risc\rlx_vm\trunk\msvc80\debug
Executable search path is:
ModLoad: 00400000 008af000 test_rlxvm_ovpsim_dma_ocp_tl2.exe
ModLoad: 7c920000 7c9b6000 ntdll.dll
ModLoad: 7c800000 7c91e000 C:\WINDOWS\system32\kernel32.dll
ModLoad: 10000000 10021000 R:\home\STools\MIPS\mips_iasim-1.1.1\bin\Windows32\libRuntimeLoader.dll
ModLoad: 77be0000 77c38000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 10480000 1057e000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_d014c028\MSVCP80D.dll
ModLoad: 10200000 10321000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_d014c028\MSVCR80D.dll
ModLoad: 78130000 781cb000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86\MSVCR80.dll
ModLoad: 77d10000 77da0000 C:\WINDOWS\system32\USER32.dll
ModLoad: 77ef0000 77f39000 C:\WINDOWS\system32\GDI32.dll
(18c58.184f0): Break instruction exception - code 80000003 (first chance)
eax=00251eb4 ebx=7ffde000 ecx=00000007 edx=00000080 esi=00251f48 edi=00251eb4
eip=7c92120e esp=0012fb20 ebp=0012fc94 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c92120e cc int 3
0:000> g
ModLoad: 008b0000 00a20000 R:\home\STools\MIPS\mips_iasim-1.1.1\bin\Windows32\libOVPsimMIPS.dll
ModLoad: 00a20000 00bc6000 R:\home\STools\MIPS\mips_iasim-1.1.1\bin\Windows32\mipsiasim11.dll
ModLoad: 5fdd0000 5fe25000 C:\WINDOWS\system32\NETAPI32.dll
ModLoad: 77da0000 77e49000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e50000 77ee3000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fc0000 77fd1000 C:\WINDOWS\system32\Secur32.dll
ModLoad: 76320000 76367000 C:\WINDOWS\system32\comdlg32.dll
ModLoad: 5d170000 5d20a000 C:\WINDOWS\system32\COMCTL32.dll
ModLoad: 7d590000 7dd84000 C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77f40000 77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 71a40000 71a4b000 C:\WINDOWS\system32\WSOCK32.dll
ModLoad: 71a20000 71a37000 C:\WINDOWS\system32\WS2_32.dll
ModLoad: 71a10000 71a18000 C:\WINDOWS\system32\WS2HELP.dll
ModLoad: 65100000 65111000 R:\home\STools\MIPS\mips_iasim-1.1.1\bin\Windows32\pthreadGC2-w32.dll
ModLoad: 76d30000 76d48000 C:\WINDOWS\system32\IPHLPAPI.DLL
(18c58.184f0): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=5d170000 ecx=0012ee24 edx=0000004c esi=7c813029 edi=00000000
eip=7c92e470 esp=0012ee2c ebp=0012ee50 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010206
ntdll!KiUserCallbackDispatcher+0x10:
7c92e470 ff1490 call dword ptr [eax+edx*4] ds:0023:00000130=????????
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\COMCTL32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for R:\home\STools\MIPS\mips_iasim-1.1.1\bin\Windows32\libRuntimeLoader.dll -
磁盘 R 上的 DLL 是 3rdparty 库。