摘要 : 本章节介绍NetExt常用的命令. 并且对SOS进行一些对比.

NetExt的帮助

要想玩好NetExt, 入门就得看帮助. 看NetExt的帮助可以调用!whelp 命令. 这样hi列举出NetExt所支持的所有命令.

  1. 0:000> !netext.whelp
  2. netext version 2.0.0.5000 Feb 9 2015
  3. License and usage can be seen here: !whelp license
  4. Check Latest version: !wupdate
  5. For help, type !whelp (or in WinDBG run: '.browse !whelp')
  6. Questions and Feedback: http://netext.codeplex.com/discussions
  7. Copyright (c) 2014-2015 Rodney Viana (http://blogs.msdn.com/b/rodneyviana)
  8. Type: !windex -tree or ~*e!wstack to get started
  9.  
  10. Show Object Detail Commands
  11. ---------------------------
  12. !wdo - Display ad-hoc objects or arrays from GAC or Stack
  13. !wselect - Display ad-hoc fields (and level fields) for an object or for all item in an array
  14. !wfrom - Perform SQL-like analysis of Heap objects enabling comparison, expression evaluation and indexed filtering.
  15. *(new)* !wpe - Dump Exception Object
  16.  
  17. Enumerate objects
  18. ------------------
  19. !windex - index and display objects based in different filters like object with of type HttpContext
  20. !wstack - dump unique stack objects
  21. !wheap - list objects without indexing and show thottled heap sampling
  22. !wgchandle - Dump GC root handles
  23. *(new)* !wdae - Dump All Exceptions
  24.  
  25. Process commands
  26. ----------------
  27. !wclrstack - Dump current stack trace (only managed thread)
  28. *(new)* !wthreads
  29. *(new)* !wver - Show CLR version and extension version
  30. *(new)* !wupdate - Check for update
  31.  
  32. Special
  33. -------
  34.  
  35. !wdict - Display dictionary objects
  36. !whash - Display HashTable objects
  37. !whttp - List HttpContext Objects
  38. !wconfig - Show all .config file lines in memory
  39. !wservice - List WCF service Objects
  40. !weval - Evaluate expression list
  41. !wkeyvalue - Display pair key/value for NameObjectCollection type objects
  42. !wcookie - Display HTTP cookies
  43. !wruntime - Display HTTP Runtime Info including Active Requests
  44. !wtoken - Display WIF tokens and cookies
  45.  
  46. Misc
  47. ----
  48.  
  49. expression syntax
  50. functions list *new functions*
  51. license see all licenses applied to this product

如果想要知道具体更为具体的内容, 需要在!whelp 后面加上这个命令. 例如, NetExt中用得非常多的一个命令!wdo. 这个命令相当于!sos.do. 如果想要知道它更为详细的说明, 可以执行命令 !whelp wdo

  1. 0:000> !netext.whelp wdo
  2. Display ad-hoc objects or arrays from GAC or Stack
  3.  
  4. Usage: !wdo [-forcearray] [-shownull] [-noheader] [-noindex] [-tokens] [-mt <expr>]
  5. [-start <expr>] [-end <expr>] <expr>
  6. Where:
  7. -mt <expr> is the method table address of the object (for value objects). Optional
  8. -start lt;expr> is the starting index of an array. Optional. Default is starting array at item 0
  9. -end <expr> is the end index of an array. Optional. Default is ending array at max items
  10. -forcearray if not used Byte[] and Char[] arrays will show as string instead of array items. Optional
  11. -shownull if not used will show only non-empty array items. Optional
  12. -noheader if present will hide headers and show only object address, fields and values. Optional
  13. -noindex if present will not show array index (useful for .foreach). Optional
  14. -tokens if present will show class token and field token
  15. <expr> is the object or array address (you can use an expression). Required
  16.  
  17. Improvements over !DumpObj:
  18. ---------------------------
  19. - Object, struct and nested class fields show address value with link to detail the field. Click link to follow
  20. - Numeric type fields show both hex and decimal values
  21. - For Enum type fields it shows the type name (or type names for [Flag]Enum) along with the numeric value
  22. - For TimeSpan and DateTime fields it shows the string equivalent
  23. - For strings it show the content after the address
  24. - It shows the inheritance chain in the header (not interface implementations though)
  25. - Byte[] and Char[] objects shows as string if you do not use -forcearraty
  26. - By default, array objects only show non-null items
  27. - Static fields show the value for the first valid application domain where it is defined
  28. - For arrays it lists all components
  29.  
  30. Examples:
  31. -------------
  32.  
  33. Listing an object ad-hoc
  34. ------------------------
  35. !wdo -tokens 00000001556e24e8
  36. Address: 00000001556e24e8
  37. EEClass: 000007feef8c2d50
  38. Method Table: 000007feefc40268
  39. Class Name: System.Runtime.Remoting.Lifetime.Lease
  40. Size : 96
  41. Instance Fields: 12
  42. Static Fields: 1
  43. Total Fields: 13
  44. Heap: 0
  45. Generation: 0
  46. Module: 000007feef7d1000
  47. Assembly: 0000000001373e00
  48. Domain: 000007fef2767880
  49. Dynamic: false
  50. Assembly name: C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll
  51. Inherits: System.Runtime.Remoting.Lifetime.Lease System.Object System.MarshalByRefObject (000007FEEFC40268 000007FEEFC07370 000007FEEFC0AD70)
  52. 400018a 000007feefc07370 2000052 System.Object +0000 __identity 0000000000000000
  53. 400201e 000007feefc0ecf0 2000702 System.Int32 +0020 id 0 (0n0)
  54. 400201f 000007feefc47fb8 2000702 System.DateTime +0030 leaseTime -mt 000007FEEFC47FB8 00000001556E2520 10/26/2011 9:21:08 PM
  55. 4002020 000007feefc47eb8 2000702 System.TimeSpan +0038 initialLeaseTime -mt 000007FEEFC47EB8 00000001556E2528 00:05:00
  56. 4002021 000007feefc47eb8 2000702 System.TimeSpan +0040 renewOnCallTime -mt 000007FEEFC47EB8 00000001556E2530 00:02:00
  57. 4002022 000007feefc47eb8 2000702 System.TimeSpan +0048 sponsorshipTimeout -mt 000007FEEFC47EB8 00000001556E2538 00:02:00
  58. 4002023 000007feefc06c50 2000702 System.Boolean +002c isInfinite 0 (False)
  59. 4002024 000007feefc0f3d8 2000702 System.Collections.Hashtable +0008 sponsorTable 00000001556E2548
  60. 4002025 000007feefc0ecf0 2000702 System.Int32 +0024 sponsorCallThread 0 (0n0)
  61. 4002026 000007feefc41568 2000702 System.Runtime.Remoting.Lifetime.LeaseMa +0010 leaseManager 00000001556E1FD0
  62. 4002027 000007feefc0ad70 2000702 System.MarshalByRefObject +0018 managedObject 0000000155663A40
  63. 4002028 000007fef03aefc0 2000702 System.Runtime.Remoting.Lifetime.LeaseSt +0028 state 2 (0n2) Active
  64. 4002029 000007feefc0ecf0 Static 2000702 System.Int32 +0c78 nextId NoInit
  65.  
  66. Listing only items 5 to 10 (oxa) from an array
  67. ----------------------------------------------
  68. !wdo -start 5 -end a 000000016d29cb50
  69. Address: 000000016d29cb50
  70. EEClass: 00000642780e0cf8
  71. Method Table: 000006427843e2a8
  72. Class Name: System.Collections.Hashtable+bucket[]
  73. Size : 576
  74. Rank: 1
  75. Components: 23
  76. [5]: 000000016d29cbd8
  77. [6]: 000000016d29cbf0
  78. [7]: 000000016d29cc08
  79. [8]: 000000016d29cc20
  80. [9]: 000000016d29cc38
  81. [10]: 000000016d29cc50
  82. * Note: for HashTables you can use !whash
  83.  
  84. Compare to:
  85. -----------
  86. !wselect - also shows add-hoc objects and arrays, however wselect enables the selection of fields (and field levels) and does not show extensive header
  87. !wfrom - enable complex query mechanism with categories, conditions and functions but it is not as simple to use as wselect and wdo
  88.  
  89. How do I get object addresses?
  90. ------------------------------
  91. - Type !windex -enumtypes or !windex -tree to enumerate heap objects
  92. - Type ~*e!wstack to list all objects in the stack for all threads
  93. - 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. 从表面看, 他们显示的结果并没有多大区别.

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

!wdo在细节上则做的更加体贴. 例如dump的对象中包含了一个string类型, !wdo会将string的地址显示出来. 对于枚举类型, 则会将枚举对应的含义显示出来.  !do命令显示出来的结果还必须手工的再对string的地址进行操作. 对枚举的类型的翻译也相当的贴心, 减少了机械枯燥的工作也节省了时间.

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

另外一个优势在于对数组的处理. SOS的!do并不能显示数组里面的内容, 需要使用!dumparray命令.

  1. 0:014> !do 00000001957ab4a8
  2. Name: System.Byte[]
  3. MethodTable: 000007fef0ba0b40
  4. EEClass: 000007fef0722310
  5. Size: 4120(0x1018) bytes
  6. Array: Rank 1, Number of elements 4096, Type Byte (Print Array)
  7. Element Type:System.Byte
  8. Content: <HTML><HEAD><link rel="alternate" type="text/xml" href="http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc?disc
  9. Fields:
  10. None
  11.  
  12. 0:014> !dumparray -details 00000001957ab4a8
  13. Name: System.Byte[]
  14. MethodTable: 000007fef0ba0b40
  15. EEClass: 000007fef0722310
  16. Size: 4120(0x1018) bytes
  17. Array: Rank 1, Number of elements 4096, Type Byte
  18. Element Methodtable: 000007fef0b9c158
  19. [0] 00000001957ab4b8
  20. Name: System.Byte
  21. MethodTable: 000007fef0b9c158
  22. EEClass: 000007fef0720398
  23. Size: 24(0x18) bytes
  24. File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
  25. Fields:
  26. MT Field Offset Type VT Attr Value Name
  27. 000007fef0b9c158 4000276 0 System.Byte 1 instance 60 m_value
  28. [1] 00000001957ab4b9
  29. Name: System.Byte
  30. MethodTable: 000007fef0b9c158
  31. EEClass: 000007fef0720398
  32. Size: 24(0x18) bytes
  33. File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
  34. Fields:
  35. MT Field Offset Type VT Attr Value Name
  36. 000007fef0b9c158 4000276 0 System.Byte 1 instance 72 m_value
  37.  
  38. (…)

使用!wdo时候, 他会尝试将这些数组翻译成一些有意义的内容. 例如上面的byte[]数组, 其实可以拼成一组字符串.

  1. 0:014> !wdo 00000001957ab4a8
  2. Address: 00000001957ab4a8
  3. Method Table/Token: 000007fef0ba0b40/200000004
  4. Class Name: System.Byte[]
  5. Size : 4120
  6. EEClass: 000007fef0722310
  7. Rank: 1
  8. Components: 4096
  9. Data Start: 00000001957ab4b8
  10. <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
  11. </font>{
  12. <font color="blue"> static void </font>Main()
  13. {
  14. <font color="teal">ServiceClient</font> client = <font color="blue">new </font><font color="teal">ServiceClient</font>();
  15.  
  16. <font color="green"> // Use the 'client' variable to call operations on the service.
  17.  
  18. </font><font color="green"> // Always close the client.
  19. </font> client.Close();
  20. }
  21. }
  22. </PRE><BR/><P class='intro'><B>Visual Basic</B></P><PRE><font color="blue">Class </font><font color="teal">Test
  23. </font><font color="blue"> Shared Sub </font>Main()
  24. <font color="blue"> Dim </font>client As <font color="teal">ServiceClient</font> = <font color="blue">New </font><font color="teal">ServiceClient</font>()
  25. <font color="green"> ' Use the 'client' variable to call operations on the service.
  26.  
  27. </font><font color="green"> ' Always close the client.
  28. </font> client.Close()
  29. <font color="blue"> End Sub
  30. </font><font color="blue">End Class</font></PRE></DIV></BODY></HTML>
  31.  
  32. 当然也可以选择以数组的形式进行检查, 同时也可以指定一定的范围. 例如可以用!wdo并且带上参数 -forcearray -start 以及 -end 进行约束.
  33.  
  34. 0:014> !wdo -forcearray -start 0n10 -end 0n15 00000001957ab4a8
  35. Address: 00000001957ab4a8
  36. Method Table/Token: 000007fef0ba0b40/200000004
  37. Class Name: System.Byte[]
  38. Size : 4120
  39. EEClass: 000007fef0722310
  40. Rank: 1
  41. Components: 4096
  42. Data Start: 00000001957ab4b8
  43. [10]: 0x44 (0n68)
  44. [11]: 0x3e (0n62)
  45. [12]: 0x3c (0n60)
  46. [13]: 0x6c (0n108)
  47. [14]: 0x69 (0n105)
  48. [15]: 0x6e (0n110)

还能用-noheader的参数减少输出的内容, 可以关注具体字段里面的数据. 通常是配合一些脚本一起使用.

每一列的意义如下 :

Column 意义
0 当前field的类型的Method Definition Table的地址
1 如果显示Static, 则说明这个field是个Static类型, 否则是个instance
2 类型的名称
3 field的偏移量.
4 field name
5 这个field的具体内容, 如果是个值类型, 则是它的值, 如果是引用类型则显示它的地址.
6 如果是一个常用类型, 则显示他的具体内容, 常用类型包括datetime, string, guid等等

!wselect初体验

另外一个非常强大的功能是!wselect命令. 这个命令与!wdo很类似, 也是用dump object.

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

如果你认为他只能做到这些就图样图森破了. 它还可以只显示个别特定的field, 当然你必须指定field的名称.

  1. 0:014> !wselect m_String, m_Flags from 000000019588b000
  2. [System.Uri]
  3. Known Type Value: http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc
  4. (string)System.String m_String = http://rviana-serv.northamerica.corp.microsoft.com:2000/Service.svc
  5. (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的请求地址.

  1. 0:014> !do 00000001956f77a8
  2. Name: System.Web.HttpContext
  3. MethodTable: 000007fed5396100
  4. EEClass: 000007fed505b938
  5. Size: 344(0x158) bytes
  6. File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll
  7. Fields:
  8. MT Field Offset Type VT Attr Value Name
  9. 000007fed5395598 4000cab 8 ...IHttpAsyncHandler 0 instance 0000000000000000 _asyncAppHandler
  10. 000007fed53950c0 4000cac 10 ...b.HttpApplication 0 instance 0000000000000000 _appInstance
  11. 000007fed5395610 4000cad 18 ....Web.IHttpHandler 0 instance 0000000000000000 _handler
  12. 000007fed5396558 4000cae 20 ...m.Web.HttpRequest 0 instance 00000001956f7900 _request
  13.  
  14. (...)
  15.  
  16. 0:014> !do 00000001956f7900
  17. Name: System.Web.HttpRequest
  18. MethodTable: 000007fed5396558
  19. EEClass: 000007fed505b9a0
  20. Size: 360(0x168) bytes
  21. File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll
  22. Fields:
  23. MT Field Offset Type VT Attr Value Name
  24. 000007fed5399f48 4000d40 8 ...HttpWorkerRequest 0 instance 00000001956f7570 _wr
  25. 000007fed5396100 4000d41 10 ...m.Web.HttpContext 0 instance 00000001956f77a8 _context
  26. 000007fef0b968f0 4000d42 18 System.String 0 instance 00000001956fa860 _httpMethod
  27. 000007fed53cb4c0 4000d43 148 System.Int32 1 instance 2 _httpVerb
  28. 000007fef0b968f0 4000d44 20 System.String 0 instance 0000000000000000 _requestType
  29. 000007fed538ac98 4000d45 28 ...m.Web.VirtualPath 0 instance 00000001956ff140 _path
  30. 000007fef0b968f0 4000d46 30 System.String 0 instance 0000000000000000 _rewrittenUrl
  31. 000007fef0b9d608 4000d47 150 System.Boolean 1 instance 0 _computePathInfo
  32. 000007fed538ac98 4000d48 38 ...m.Web.VirtualPath 0 instance 00000001956fe068 _filePath
  33. 000007fed538ac98 4000d49 40 ...m.Web.VirtualPath 0 instance 0000000000000000 _currentExecutionFilePath
  34. 000007fed538ac98 4000d4a 48 ...m.Web.VirtualPath 0 instance 0000000000000000 _pathInfo
  35. 000007fef0b968f0 4000d4b 50 System.String 0 instance 0000000155660488 _queryStringText
  36. 000007fef0b9d608 4000d4c 151 System.Boolean 1 instance 0 _queryStringOverriden
  37. 000007fef0ba0b40 4000d4d 58 System.Byte[] 0 instance 0000000000000000 _queryStringBytes
  38. 000007fef0b968f0 4000d4e 60 System.String 0 instance 00000001956f76c0 _pathTranslated
  39. 000007fef0b968f0 4000d4f 68 System.String 0 instance 0000000155660488 _contentType
  40. 000007fef0b9c7d8 4000d50 14c System.Int32 1 instance -1 _contentLength
  41. 000007fef0b968f0 4000d51 70 System.String 0 instance 0000000000000000 _clientTarget
  42. 000007fef0b9adf8 4000d52 78 System.Object[] 0 instance 0000000000000000 _acceptTypes
  43. 000007fef0b9adf8 4000d53 80 System.Object[] 0 instance 0000000000000000 _userLanguages
  44. 000007fed53a3f68 4000d54 88 ...owserCapabilities 0 instance 0000000000000000 _browsercaps
  45. 000007feeec9b358 4000d55 90 System.Uri 0 instance 00000001957112a0 _url
  46.  
  47. (...)
  48.  
  49. 0:014> !do 00000001957112a0
  50. Name: System.Uri
  51. MethodTable: 000007feeec9b358
  52. EEClass: 000007feee995d30
  53. Size: 72(0x48) bytes
  54. File: C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll
  55. Fields:
  56. MT Field Offset Type VT Attr Value Name
  57. 000007fef0b968f0 400161c 8 System.String 0 instance 0000000195711240 m_String
  58.  
  59. (...)
  60.  
  61. 0:014> !do 0000000195711240
  62. Name: System.String
  63. MethodTable: 000007fef0b968f0
  64. EEClass: 000007fef071ed58
  65. Size: 92(0x5c) bytes
  66. File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
  67. String: http://localhost:2000/Service.svc
  68. Fields:
  69. MT Field Offset Type VT Attr Value Name
  70. 000007fef0b9c7d8 4000103 8 System.Int32 1 instance 33 m_stringLength

从这里看到, 如果要从HttpContext上面dump Http 请求的地址, 需要执行4次!do指令. 同时还要去找到其他的对象, 那么还需要更多的步骤. 如果需要检查多个HttpContext上面相同的这些字段内容, 将是一场噩梦.

如果这个事情交给NetExt来做就相当的轻松, 只要几个命令, 一切搞定.

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

从这个角度上来说, 这绝对是提高debugging效率的利器.

总结

NetExt针对debugging的工作做了非常多的优化工作.

  • 相对!sos.do, !wdo优化了显示的内容, 很多常用的类型都将会直接显示出具体的内容. 并且针对一些常用的枚举进行了转义, 可以让我们直接了解到枚举的值所代表的意义.
  • !wdo针对数组的显示进行了相当多的优化
  • !wselect同样是dump object的利器. 如果我们岙DUMP的object藏在很深的路径下, 它能够帮助我们介绍很多时间和工作量.

Sonic Guo

Windbg Extension NetExt 使用指南 【2】 ---- NetExt 的基本命令介绍的更多相关文章

  1. Windbg Extension NetExt 使用指南 【1】 ---- NetExt 介绍

    摘要 : 在使用WINDBG做debugging的时候,需要一个好的工具帮助进行数据分析. 最常见的extension包括SOS, PSSCOR.  NetExt则是另外一种提供了丰富命令功能的deb ...

  2. Windbg Extension NetExt

    Windbg Extension NetExt 摘要 : 在使用WINDBG做debugging的时候,需要一个好的工具帮助进行数据分析. 最常见的extension包括SOS, PSSCOR.  N ...

  3. 一起学微软Power BI系列-官方文档-入门指南(1)Power BI初步介绍

    我们在前一篇文章微软新神器-Power BI,一个简单易用,还用得起的BI产品中,我们初步介绍了Power BI的基本知识.由于Power BI是去年开始微软新发布的一个产品,虽然已经可以企业级应用, ...

  4. Windbg Extension NetExt 使用指南 【3】 ---- 挖掘你想要的数据 Managed Heap

    摘要 : NetExt中有两个比较常用的命令可以用来分析heap上面的对象. 一个是!wheap, 另外一个是!windex. !wheap 这个命令可以用于打印出heap structure信息. ...

  5. HarmonyOS三方件开发指南(14)-Glide组件功能介绍

    <HarmonyOS三方件开发指南>系列文章合集 引言 在实际应用开发中,会用到大量图片处理,如:网络图片.本地图片.应用资源.二进制流.Uri对象等,虽然官方提供了PixelMap进行图 ...

  6. Angular开发者指南(一)入门介绍

    什么是Angular AngularJS是动态Web应用程序的结构框架. 它允许您使用HTML作为模板语言,并允许您扩展HTML的语法以清晰,简洁地表达应用程序的组件.AngularJS的数据绑定和依 ...

  7. 第二章排错的工具:调试器Windbg(上)

    感谢博主 http://book.51cto.com/art/200711/59731.htm <Windows用户态程序高效排错>第二章主要介绍用户态调试相关的知识和工具.本文主要讲了排 ...

  8. 揭秘 iOS App Extension 开发 —— Today 篇

    转自:http://www.cocoachina.com/ios/20160619/16760.html 本文授权转载,作者:Cyandev(简书) 从 iOS 8 开始,苹果引入了全新的 App E ...

  9. 一起学微软Power BI系列-官方文档-入门指南(2)获取源数据

    我们在文章: 一起学微软Power BI系列-官方文档-入门指南(1)Power BI初步介绍中,我们介绍了官方入门文档的第一章.今天继续给大家介绍官方文档中,如何获取数据源的相关内容.虽然是英文,但 ...

随机推荐

  1. Android UI体验之全屏沉浸式透明状态栏效果

    前言: Android 4.4之后谷歌提供了沉浸式全屏体验, 在沉浸式全屏模式下, 状态栏. 虚拟按键动态隐藏, 应用可以使用完整的屏幕空间, 按照 Google 的说法, 给用户一种 身临其境 的体 ...

  2. 谈谈一些有趣的CSS题目(十一)-- reset.css 知多少?

    开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...

  3. ASP.NET Core 折腾笔记一

    前言: 在ASP.NET Core 1.0时,曾折腾过一次,后因发现不了System.Data而停止. 更因VS2015提示过期Delete掉VS了,其实主要还是笔记本的硬盘空间吃紧. 快双十一了,本 ...

  4. 在.NET Core 里使用 BouncyCastle 的DES加密算法

    .NET Core上面的DES等加密算法要等到1.2 才支持,我们可是急需这个算法的支持,文章<使用 JavaScriptService 在.NET Core 里实现DES加密算法>需要用 ...

  5. 在离线环境中发布.NET Core至Windows Server 2008

    在离线环境中发布.NET Core至Windows Server 2008 0x00 写在开始 之前一篇博客中写了在离线环境中使用.NET Core,之后一边学习一边写了一些页面作为测试,现在打算发布 ...

  6. MVVM框架从WPF移植到UWP遇到的问题和解决方法

    MVVM框架从WPF移植到UWP遇到的问题和解决方法 0x00 起因 这几天开始学习UWP了,之前有WPF经验,所以总体感觉还可以,看了一些基础概念和主题,写了几个测试程序,突然想起来了前一段时间在W ...

  7. $.type 怎么精确判断对象类型的 --(源码学习2)

    目标:  var a = [1,2,3];     console.log(typeof a); //->object     console.log($.type(a)); //->ar ...

  8. jQuery学习之路(8)- 表单验证插件-Validation

    ▓▓▓▓▓▓ 大致介绍 jQuery Validate 插件为表单提供了强大的验证功能,让客户端表单验证变得更简单,同时提供了大量的定制选项,满足应用程序各种需求.该插件捆绑了一套有用的验证方法,包括 ...

  9. JavaScript模仿块级作用域

    avaScript 没有块级作用域的概念.这意味着在块语句中定义的变量,实际上是在包含函数中而非语句中创建的,来看下面的例子: function outputNumbers(count){ for ( ...

  10. ubuntu系统下如何修改host

    Ubuntu系统的Hosts只需修改/etc/hosts文件,在目录中还有一个hosts.conf文件,刚开始还以为只需要修改这个就可以了,结果发现是需要修改hosts.修改完之后要重启网络.具体过程 ...