. NET Advanced Debug Learning (3) Exception view

Source: Internet
Author: User
Tags mscorlib

or the source code in. NET Advanced Debugging learning (2),

Run debugger to output exception, WinDbg auto Interrupt,

1, implementation. Loadby SOS CLR

2, the implementation of!printexception, (PS: abbreviation!PE) See the following:

type:   System.  Argumentexceptionmessage:          OBJ cannot be nullinnerexception:   <none>(generated):    SP               IP               Function    000000000025e8d0 000007fe909c0cb5 03objtypes! Advanced. NET. Debugging.Chapter3.ObjTypes.ThrowException (Advanced.  NET. Debugging.Chapter3.ObjTypes) +0x95    000000000025E930 000007fe909c065b 03objtypes! Advanced. NET. Debugging.Chapter3.ObjTypes.Main (system.string[]) +0x1db<none>80070057

3, Execute! DumpObj 0000000002557CB8 View specific exception content

Name:system.argumentexceptionmethodtable:000007feef11ba28eeclass:000007feeeb179f8size:168 (0XA8)Bytesfile:c:\windows\microsoft.Net\assembly\gac_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dllfields:mt Field OffsetTypeVT Attr Value name000007feef1085484000262 8 System.String 0instance 0000000002559bf8 _classname000007feef128d584000263. ection. MethodBase 0 Instance 0000000000000000_exceptionmethod000007feef1085484000264 System.String 0 Instance 0000000000000000_exceptionmethodstring000007feef1085484000265 System.String 0instance 0000000002557d60 _message000007feef11f9e04000266. tions. IDictionary 0 Instance 0000000000000000_data000007feef1087784000267 System.Exception 0 Instance 0000000000000000_innerexception000007feef1085484000268 System.String 0 Instance 0000000000000000_helpurl000007feef108b284000269 System.Object 0 Instance 0000000002557e20_stacktrace000007feef108b28 400026aSystem.Object 0 Instance 0000000002557e98_watsonbuckets000007feef108548 400026bSystem.String 0 Instance 0000000000000000_stacktracestring000007feef108548 400026cSystem.String 0 Instance 0000000000000000_remotestacktracestring000007feef10af70 400026dSystem.Int32 1 Instance 0_remotestackindex000007feef108b28 400026eSystem.Object 0 Instance 0000000000000000_dynamicmethods000007feef10af70 400026f 8c System. Int32 1 instance-2147024809_hresult000007feef1085484000270 System.String 0 Instance 0000000000000000_source000007feef1298a04000271 System.IntPtr 1 Instance 0_xptrs000007feef10af704000272 System.Int32 1 instance-532462766_xcode000007feef0d44d04000273 System.UIntPtr 1 Instance 0_ipforwatsonbuckets000007feef0fa8084000274 ... Ializationmanager 0instance 0000000002557da0 _safeserializationmanager000007feef108b284000261 A8 System.Object 0shared static S_edilock>> Domain: Value00000000000c7840: Notinit<<000007feef108548 400038a98 System.String 0 Instance 0000000000000000 m_paramname

3. You can also use!threads to view exceptions for all threads, as shown below:

ThreadCount:      2unstartedthread:  01pendingthread:    0deadthread:       0Hosted Runtime:   no                                                                                                        Lock         ID OSID threadobj           Mode     GC Alloc Context                  Domain           Count Apt Exception   0    1 2064 000000000011a090    2a020 preemptive  0000000002562c68:0000000002563fd0 00000000000c7840 0     MTA System.  ArgumentException 0000000002557cb8   2    2 1240 000000000011e0c0    2b220 preemptive  0000000000000000:0000000000000000 00000000000c7840 0     

The book uses the KB command to view the managed and unmanaged call stacks

# Retaddr:args to Child:PagerSite000007fe ' f0171f09:00000000 ' 00000001 00000000 ' 0025e5e800000000 ' 02557cb800000000 ' 0025e6b8:kernelbase! raiseexception+0x3901000007fe ' f0171d10:00000000 ' 02556138 ffffffff ' Fffffffe 00000000 ' 00000000 00000000 ' 00000000:clr! Raisetheexceptioninternalonly+0x2f0000007fe ' 909c0cb5:00000000 ' 70000195 000007fe ' 908b40c0 00000000 ' 0025eb38 00000000 ' 0025ea00:clr! il_throw+0x11103 000007fe ' 909c065b:00000000 ' 02556cd8 00000000 ' 00000000 00000000 ' 02556b4c 00000000 ' 00000000: 0x000007fe' 909c0cb5000007fe ' f0024073:00000000 ' 02553470 000007fe ' 908b40c0 00000000 ' 00000000 00000000 ' 00000000:0x000007fe' 909c065b000007fe ' f0023f25:00000000 ' 0025ed08 000007fe ' F00b38f1 00000000 ' 00000000 00000000 ' 00000000:clr! calldescrworkerinternal+0x8306 000007fe ' f0024506:00000000 ' 00000001 00000000 ' 0025ec80 00000000 ' 0025ec50 00000000 ' 0025ebc8:clr! Calldescrworkerwithhandler+0x4e07 000007fe ' f01158e1:00000000 ' 0025eb50 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000001:clr! Methoddesccallsite::Calltargetworker+0xf8000007fe ' f0115a7a:00000000 ' 00000001 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 02553470:clr! runmain+0x1e709 000007fe ' f0115971:00000000 ' 00000000 00000000 ' 02551508 00000000 ' 00000000 00000000 ' 00c09a10:clr! Assembly::executemainmethod+0xb60a 000007fe ' f0115be3:00000000 ' 0025f6c8 00000000 ' 01140000 00000000 ' 00000000 00000000 ' 00000000:clr! Systemdomain::executemainmethod+0x5ea0b 000007fe ' f0115bba:00000000 ' 01140000 00000000 ' 0025f820 00000000 ' 00000000 000007fe ' f0e94998:clr! executeexe+0x3f0c 000007fe ' f012805c:ffffffff ' ffffffff00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:clr!_corexemaininternal+0xb20d 000007fe ' f0e37fd5:00000000 ' 00000000 000007fe ' 00000091 00000000 ' 00000000 00000000 ' 0025f788:clr! corexemain+0x140e 000007fe ' f0ed5b21:00000000 ' 00000000 000007fe ' f0128048 00000000 ' 00000000 00000000 ' 00000000:mscoreei! Corexemain+0xe00f00000000 ' 76e159cd:000007fe ' f0e30000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:mscoree! Corexemain_exported+0x5710 00000000 ' 7704a561:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:kernel32! Basethreadinitthunk+0xd11 00000000 ' 00000000:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:ntdll! rtluserthreadstart+0x1d

The first argument to the red line of the args to child is the exception pointer, but it's obviously not here, but the red on the previous line is, I don't know if. Net2 and. Net4 differences, so I use the. Net2 compiled program to debug, the output is as follows:

0:000>!pec0000005 Exception in C:\windows\microsoft.NET\framework64\v2.0.50727\sos.pe debugger extension.pc:000007fe ' e281f8e4 VA:00000000 ' 00000000 r/w: 0 parameter:00000000 ' 000000000:000>!peexception object: 00000000025dc6c0Exceptiontype: System.Argumentexceptionmessage:obj cannot be nullinnerexception:<none>StackTrace(generated): SP IP Function 000000000020e9d0 000007fe8dfa0a9f 03objtypes! Advanced.NET. Debugging.Chapter3.ObjTypes.ThrowException (Advanced.NET. Debugging.Chapter3.ObjTypes) +0x8f000000000020ea10 000007fe8dfa0345 03objtypes! Advanced.NET. Debugging.Chapter3.ObjTypes.Main (system.string[]) +0x225stacktracestring:<none>HResult:800700570:000>KB# Retaddr:args to Child:PagerSite000007fe ' ed6a436f:00000000 ' 002adce0 00000000 ' 002adce0 00000000 ' 0020e780 00000000 ' 002adce0:kernelbase! raiseexception+0x3901 000007fe ' edc808a0:00000000 ' 025dc6c000000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000001:mscorwks! RAISETHEEXCEPTIONINTERNALONLY+0X2FF000007fe ' 8dfa0a9e:00000000 ' 70000195 000007fe ' 8de43528 00000000 ' 00000001 00000000 ' 00000000:mscorwks! jit_throw+0x13003 000007fe ' 8dfa0344:00000000 ' 025daef8 00000000 ' 00000000 00000000 ' 025dae34 00000000 ' 00000000: 0x000007fe' 8dfa0a9e000007fe ' ed838f32:00000000 ' 025d94c8 00000000 ' 00000000 000007fe ' 8de43c70 000007fe ' Ed70f7b9:0x000007fe' 8dfa0344000007fe ' ed6c6683:00000000 ' 00000002 00000000 ' 00000016 000007fe ' ed5f7690 00000000 ' 00000000:mscorwks! calldescrworker+0x8206 000007fe ' edc18d31:00000000 ' 0020ec88 00000000 ' 00000000 00000000 ' 0020ee90 00000000 ' 00000008: mscorwks! calldescrworkerwithhandler+0xd307 000007fe ' ed783d6f:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 0020f0f0:mscorwks! MethodDesc::calldescr+0x2b1000007fe ' ed7a7e24:00000000 ' 00280000 00000000 ' 00000000 00000000 ' 0000001e 00000000 ' 00000000:mscorwks! ClassLoader::runmain+0x22b000007fe ' edd061ad:00000000 ' 0020f6e0 00000000 ' 00000000 00000000 ' 003939e8 00000000 ' 00000200:mscorwks! Assembly::EXECUTEMAINMETHOD+0XBC0a 000007fe ' ed7b52e7:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 000007fe ' ed7cf566:mscorwks! Systemdomain::executemainmethod+0x47d0b 000007fe ' ed797d9c:ffffffff ' Fffffffe 00000000 ' 0020d7f0 0000077c ' 00000000 00000000 ' 00000000:mscorwks! executeexe+0x470c 000007fe ' f0e37fd5:ffffffff ' ffffffff00000000 ' 002adce0 00000000 ' 00000000 00000000 ' 0020f9a8:mscorwks!_corexemain+0xac0d 000007fe ' f0ed5b21:00000000 ' 00000000 000007fe ' Ed797cf0 00000000 ' 00000000 00000000 ' 00000000:mscoreei! Corexemain+0xe00e00000000 ' 76e159cd:000007fe ' f0e30000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:mscoree! Corexemain_exported+0x570f00000000 ' 7704a561:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:kernel32! Basethreadinitthunk+0xd10 00000000 ' 00000000:00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000 00000000 ' 00000000:ntdll! rtluserthreadstart+0x1d

Find this is consistent with what is said in the book, so. Net2 and NET4 programs are still very different.

can also be passed.! Dumpstackobjects (abbreviated!DSO) View all object instances of this thread call stack

OS Thread id:0x2064 (0)RSP/REG Object Name000000000025E630 0000000002557cb8 System.argumentexception000000000025e6a8 0000000002557cb8 System.ArgumentException000000000025E708 0000000002556CD8 Advanced.NET. Debugging.chapter3.Objtypes000000000025E710 0000000002557cb8 System.ArgumentException000000000025E720 0000000002556138 System.byte[]000000000025E740 0000000002557cb8 System.ArgumentException000000000025E750 0000000002557cb8 System.ArgumentException000000000025E830 0000000002556CD8 Advanced.NET. Debugging.chapter3.Objtypes000000000025E838 0000000002557cb8 System.argumentexception000000000025e8f00000000002553470 System.String[]000000000025e8f8 0000000002557d60 System.String OBJ cannot be null000000000025E900 0000000002557cb8 System.ArgumentException000000000025E910 0000000002553470 System.string[]000000000025E930 0000000002556CD8 Advanced.NET. Debugging.chapter3.Objtypes000000000025E950 0000000002557bb8 System.Int32000000000025E958 00000000025535c0 System.String Greater {0}000000000025E960 0000000002556CD8 Advanced.NET. Debugging.chapter3.Objtypes000000000025E968 0000000002557bb8 System.Int32000000000025E970 00000000025535c0 System.String Greater {0}000000000025E978 0000000002557b88 Advanced.NET. Debugging.Chapter3.Comparer ' 1[[system.int32,mscorlib]]000000000025E980 0000000002556CD8 Advanced.NET. Debugging.chapter3.Objtypes000000000025E988 0000000002557b88 Advanced.NET. Debugging.Chapter3.Comparer ' 1[[system.int32,mscorlib]]000000000025E990 0000000002556CD8 Advanced.NET. Debugging.chapter3.objtypes000000000025ea200000000002553470 System.string[]000000000025eb080000000002553470 System.String[]000000000025ebc80000000002553470 System.string[]000000000025ed980000000002553470 System.string[]000000000025edc00000000002551508 System.Appdomain000000000025eea80000000002551508 System.appdomain000000000025f0780000000002551508 System.appdomain000000000025f3700000000002551440 System.sharedstatics

. NET Advanced Debug Learning (3) Exception view

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.