Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
C/C++本地代码调试
为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
烈火
2013-04-28, 17:47 下午
如题,比如一个调用栈中这样显示:
。。。
0b 002cf4ec 77b93e74 002cf538 00000000 00000000 kernel32!UnhandledExceptionFilter+0x129
*** WARNING: Unable to verify checksum for PacsService.cgi
*** ERROR: Module load completed but symbols could not be loaded for PacsService.cgi
0c 002cf50c 0040b917 e06d7363 002cf538 77b96cd5 msvcrt!_XcptFilter+0x178
WARNING: Stack unwind information not available. Following frames may be wrong.
0d 002cffc0 7d517d42 00000000 00000000 7efdf000 PacsService+0xb917
0e 002cfff0 00000000 0040b816 00000000 000000c8 kernel32!BaseProcessStart+0x28
。。。
通过对
UnhandledExceptionFilter的参数进行分析也能够得到异常发生的上下文,
但是另一个例子无需分析就能够直接显示出发生异常的语句:
。。。。
0a 0200f980 77b93e74 0200f9cc 00000000 00000000 kernel32!UnhandledExceptionFilter+0x129
0b 0200f9a0 77b9b547 e06d7363 0200f9cc 77b96cd5 msvcrt!_XcptFilter+0x178
0c 0200f9ac 77b96cd5 0200f9d4 00000000 0200f9d4 msvcrt!_endthreadex+0xba
0d 0200f9d4 7d60ec4a 0200fd90 0200ffa8 0200fab0 msvcrt!_except_handler3+0x61
0e 0200f9f8 7d60ec1b 0200fd90 0200ffa8 0200fab0 ntdll!ExecuteHandler2+0x26
0f 0200faa0 7d60eb34 0200e000 0200fab0 00010007 ntdll!ExecuteHandler+0x24
10 0200fd80 7d51237e 0200fd90 77b7153c e06d7363 ntdll!RtlRaiseException+0x3d
11 0200fde0 77b83259 e06d7363 00000001 00000003 kernel32!RaiseException+0x53
12 0200fe20 754ff421 0200fe34 755c668c 02ac75b8 msvcrt!_CxxThrowException+0x36
13 0200fe44 754ff44d 00000002 00000006 00000000 mfc42!AfxThrowFileException+0x61
14 0200fe58 754fceaf 00000006 00000000 0200fed4 mfc42!CFileException::ThrowOsError+0x1d
15 0200fe6c 754fd990 00000000 00000001 002cfd9c mfc42!CFile::Seek+0x2f
16 0200fe84 004026fc 00000001 002cfd9c 002cfe88 mfc42!CFile::GetLength+0x10
。。。。
请教高手,这是何解?
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
格蠹老雷
2013-04-30, 20:15 下午
对于这个例子,是因为缺少PacsService模块的符号文件(PDB)
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
烈火
2013-05-04, 22:24 下午
但是另一个程序同样没有符号文件
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
格蠹老雷
2013-05-04, 22:28 下午
另一个是哪一个
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
烈火
2013-05-05, 11:05 上午
另一个是指我上面列出的第二个例子,我再贴完整一些:
0:000> ~0kbn;~3kbn
# ChildEBP RetAddr Args to Child
00 002cfd14 75541b46 004062bc 00000000 00000000 user32!NtUserGetMessage+0x15
01 002cfd30 755088f0 00000004 002cfd9c 00000000 mfc42!CWinThread::PumpMessage+0x16
02 002cfd50 7552426e 00000004 00406288 00406288 mfc42!CWnd::RunModalLoop+0xe0
*** WARNING: Unable to verify checksum for CenteraStorage.exe
*** ERROR: Module load completed but symbols could not be loaded for CenteraStorage.exe
03 002cfd90 00401945 00406288 00404628 00000001 mfc42!CDialog::DoModal+0x10e
WARNING: Stack unwind information not available. Following frames may be wrong.
04 002cff10 0040354f 00400000 00000000 002d24fb CenteraStorage+0x1945
05 002cffc0 7d517d42 00000000 00000000 7efdf000 CenteraStorage+0x354f
06 002cfff0 00000000 0040337c 00000000 000000c8 kernel32!BaseProcessStart+0x28
# ChildEBP RetAddr Args to Child
00 02ecefd8 7d987717 036203c4 00000000 00000001 user32!NtUserWaitMessage+0x15
01 02ecf004 7d998f60 7d960000 002f8788 00000000 user32!InternalDialogBox+0xdc
02 02ecf2c8 7d99881c 02ecf430 02ecf480 ffffffff user32!SoftModalMessageBox+0x972
03 02ecf420 7d9c9855 02ecf430 00000000 00000028 user32!MessageBoxWorker+0x260
04 02ecf480 7d9c98d3 00000000 002e3f68 002f3a68 user32!MessageBoxTimeoutW+0x4d
05 02ecf4b4 7d9b2be1 00000000 02ecf650 029f8504 user32!MessageBoxTimeoutA+0x74
06 02ecf4d4 7d9b2b99 00000000 02ecf650 029f8504 user32!MessageBoxExA+0x1b
*** WARNING: Unable to verify checksum for PAI_module.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for PAI_module.dll -
07 02ecf4f0 029ed751 00000000 02ecf650 029f8504 user32!MessageBoxA+0x18
WARNING: Stack unwind information not available. Following frames may be wrong.
08 02ecf6f0 029ec144 0000000a 029e9960 00000000 PAI_module!PAI_module::getVersion+0xc620
09 02ecf728 7d56556a 02ecf9cc e06d7363 02ad4bd0 PAI_module!PAI_module::getVersion+0xb013
0a 02ecf980 77b93e74 02ecf9cc 00000000 00000000 kernel32!UnhandledExceptionFilter+0x129
0b 02ecf9a0 77b9b547 e06d7363 02ecf9cc 77b96cd5 msvcrt!_XcptFilter+0x178
0c 02ecf9ac 77b96cd5 02ecf9d4 00000000 02ecf9d4 msvcrt!_endthreadex+0xba
0d 02ecf9d4 7d60ec4a 02ecfd90 02ecffa8 02ecfab0 msvcrt!_except_handler3+0x61
0e 02ecf9f8 7d60ec1b 02ecfd90 02ecffa8 02ecfab0 ntdll!ExecuteHandler2+0x26
0f 02ecfaa0 7d60eb34 02ece000 02ecfab0 00010007 ntdll!ExecuteHandler+0x24
10 02ecfd80 7d51237e 02ecfd90 77b7153c e06d7363 ntdll!RtlRaiseException+0x3d
11 02ecfde0 77b83259 e06d7363 00000001 00000003 kernel32!RaiseException+0x53
12 02ecfe20 754ff421 02ecfe34 755c668c 02ad5000 msvcrt!_CxxThrowException+0x36
13 02ecfe44 754ff44d 00000002 00000006 00000000 mfc42!AfxThrowFileException+0x61
14 02ecfe58 754fceaf 00000006 00000000 02ecfed4 mfc42!CFileException::ThrowOsError+0x1d
15 02ecfe6c 754fd990 00000000 00000001 002cfd9c mfc42!CFile::Seek+0x2f
16 02ecfe84 004026fc 7d97b5ba 002cfd9c 002cfe88 mfc42!CFile::GetLength+0x10
17 02ecfeac 7d50eda5 00000189 02ad3360 7d50edb1 CenteraStorage+0x26fc
18 02ecff00 00402255 002cfe88 02ecff34 00000000 kernel32!FindClose+0x9b
19 02ecff80 00401fc9 77b9b530 002cfd9c 00000000 CenteraStorage+0x2255
1a 02ecff84 77b9b530 002cfd9c 00000000 00000000 CenteraStorage+0x1fc9
1b 02ecffb8 7d50fe37 01dc58e0 00000000 00000000 msvcrt!_endthreadex+0xa3
1c 02ecffec 00000000 77b9b4bc 01dc58e0 00000000 kernel32!BaseThreadStart+0x34
这里同样没有CenteraStorage的符号文件,但是线程3的栈回溯却清晰的显示了对于CFile的调用。
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
格蠹老雷
2013-05-05, 21:09 下午
因为后一个例子,异常发生在有符号的VC运行时里,而前一个例子异常发生在没有符号的PacsService模块中
Re: 为什么同样是发生未捕捉异常,有的调用栈中可以显示详细异常发生的过程,有的不会?
烈火
2013-05-05, 23:45 下午
前面那个同样发生在VC运行库里,是在CFile::Write里产生的
。。。
0b 002cf4ec 77b93e74 002cf538 00000000 00000000 kernel32!UnhandledExceptionFilter+0x129
。。。
0:000> dd 002cf538 l2
002cf538 002cf8fc 002cf61c
0:000> .cxr 2cf61c
eax=002cf8fc ebx=002cfb8c ecx=00000000 edx=002cf9a0 esi=002cf98c edi=002cf98c
eip=7d51237e esp=002cf8f8 ebp=002cf94c iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000206
kernel32!RaiseException+0x53:
7d51237e 5e pop esi
0:000> kbn
*** Stack trace for last set context - .thread/.cxr resets it
# ChildEBP RetAddr Args to Child
00 002cf94c 77b83259 e06d7363 00000001 00000003 kernel32!RaiseException+0x53
01 002cf98c 754ffb01 002cf9a0 755c6dd4 0059d3a0 msvcrt!_CxxThrowException+0x36
02 002cf9b0 754ffb2d 00000002 00000006 00599418 mfc42!AfxThrowFileException+0x61
03 002cf9c4 754fe00e 00000006 00599418 77b927c9 mfc42!CFileException::ThrowOsError+0x1d
*** WARNING: Unable to verify checksum for QueueServer.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for QueueServer.dll -
04 002cf9dc 10007d61 005946f8 00000000 002cfb94 mfc42!CFile::Write+0x3e
WARNING: Stack unwind information not available. Following frames may be wrong.
05 002cfb68 755de5f8 755de5f8 755de5f8 755de5f8 QueueServer+0x7d61
06 002cfb6c 755de5f8 755de5f8 755de5f8 755de5f8 mfc42!_afxInitData+0xc
07 002cfb70 755de5f8 755de5f8 755de5f8 755de5f8 mfc42!_afxInitData+0xc
08 002cfb74 755de5f8 755de5f8 755de5f8 755de5f8 mfc42!_afxInitData+0xc
09 002cfb78 755de5f8 755de5f8 755de5f8 755de5f8 mfc42!_afxInitData+0xc
0a 002cfb7c 755de5f8 755de5f8 755de5f8 005991e8 mfc42!_afxInitData+0xc
0b 002cfb80 755de5f8 755de5f8 005991e8 755de5f8 mfc42!_afxInitData+0xc
0c 002cfb84 755de5f8 005991e8 755de5f8 00598ce8 mfc42!_afxInitData+0xc
0d 002cfb88 005991e8 755de5f8 00598ce8 755de5f8 mfc42!_afxInitData+0xc
0e 002cfb8c 755de5f8 00598ce8 755de5f8 755de5f8 0x5991e8
0f 005991e8 656c0031 00444964 31223d00 2022302e mfc42!_afxInitData+0xc
10 005991ec 00444964 31223d00 2022302e 6f636e65 0x656c0031
11 005991f0 31223d00 2022302e 6f636e65 676e6964 0x444964
12 005991f4 2022302e 6f636e65 676e6964 5455223d 0x31223d00
13 005991f8 6f636e65 676e6964 5455223d 22382d46 0x2022302e
14 005991fc 676e6964 5455223d 22382d46 00003e3f 0x6f636e65
15 00599200 5455223d 22382d46 00003e3f 00000000 0x676e6964
16 00599204 22382d46 00003e3f 00000000 00000000 0x5455223d
17 00599208 00000000 00000000 00000000 00000000 0x22382d46
另外突然发现了另外一个问题,6.2版本的WinDBG在我调试一个过去的转储文件时,显示的调用栈不正确
6.2的(省略掉相同的):
0:000> kbn
# ChildEBP RetAddr Args to Child
00 002ced84 7d9c97e9 50000018 00000004 00000003 ntdll!ZwRaiseHardError+0x12
。。。。。
0b 002cf2c0 7d60f7ac 002cf840 00000000 002cf814 MSVCR71!__CxxUnhandledExceptionFilter+0x2b
0c 002cf504 77b93e74 002cf550 00000000 00000000 ntdll!RtlAllocateHeap+0xee7
*** WARNING: Unable to verify checksum for PacsService.cgi
*** ERROR: Module load completed but symbols could not be loaded for PacsService.cgi
0d 002cf524 0040b917 e06d7363 002cf550 77b96cd5 msvcrt!_XcptFilter+0x178
WARNING: Stack unwind information not available. Following frames may be wrong.
0e 002cffc0 7d517d42 00000000 00000000 7efdf000 PacsService+0xb917
0f 002cfff0 00000000 0040b816 00000000 000000c8 kernel32!BaseProcessStart+0x28
这是6.12的,显示的是正确的:
0:000> kbn
# ChildEBP RetAddr Args to Child
00 002ced84 7d9c97e9 50000018 00000004 00000003 ntdll!NtRaiseHardError+0x12
。。。
0b 002cf504 77b93e74 002cf550 00000000 00000000 kernel32!UnhandledExceptionFilter+0x129
*** WARNING: Unable to verify checksum for PacsService.cgi
*** ERROR: Module load completed but symbols could not be loaded for PacsService.cgi
0c 002cf524 0040b917 e06d7363 002cf550 77b96cd5 msvcrt!_XcptFilter+0x178
WARNING: Stack unwind information not available. Following frames may be wrong.
0d 002cffc0 7d517d42 00000000 00000000 7efdf000 PacsService+0xb917
0e 002cfff0 00000000 0040b816 00000000 000000c8 kernel32!BaseProcessStart+0x28