Getting the right exception context from a memory dump fixed

Source: Internet
Author: User

After dinner, I saw the RSS aggregation of the share source CLI team. The above debug team's juqiang published an articleArticle, That is, if a minidump is captured, the following error occurs:
Warning: unable to verify timestamp for mscorwks. dll error. The last time I checked a mini dump, NTDLL. dll seemed to have encountered this problem, and it was okay to re-load the symbol file. This time he saw the same problem, but he couldn't help looking at the cause, I am lucky to have found a complete and classic case on Junfeng Zhang's windows programming notes. I found the case after posting it ,:), once posted, you will know:

When debug a memory dump, the dump may not in the right exception context when it is first loaded in the debugger. However, we can figure out the right context from the dump.

Let's load the dump.

C: \ debuggers> CDB-z C: \ temp \ Foo. dmp

Symbol search path is: *** invalid ***
**************************************** ************************************
* Symbol loading may be unreliable without a symbol search path .*
* Use. symfix to have the debugger choose a symbol path .*
* After setting your symbol path, use. Reload to refresh symbol locations .*
**************************************** ************************************
Executable search path is:
Windows XP version 2600 (Service Pack 2) MP (4 procs) Free x86 compatible
Product: WINNT, Suite: singleuserts
Debug session time: Tue Feb 26 07:14:42. 000 2008 (GMT-8)
System uptime: not available
Process uptime: 0 days 2:07:05. 000
......................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via. ecxr.
(8c4. 3d8): Wake debugger-code 80000007 (first/second chance not available)
Eax = 00000000 EBX = 7c884700 ECx = 0006ee6c edX = 7c90eb94 ESI = 00000000 EDI = 0006f40c
EIP = 7c90eb94 ESP = 0006ee78 EBP = 0006f528 iopl = 0 NV up ei pl Zr na PE NC
Cs = 001b Ss = 0023 DS = 0023 es = 0023 FS = 003b GS = 0000 EFL = 00000246
* ** Warning: unable to verify timestamp for NTDLL. dll
* ** Error: module Load completed but symbols cocould not be loaded for NTDLL. dll
Ntdll + 0xeb94:
7c90eb94 C3 RET

Let's load symbols first.

0: 000>. sympath SRV * c: \ websymbols * http://msdl.microsoft.com/download/symbols
Symbol search path is: SRV * c: \ websymbols * http://msdl.microsoft.com/download/symbols
0: 000>. Reload
......................................

Unfortunately. ecxr did not give us the right context.

0: 000>. ecxr
Eax = 00000000 EBX = 7c884700 ECx = 0006ee6c edX = 7c90eb94 ESI = 00000000 EDI = 0006f40c
EIP = 7c90eb94 ESP = 0006ee78 EBP = 0006f528 iopl = 0 NV up ei pl Zr na PE NC
Cs = 001b Ss = 0023 DS = 0023 es = 0023 FS = 003b GS = 0000 EFL = 00000246
Ntdll! Kifastsystemcallret:
7c90eb94 C3 RET
0: 000> KB
Childebp retaddr ARGs to child
0006ee74 7c90e273 7c863487 dda-144 00000004 NTDLL! Kifastsystemcallret
0006ee78 7c863487 d2017144 00000004 00000000 NTDLL! Ntraiseharderror + 0xc
// This filter is processed by the minidumpwritedump () method in dbghelp. dll.
0006f528 77c32f0f 0006f578 00000000 00000000 Kernel32! Unhandledexceptionfilter + 0x653
0006f544 01006484 80000003 0006f578 01009818 msvcrt! _ Xcptfilter + 0x161
Warning: Stack unwind Information not available. Following frames may be wrong.
0006ffc0 7c816fd7 00000016 03d7f12c 7ffd6000 Foo + 0x6484
0006fff0 00000000 0100660c 00000000 00000000 Kernel32! Baseprocessstart + 0x23

However, Kernel32! Unhandledexceptionfilter is on the stack. unhandledexceptionfilter takes an exception_pointers structure as its parameter, which contains the exception context.

0: 000> DC 0006f578
0006f578 0006f69c0006f6bc01013ea4 00000001 ......> ......
0006f588 fffffffe 0006f5b0 0006f5b0 01009c32...
0006f598 01015100 010066ff 0006f69c 0006ffb0. Q ...... f ..........
0006f5a8 0006f6bc 0006f670 0006f5d4 7c9037bf ...... P ...... |
0006f5b8 0006f69c 0006ffb0 0006f6bc 0006f670...
0006f5c8 0006fd4c 7c9037d8 0006ffb0 0006f684 l ...... 7 ........
0006f5d8 7c90116b 0006f69c 0006ffb0 0006f6bc. 7 .. | ............
0006f5e8 0006f670 01009c12 00000001 0006f69c P ...............

We can change to the exception context.


0: 000>. cxr 0006f6bc
Eax = 0006a1fa EBX = 6a803bd8 ECx = 00347ee8 edX = 00080608 ESI = 6a8043d8 EDI = 6a8045c0
EIP = 7c901230 ESP = 0006f988 EBP = 0006fca4 iopl = 0 NV up ei pl Zr na PE NC
Cs = 001b Ss = 0023 DS = 0023 es = 0023 FS = 003b GS = 0000 EFL = 00000246
Ntdll! Dbgbreakpoint:
7c901230 cc int 3

Now we have the correct exception context.


0: 000> K
* ** Stack trace for last set context-. Thread/. cxr resets it
Childebp retaddr
0006f984 6a870952 NTDLL! Dbgbreakpoint
Warning: Stack unwind Information not available. Following frames may be wrong.
0006fca4 6a8755f9 BAR + 0x70952
0006fcd4 6a8757ae BAR + 0x755f9
0006fcf0 6a86f49e BAR + 0x757ae
0006 fcfc 6a86fc06 BAR + 0x6f49e
0006fd5c 7c9011a7 BAR + 0x6fc06
0006fd7c 7c923f31 NTDLL! Ldrpcallinitroutine + 0x14
0006fe00 7c81cd76 NTDLL! Ldrshutdownprocess + 0x14f
0006fef4 7c81cdee Kernel32! _ Exitprocess + 0x42
0006ff08 77c39d45 Kernel32! Exitprocess + 0x14
0006ff14 77c39e78 msvcrt! _ Crtexitprocess + 0x32
0006ff24 77c39e90 msvcrt! _ Cinit + 0xEE
0006ff38 0100645e msvcrt! Exit + 0x12
0006ffc0 7c816fd7 Foo + 0x645e
0006fff0 00000000 Kernel32! Baseprocessstart + 0x23

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.