日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Windbg Extension NetExt 使用指南 【2】 ---- NetExt 的基本命令介绍

發布時間:2025/3/13 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Windbg Extension NetExt 使用指南 【2】 ---- NetExt 的基本命令介绍 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

摘要 : 本章節介紹NetExt常用的命令. 并且對SOS進行一些對比.

NetExt的幫助

要想玩好NetExt, 入門就得看幫助. 看NetExt的幫助可以調用!whelp 命令. 這樣hi列舉出NetExt所支持的所有命令.

0:000> !netext.whelp netext version 2.0.0.5000 Feb 9 2015 License and usage can be seen here: !whelp license Check Latest version: !wupdate For help, type !whelp (or in WinDBG run: '.browse !whelp') Questions and Feedback: http://netext.codeplex.com/discussions Copyright (c) 2014-2015 Rodney Viana (http://blogs.msdn.com/b/rodneyviana) Type: !windex -tree or ~*e!wstack to get startedShow Object Detail Commands --------------------------- !wdo - Display ad-hoc objects or arrays from GAC or Stack !wselect - Display ad-hoc fields (and level fields) for an object or for all item in an array !wfrom - Perform SQL-like analysis of Heap objects enabling comparison, expression evaluation and indexed filtering. *(new)* !wpe - Dump Exception ObjectEnumerate objects ------------------ !windex - index and display objects based in different filters like object with of type HttpContext !wstack - dump unique stack objects !wheap - list objects without indexing and show thottled heap sampling !wgchandle - Dump GC root handles *(new)* !wdae - Dump All ExceptionsProcess commands ---------------- !wclrstack - Dump current stack trace (only managed thread) *(new)* !wthreads *(new)* !wver - Show CLR version and extension version *(new)* !wupdate - Check for updateSpecial -------!wdict - Display dictionary objects !whash - Display HashTable objects !whttp - List HttpContext Objects !wconfig - Show all .config file lines in memory !wservice - List WCF service Objects !weval - Evaluate expression list !wkeyvalue - Display pair key/value for NameObjectCollection type objects !wcookie - Display HTTP cookies !wruntime - Display HTTP Runtime Info including Active Requests !wtoken - Display WIF tokens and cookiesMisc ----expression syntax functions list *new functions* license see all licenses applied to this product

?

如果想要知道具體更為具體的內容, 需要在!whelp 后面加上這個命令. 例如, NetExt中用得非常多的一個命令!wdo. 這個命令相當于!sos.do. 如果想要知道它更為詳細的說明, 可以執行命令 !whelp wdo

0:000> !netext.whelp wdo Display ad-hoc objects or arrays from GAC or StackUsage: !wdo [-forcearray] [-shownull] [-noheader] [-noindex] [-tokens] [-mt <expr>][-start <expr>] [-end <expr>] <expr> Where:-mt <expr> is the method table address of the object (for value objects). Optional-start lt;expr> is the starting index of an array. Optional. Default is starting array at item 0-end <expr> is the end index of an array. Optional. Default is ending array at max items-forcearray if not used Byte[] and Char[] arrays will show as string instead of array items. Optional-shownull if not used will show only non-empty array items. Optional-noheader if present will hide headers and show only object address, fields and values. Optional-noindex if present will not show array index (useful for .foreach). Optional-tokens if present will show class token and field token<expr> is the object or array address (you can use an expression). RequiredImprovements over !DumpObj: ---------------------------- Object, struct and nested class fields show address value with link to detail the field. Click link to follow- Numeric type fields show both hex and decimal values- For Enum type fields it shows the type name (or type names for [Flag]Enum) along with the numeric value- For TimeSpan and DateTime fields it shows the string equivalent- For strings it show the content after the address- It shows the inheritance chain in the header (not interface implementations though)- Byte[] and Char[] objects shows as string if you do not use -forcearraty- By default, array objects only show non-null items- Static fields show the value for the first valid application domain where it is defined- For arrays it lists all componentsExamples: -------------Listing an object ad-hoc ------------------------!wdo -tokens 00000001556e24e8Address: 00000001556e24e8EEClass: 000007feef8c2d50Method Table: 000007feefc40268Class Name: System.Runtime.Remoting.Lifetime.LeaseSize : 96Instance Fields: 12Static Fields: 1Total Fields: 13Heap: 0Generation: 0Module: 000007feef7d1000Assembly: 0000000001373e00Domain: 000007fef2767880Dynamic: falseAssembly name: C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dllInherits: System.Runtime.Remoting.Lifetime.Lease System.Object System.MarshalByRefObject (000007FEEFC40268 000007FEEFC07370 000007FEEFC0AD70)400018a 000007feefc07370 2000052 System.Object +0000 __identity 0000000000000000400201e 000007feefc0ecf0 2000702 System.Int32 +0020 id 0 (0n0)400201f 000007feefc47fb8 2000702 System.DateTime +0030 leaseTime -mt 000007FEEFC47FB8 00000001556E2520 10/26/2011 9:21:08 PM4002020 000007feefc47eb8 2000702 System.TimeSpan +0038 initialLeaseTime -mt 000007FEEFC47EB8 00000001556E2528 00:05:004002021 000007feefc47eb8 2000702 System.TimeSpan +0040 renewOnCallTime -mt 000007FEEFC47EB8 00000001556E2530 00:02:004002022 000007feefc47eb8 2000702 System.TimeSpan +0048 sponsorshipTimeout -mt 000007FEEFC47EB8 00000001556E2538 00:02:004002023 000007feefc06c50 2000702 System.Boolean +002c isInfinite 0 (False)4002024 000007feefc0f3d8 2000702 System.Collections.Hashtable +0008 sponsorTable 00000001556E25484002025 000007feefc0ecf0 2000702 System.Int32 +0024 sponsorCallThread 0 (0n0)4002026 000007feefc41568 2000702 System.Runtime.Remoting.Lifetime.LeaseMa +0010 leaseManager 00000001556E1FD04002027 000007feefc0ad70 2000702 System.MarshalByRefObject +0018 managedObject 0000000155663A404002028 000007fef03aefc0 2000702 System.Runtime.Remoting.Lifetime.LeaseSt +0028 state 2 (0n2) Active4002029 000007feefc0ecf0 Static 2000702 System.Int32 +0c78 nextId NoInitListing only items 5 to 10 (oxa) from an array ----------------------------------------------!wdo -start 5 -end a 000000016d29cb50Address: 000000016d29cb50EEClass: 00000642780e0cf8Method Table: 000006427843e2a8Class Name: System.Collections.Hashtable+bucket[]Size : 576Rank: 1Components: 23[5]: 000000016d29cbd8[6]: 000000016d29cbf0[7]: 000000016d29cc08[8]: 000000016d29cc20[9]: 000000016d29cc38[10]: 000000016d29cc50* Note: for HashTables you can use !whashCompare to: -----------!wselect - also shows add-hoc objects and arrays, however wselect enables the selection of fields (and field levels) and does not show extensive header!wfrom - enable complex query mechanism with categories, conditions and functions but it is not as simple to use as wselect and wdoHow do I get object addresses? ------------------------------- Type !windex -enumtypes or !windex -tree to enumerate heap objects- Type ~*e!wstack to list all objects in the stack for all threads- Type !wheap to show a quick heap sampling without indexing. It will yield a throttled but quick output

?

玩轉DUMP OBJECT

SOS中可以用!do里面把Object的信息DUMP出來. NetExt中, 則是使用!wdo. 從表面看, 他們顯示的結果并沒有多大區別.

0:014> !do 00000001957775e0 Name: System.RuntimeFieldInfoStub MethodTable: 000007fef0b9c950 EEClass: 000007fef07d1dc0 Size: 72(0x48) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll Fields:MT Field Offset Type VT Attr Value Name 000007fef0b95a48 40005c6 8 System.Object 0 instance 0000000000000000 m_keepalive 000007fef0b95a48 40005c7 10 System.Object 0 instance 0000000000000000 m_c 000007fef0b95a48 40005c8 18 System.Object 0 instance 0000000000000000 m_d 000007fef0b9c7d8 40005c9 30 System.Int32 1 instance 0 m_b 000007fef0b95a48 40005ca 20 System.Object 0 instance 0000000000000000 m_e 000007fef0b95a48 40005cb 28 System.Object 0 instance 0000000000000000 m_f 000007fef0ba6d98 40005cc 38 ...eldHandleInternal 1 instance 0000000195777618 m_fieldHandle0:014> !netext.wdo 00000001957775e0 Address: 00000001957775e0 Method Table/Token: 000007fef0b9c950/200014a04 Class Name: System.RuntimeFieldInfoStub Size : 72 EEClass: 000007fef07d1dc0 Instance Fields: 7 Static Fields: 0 Total Fields: 14 Heap/Generation: 1/0 Module: 00000000f06d0000 Assembly: 0000000000da0870 Domain: 00000000f3f75580 Assembly Name: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll Inherits: System.Object (000007FEF0B95A48) 000007fef0b95a48 System.Object +0000 m_keepalive 0000000000000000 000007fef0b95a48 System.Object +0008 m_c 0000000000000000 000007fef0b95a48 System.Object +0010 m_d 0000000000000000 000007fef0b95a48 System.Object +0018 m_e 0000000000000000 000007fef0b95a48 System.Object +0020 m_f 0000000000000000 000007fef0b9c7d8 System.Int32 +0028 m_b 0 (0n0) 000007fef0ba6d98 System.RuntimeFieldHandleInternal +0030 m_fieldHandle -mt 000007FEF0BA6D98 0000000195777618


!wdo在細節上則做的更加體貼. 例如dump的對象中包含了一個string類型, !wdo會將string的地址顯示出來. 對于枚舉類型, 則會將枚舉對應的含義顯示出來.? !do命令顯示出來的結果還必須手工的再對string的地址進行操作. 對枚舉的類型的翻譯也相當的貼心, 減少了機械枯燥的工作也節省了時間.

0:014> !do 000000019588b000 Name: System.Uri MethodTable: 000007feeec9b358 EEClass: 000007feee995d30 Size: 72(0x48) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll Fields:MT Field Offset Type VT Attr Value Name 000007fef0b968f0 400161c 8 System.String 0 instance 000000019571ede0 m_String 000007fef0b968f0 400161d 10 System.String 0 instance 0000000000000000 m_originalUnicodeString 000007feeec9f698 400161e 18 System.UriParser 0 instance 000000019568c020 m_Syntax 000007fef0b968f0 400161f 20 System.String 0 instance 0000000000000000 m_DnsSafeHost 000007feeecf2778 4001620 30 System.UInt64 1 instance 37624152064 m_Flags (...)0:014> !wdo 000000019588b000 Address: 000000019588b000 Method Table/Token: 000007feeec9b358/200037704 Class Name: System.Uri Size : 72 EEClass: 000007feee995d30 Instance Fields: 7 Static Fields: 21 Total Fields: 14 Heap/Generation: 1/0 Module: 00000000ee980000 Assembly: 0000000003ec58a0 Domain: 00000000f3f75580 Assembly Name: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll Inherits: System.Object (000007FEF0B95A48) 000007fef0b968f0 System.String +0000 m_String 000000019571ede0 http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc 000007fef0b968f0 System.String +0008 m_originalUnicodeString 0000000000000000 (null) 000007feeec9f698 System.UriParser +0010 m_Syntax 000000019568c020 000007fef0b968f0 System.String +0018 m_DnsSafeHost 0000000000000000 (null) 000007feeec9fbb8 System.Uri+UriInfo +0020 m_Info 000000015572ea20 000007feeecf2778 System.Uri+Flags +0028 m_Flags 8c2930000 (0n37624152064) IPv6HostType|IPv4HostType|DnsHostType|AuthorityFound|NotDefaultPort|CanonicalDnsHost|MinimalUriInfoSet|AllUriInfoSet|RestUnicodeNormalized (...)


另外一個優勢在于對數組的處理. SOS的!do并不能顯示數組里面的內容, 需要使用!dumparray命令.

0:014> !do 00000001957ab4a8 Name: System.Byte[] MethodTable: 000007fef0ba0b40 EEClass: 000007fef0722310 Size: 4120(0x1018) bytes Array: Rank 1, Number of elements 4096, Type Byte (Print Array) Element Type:System.Byte Content: <HTML><HEAD><link rel="alternate" type="text/xml" href="http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc?disc Fields: None0:014> !dumparray -details 00000001957ab4a8 Name: System.Byte[] MethodTable: 000007fef0ba0b40 EEClass: 000007fef0722310 Size: 4120(0x1018) bytes Array: Rank 1, Number of elements 4096, Type Byte Element Methodtable: 000007fef0b9c158 [0] 00000001957ab4b8Name: System.ByteMethodTable: 000007fef0b9c158EEClass: 000007fef0720398Size: 24(0x18) bytesFile: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dllFields:MT Field Offset Type VT Attr Value Name000007fef0b9c158 4000276 0 System.Byte 1 instance 60 m_value [1] 00000001957ab4b9Name: System.ByteMethodTable: 000007fef0b9c158EEClass: 000007fef0720398Size: 24(0x18) bytesFile: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dllFields:MT Field Offset Type VT Attr Value Name000007fef0b9c158 4000276 0 System.Byte 1 instance 72 m_value(…)


使用!wdo時候, 他會嘗試將這些數組翻譯成一些有意義的內容. 例如上面的byte[]數組, 其實可以拼成一組字符串.

0:014> !wdo 00000001957ab4a8 Address: 00000001957ab4a8 Method Table/Token: 000007fef0ba0b40/200000004 Class Name: System.Byte[] Size : 4120 EEClass: 000007fef0722310 Rank: 1 Components: 4096 Data Start: 00000001957ab4b8 <HTML><HEAD><link rel="alternate" type="text/xml" href="http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc?disco"/><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE><TITLE>Service Service</TITLE></HEAD><BODY><DIV id="content"><P class="heading1">Service Service</P><BR/><P class="intro">You have created a service.<P class='intro'>To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:</P> <BR/><PRE>svcutil.exe <A HREF="http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc?wsdl">http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc?wsdl</A></PRE></P><P class="intro"/>This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:<BR/><P class='intro'><B>C#</B></P><PRE><font color="blue">class </font><font color="teal">Test </font>{ <font color="blue"> static void </font>Main(){<font color="teal">ServiceClient</font> client = <font color="blue">new </font><font color="teal">ServiceClient</font>();<font color="green"> // Use the 'client' variable to call operations on the service.</font><font color="green"> // Always close the client. </font> client.Close();} } </PRE><BR/><P class='intro'><B>Visual Basic</B></P><PRE><font color="blue">Class </font><font color="teal">Test </font><font color="blue"> Shared Sub </font>Main() <font color="blue"> Dim </font>client As <font color="teal">ServiceClient</font> = <font color="blue">New </font><font color="teal">ServiceClient</font>() <font color="green"> ' Use the 'client' variable to call operations on the service.</font><font color="green"> ' Always close the client. </font> client.Close() <font color="blue"> End Sub </font><font color="blue">End Class</font></PRE></DIV></BODY></HTML>當然也可以選擇以數組的形式進行檢查, 同時也可以指定一定的范圍. 例如可以用!wdo并且帶上參數 -forcearray -start 以及 -end 進行約束.0:014> !wdo -forcearray -start 0n10 -end 0n15 00000001957ab4a8 Address: 00000001957ab4a8 Method Table/Token: 000007fef0ba0b40/200000004 Class Name: System.Byte[] Size : 4120 EEClass: 000007fef0722310 Rank: 1 Components: 4096 Data Start: 00000001957ab4b8 [10]: 0x44 (0n68) [11]: 0x3e (0n62) [12]: 0x3c (0n60) [13]: 0x6c (0n108) [14]: 0x69 (0n105) [15]: 0x6e (0n110)

?

還能用-noheader的參數減少輸出的內容, 可以關注具體字段里面的數據. 通常是配合一些腳本一起使用.

每一列的意義如下 :

Column意義
0當前field的類型的Method Definition Table的地址
1如果顯示Static, 則說明這個field是個Static類型, 否則是個instance
2類型的名稱
3field的偏移量.
4field name
5這個field的具體內容, 如果是個值類型, 則是它的值, 如果是引用類型則顯示它的地址.
6如果是一個常用類型, 則顯示他的具體內容, 常用類型包括datetime, string, guid等等

?

!wselect初體驗

另外一個非常強大的功能是!wselect命令. 這個命令與!wdo很類似, 也是用dump object.

0:014> !wselect * from 000000019588b000 [System.Uri] Known Type Value: http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc (string)System.String m_String = http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc (string)System.String m_originalUnicodeString = NULL System.UriParser m_Syntax = 000000019568C020 (string)System.String m_DnsSafeHost = NULL System.Uri+UriInfo m_Info = 000000015572EA20 (…)


如果你認為他只能做到這些就圖樣圖森破了. 它還可以只顯示個別特定的field, 當然你必須指定field的名稱.

0:014> !wselect m_String, m_Flags from 000000019588b000 [System.Uri] Known Type Value: http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc (string)System.String m_String = http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc (uint64)System.Uri+Flags m_Flags = 8c2930000 (0n37624152064) IPv6HostType|IPv4HostType|DnsHostType|AuthorityFound|NotDefaultPort|CanonicalDnsHost|MinimalUriInfoSet|AllUriInfoSet|RestUnicodeNormalized

不僅如此, 它還可以將field所對應的Object下面的field也dump出來. 這個功能非常的實用. 當我需要重復性的檢查一些固定模式的對象值的時候, 可以用他做成一個腳本, 然后一勞永逸的一直執行下去.

例如, 如果我現在知道HttpContext的地址. 然后我需要知道它對應的請求的UTC Time Stamp, http Method, URL, Response status code等等內容時, 應該怎么辦? 這些數據并不全都直接顯示在HttpContext上面. UTC Time Stamp在HttpContext上面可以找到. HttpMethod則在HttpContext下面的HttpRequest下面this._request._httpMethod. URI則離得更遠, _request._url.m_String. Response Status Code又在另外一個對象上this._response._statusCode. 下面舉例我如何通過SOS去DUMP一個Http的請求地址.

0:014> !do 00000001956f77a8 Name: System.Web.HttpContext MethodTable: 000007fed5396100 EEClass: 000007fed505b938 Size: 344(0x158) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll Fields:MT Field Offset Type VT Attr Value Name 000007fed5395598 4000cab 8 ...IHttpAsyncHandler 0 instance 0000000000000000 _asyncAppHandler 000007fed53950c0 4000cac 10 ...b.HttpApplication 0 instance 0000000000000000 _appInstance 000007fed5395610 4000cad 18 ....Web.IHttpHandler 0 instance 0000000000000000 _handler 000007fed5396558 4000cae 20 ...m.Web.HttpRequest 0 instance 00000001956f7900 _request(...)0:014> !do 00000001956f7900 Name: System.Web.HttpRequest MethodTable: 000007fed5396558 EEClass: 000007fed505b9a0 Size: 360(0x168) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll Fields:MT Field Offset Type VT Attr Value Name 000007fed5399f48 4000d40 8 ...HttpWorkerRequest 0 instance 00000001956f7570 _wr 000007fed5396100 4000d41 10 ...m.Web.HttpContext 0 instance 00000001956f77a8 _context 000007fef0b968f0 4000d42 18 System.String 0 instance 00000001956fa860 _httpMethod 000007fed53cb4c0 4000d43 148 System.Int32 1 instance 2 _httpVerb 000007fef0b968f0 4000d44 20 System.String 0 instance 0000000000000000 _requestType 000007fed538ac98 4000d45 28 ...m.Web.VirtualPath 0 instance 00000001956ff140 _path 000007fef0b968f0 4000d46 30 System.String 0 instance 0000000000000000 _rewrittenUrl 000007fef0b9d608 4000d47 150 System.Boolean 1 instance 0 _computePathInfo 000007fed538ac98 4000d48 38 ...m.Web.VirtualPath 0 instance 00000001956fe068 _filePath 000007fed538ac98 4000d49 40 ...m.Web.VirtualPath 0 instance 0000000000000000 _currentExecutionFilePath 000007fed538ac98 4000d4a 48 ...m.Web.VirtualPath 0 instance 0000000000000000 _pathInfo 000007fef0b968f0 4000d4b 50 System.String 0 instance 0000000155660488 _queryStringText 000007fef0b9d608 4000d4c 151 System.Boolean 1 instance 0 _queryStringOverriden 000007fef0ba0b40 4000d4d 58 System.Byte[] 0 instance 0000000000000000 _queryStringBytes 000007fef0b968f0 4000d4e 60 System.String 0 instance 00000001956f76c0 _pathTranslated 000007fef0b968f0 4000d4f 68 System.String 0 instance 0000000155660488 _contentType 000007fef0b9c7d8 4000d50 14c System.Int32 1 instance -1 _contentLength 000007fef0b968f0 4000d51 70 System.String 0 instance 0000000000000000 _clientTarget 000007fef0b9adf8 4000d52 78 System.Object[] 0 instance 0000000000000000 _acceptTypes 000007fef0b9adf8 4000d53 80 System.Object[] 0 instance 0000000000000000 _userLanguages 000007fed53a3f68 4000d54 88 ...owserCapabilities 0 instance 0000000000000000 _browsercaps 000007feeec9b358 4000d55 90 System.Uri 0 instance 00000001957112a0 _url(...)0:014> !do 00000001957112a0 Name: System.Uri MethodTable: 000007feeec9b358 EEClass: 000007feee995d30 Size: 72(0x48) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll Fields:MT Field Offset Type VT Attr Value Name 000007fef0b968f0 400161c 8 System.String 0 instance 0000000195711240 m_String(...)0:014> !do 0000000195711240 Name: System.String MethodTable: 000007fef0b968f0 EEClass: 000007fef071ed58 Size: 92(0x5c) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll String: http://localhost:2000/Service.svc Fields:MT Field Offset Type VT Attr Value Name 000007fef0b9c7d8 4000103 8 System.Int32 1 instance 33 m_stringLength


從這里看到, 如果要從HttpContext上面dump Http 請求的地址, 需要執行4次!do指令. 同時還要去找到其他的對象, 那么還需要更多的步驟. 如果需要檢查多個HttpContext上面相同的這些字段內容, 將是一場噩夢.

如果這個事情交給NetExt來做就相當的輕松, 只要幾個命令, 一切搞定.

0:014> !wselect _utcTimestamp, _request._httpMethod, _request._url.m_String, _response._statusCode from 00000001956f77a8 [System.Web.HttpContext] System.DateTime _utcTimestamp = -mt 000007FEF0BB96C8 00000001956F78D8 10/26/2011 11:29:15 PM (string)System.String _request._httpMethod = GET (string)System.String _request._url.m_String = http://localhost:2000/Service.svc (int32)System.Int32 _response._statusCode = c8 (0n200)

從這個角度上來說, 這絕對是提高debugging效率的利器.

?

總結

NetExt針對debugging的工作做了非常多的優化工作.

  • 相對!sos.do, !wdo優化了顯示的內容, 很多常用的類型都將會直接顯示出具體的內容. 并且針對一些常用的枚舉進行了轉義, 可以讓我們直接了解到枚舉的值所代表的意義.
  • !wdo針對數組的顯示進行了相當多的優化
  • !wselect同樣是dump object的利器. 如果我們岙DUMP的object藏在很深的路徑下, 它能夠幫助我們介紹很多時間和工作量.

?

Sonic Guo

轉載于:https://www.cnblogs.com/developersupport/p/Debugging-NetExt-Dump-Object.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Windbg Extension NetExt 使用指南 【2】 ---- NetExt 的基本命令介绍的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。