The following approaches are mainly focused on the user-mode exception. For the kernel-mode exception, the article by Jamie E. Hanrahan -- Using the Windows Debugger: Exceptions, Bugchecks, and Register Context provides pretty useful information.
1. Look for an EXCEPTION_POINTERS from the first parameter of PeekMessageExceptionFilter
030c21d0 76df3448 00000000 030c6138 76db6b0d ntdll!DbgBreakPoint
030c21dc 76db6b0d 030c2204 77b8d585 030c220c ole32!PeekMessageExceptionFilter+0x42
030c21e4 77b8d585 030c220c 00000000 030c220c ole32!CCliModalLoop::MyPeekMessage+0x41
(Excerpted from http://blogs.msdn.com/oldnewthing/archive/2006/08/21/710754.aspx)
2. Look for an exception context from the second parameter of KiUserExceptionDispatcher
0096c7f0 0096caf0
0096c7f4 7c82ecc6 ntdll!KiUserExceptionDispatcher+0xe
0096c7f8 0096c000
0096c7fc 0096c824 ; a pointer to an exception context
(Excerpted from http://www.dumpanalysis.org/blog/index.php/2007/02/02/crash-dump-analysis-patterns-part-8)
3. Look for an EXCEPTION_POINTERS from the only parameter of UnhandledExceptionFilter
09a8f334 77eb9b46 0000244c 00000001 00000000 ntdll!ZwWaitForSingleObject+0xb
09a8f644 77ea7e7a 09a8f66c 77e861ae 09a8f674 KERNEL32!UnhandledExceptionFilter+0x2b5
09a8ffec 00000000 787bf0b8 0216fe94 00000000 KERNEL32!BaseThreadStart+0x65
(Excerpted from http://support.microsoft.com/kb/313109)
4. Look for an exception code from the first parameter of Kernel32!RaiseException
5. Look for the context flags (1003f or 1001f on x86) on the stack
Use “s -d esp L1000 1003f" to search for addresses on the stack containing 0x1003f or 0x1001f.
0535ef48 0001003f 00000000 00000000 00000000 ?...............
The first column would be the address containing 0x1003f or 0x1001f, which would be the address of the context on the stack as well. The rest of the columns would be the corresponding fields in the context. If multiple entries are found, use the first one, since it would be the most recent exception.
Use “.cxr 0535ef48” to set the current context.
The approach takes advantage of the fact that the exception context is pushed onto the stack. Its first field -- context flags always has the value of 0x1003f (CONTEXT_ALL) or 0x1001f (CONTEXT_ALL & ~CONTEXT_EXTENDED_REGISTERS) on x86.
(Excerpted from http://blogs.msdn.com/jmstall/archive/2005/01/18/355697.aspx)
6. Look for exception contexts with valid addresses
An exception context is pushed onto the stack after an exception is thrown. The .cxr command is used to restore registers to their pre-exception context. Therefore, an exception context address should be less than ESP, ESP should be less than or equal to EBP, when ESP and EBP have been restored to their pre-exception context.
7. Look for a managed exception from the first parameter of mscorwks!RaiseTheExceptionInternalOnly
ChildEBP RetAddr Args to Child
0012f2d8 79eda99c e0434f4d 00000001 00000001 KERNEL32!RaiseException+0x53
0012f338 79fb48f8 012c9a78 00000000 00000000 mscorwks!RaiseTheExceptionInternalOnly+0x2a8
0012f3fc 00cd067c 012c9a78 00000000 00000000 mscorwks!JIT_Throw+0xfc
0:000> !pe 012c9a78
Exception object: 012c9a78
Exception type: System.ArgumentException
Message: Obj cannot be null
InnerException:
StackTrace (generated):
[...]
StackTraceString:
HResult: 80070057
