我们在使用WINDBG 做LIVE debug时,经常需要在想停下来的函数上打个断点(打断点的方法我就不在这里说了,可以参看我以前的一些windbg随笔),然后用!clrstack -p 来看看调用堆栈和调用参数。但是如果函数的参数中如有泛型参数的时候,这种方法就有问题了。clrstack 的结果大致如下:

0:004> !clrstack -p
OS Thread Id: 0x1728 (4)
ESP       EIP     
0129e310 04f8d240 SystemService.CreateTCX12A.CreateTCSerials(ServiceInterface.Serials)
    PARAMETERS:
        this = 0x014e0088
        sourceSerials = 0x0142accc

0129e314 04f8d21c SystemService.PreDataHandle.GetTCSerials(ServiceInterface.Serials)
    PARAMETERS:
        this = 0x014e0158
        sourceSerials = 0x0142accc

0129e328 04f8d120 SystemService.WorkSheet.PreDataHandle()
    PARAMETERS:
        this = 0x014dfed0
。。。。。。
在我们可以很清楚的看到CreateTCSerials函数的参数,sourceSerials ,然后用!do 0x0142accc 指令看到参数的全貌。这是不包含泛型参数的函数堆栈信息。那么如果参数有泛型呢,那就不一样了。接下来用个例子来讲述。我有我的函数原型为:
public List<Serials> CalculateDISerials(List<Serials> SourceSerials, string CriterionSerialsName)
我在CalculateDISerials函数上打了一个断点,然后断下来后,我查看了一下堆栈信息,如下

0:009> !clrstack -p
OS Thread Id: 0xe34 (9)
ESP       EIP     
0391ec84 04f88647 SystemService.MainServiceProcess.CalculateDISerials(System.Collections.Generic.List`1<ServiceInterface.Serials>, System.String)
    PARAMETERS:
        this = 0x013165e4

0391ecd0 04f885ee SystemService.MainService.CalculateDISerials(System.Collections.Generic.List`1<ServiceInterface.Serials>, System.String)
    PARAMETERS:
        this = 0x01409c60

我很惊奇的发现,只要是泛型的参数这里就看不到了。那么怎么办呢?
我们知道C++和C#,在编译时,会默认把第一个this指针作为函数的第一个参数,同时在函数压栈时,参数是从左边到右,或者从右到左边依次入栈。函数的第一个参数地址入栈时,是被压入到ECX寄存器上,第二个参数是EDX寄存器上。那么我们找第一个参数和第二个参数的地址就容易了是吧。
0:009> !do edx
Name: System.Collections.Generic.List`1[[ServiceInterface.Serials, ServiceInterface]]
MethodTable: 03d64d04
EEClass: 7912f680
Size: 24(0x18) bytes
 (C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
7912d8f8  40009c7        4      System.Object[]  0 instance 01370164 _items
79102290  40009c8        c         System.Int32  1 instance       20 _size
79102290  40009c9       10         System.Int32  1 instance       20 _version
790fd0f0  40009ca        8        System.Object  0 instance 00000000 _syncRoot
7912d8f8  40009cb        0      System.Object[]  0   shared   static _emptyArray

ok,我们就很容易找到第一个参数的。那么如果要找接下来的参数怎么办呢?

0:009> ? edx
Evaluate expression: 20381948 = 013700fc
我们看到EDX的地址为013700fc

0:009> !dso
OS Thread Id: 0xe34 (9)
ESP/REG  Object   Name
ebx      013700fc System.Collections.Generic.List`1[[ServiceInterface.Serials, ServiceInterface]]
ecx      01315f74 SystemService.MainServiceProcess
edx      013700fc System.Collections.Generic.List`1[[ServiceInterface.Serials, ServiceInterface]]
0391eccc 0136f9cc System.String    工业增加值(当期)
0391ecd0 014182fc SystemService.MainService

我们看到EDX 的下一个地址 是 0136f9cc
0136f9cc 就是第二个参数的地址了。值都已经显示出来了,就不用Do了。如果为多个参数,那就依次类推了。
posted @ 2009-09-09 17:48 启点 阅读(1896) 评论(1) 编辑
我们知道32位系统下,用户态程序只能访问2G的内存,特别是.NET程序在这种情况下,内存一旦超过1.2G后,就很容易出OutofMemeryException异常,有一个选择就是为打开3G开关,那么我们的程序理论上就可以找访问到3G的内存,但是由于32系统寻址的限制,最多4G内存地址,如果打开3G开关,那么留给操作系统内核的的寻址空间之只有1G了。这其实是比较危险的,比较容易出一下莫名其妙的错误。那么怎么在这之间寻找一个平衡点呢。

修改boot.INI如如下内容:

[Boot Loader]
Timeout=30
Default=multi(0)disk(0)rdisk(0)partition(2)\WINNT
[Operating Systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Microsoft Windows Server 2003" /fastdetect /3GB /Userva=2900

特别需要注意的
The /userva=xxxx switch is designed to allow for more precise tuning of User-mode address space for program manufacturers who require more than 2 GB of User-mode space but do not require all the space that is provided by the /3GB tuning switch alone.

这样一来,用户态程序就只会使用2900M,通过userva开关来寻求一个平衡点。
当然遇到这种问题最好的解决方案采用64位操作系统。

参考:http://support.microsoft.com/kb/316739/en-us
posted @ 2009-08-14 10:23 启点 阅读(418) 评论(6) 编辑
使用Windbg查看内存中DataTable的值时,其实方法和查看普通对象是一样的,唯一要注意的时,DataTable对象中值的存储方式有些特别,DataRow中的值是存存放在DataTable的columnCollection中的,思路如下:
1、使用!dumpheap -stat 查找到DataTable的引用
2、使用!do查找到columnCollection
3、查看columnCollection的items是一个OBJECT[],其中每个对象都是System.Data.DataColumn。
4、数据是存放在System.Data.DataColumn的storage中。

直接看代码和步骤吧。
测试代码如下:
Code

1.查找到DataTable的引用
0:003> !dumpheap -stat
total 3,790 objects
Statistics:
        MT      Count     TotalSize Class Name
0x7bec812c          1            12 System.Xml.XmlNonNormalizer
0x7bec7e9c          1            12 System.Xml.XmlDownloadManager
....................................................
0x002d6970          1           232 System.Data.DataTable
.......................................

2. 查看DataTable
0:003> !dumpheap -mt 0x002d6970
   Address         MT     Size  Gen
0x01e08a64 0x002d6970      232 1 System.Data.DataTable
total 1 objects
0:003> !dumpobj 0x01e08a64
Name: System.Data.DataTable
MethodTable 0x002d6970
EEClass 0x03df0bd0
Size 232(0xe8) bytes
GC Generation: 1
mdToken: 0x0200003d  (c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll)
FieldDesc*: 0x002d5ab8
        MT      Field     Offset                 Type       Attr      Value Name
0x7b308b0c 0x4000583      0x4                CLASS   instance 0x00000000 site
0x7b308b0c 0x4000584      0x8                CLASS   instance 0x00000000 events
0x7b308b0c 0x4000582     0x44                CLASS     static 0x01e08d50 EventDisposed
0x002d6970 0x40003ee      0xc                CLASS   instance 0x00000000 dataSet
0x002d6970 0x40003ef     0x10                CLASS   instance 0x00000000 defaultView
0x002d6970 0x40003f0     0xa8         System.Int32   instance 101 nextRowID
0x002d6970 0x40003f1     0x14                CLASS   instance 0x01e08e34 rowCollection
0x002d6970 0x40003f2     0x18                CLASS   instance 0x01e09080 columnCollection
0x002d6970 0x40003f3     0x1c                CLASS   instance 0x01e08ec8 constraintCollection
0x002d6970 0x40003f4     0xac         System.Int32   instance 2 elementColumnCount
0x002d6970 0x40003f5     0x20                CLASS   instance 0x01e08f50 parentRelationsCollection
0x002d6970 0x40003f6     0x24                CLASS   instance 0x01e08fe0 childRelationsCollection
0x002d6970 0x40003f7     0x28                CLASS   instance 0x01e08d5c recordManager
0x002d6970 0x40003f8     0x2c                CLASS   instance 0x01e092b0 indexes
0x002d6970 0x40003f9     0x30                CLASS   instance 0x00000000 shadowIndexes
0x002d6970 0x40003fa     0x34                CLASS   instance 0x00000000 extendedProperties
0x002d6970 0x40003fb     0x38                CLASS   instance 0x01dd1200 tableName
0x002d6970 0x40003fc     0x3c                CLASS   instance 0x00000000 tableNamespace
0x002d6970 0x40003fd     0x40                CLASS   instance 0x01dd1200 tablePrefix
0x002d6970 0x40003fe     0xb4       System.Boolean   instance 0 caseSensitive
0x002d6970 0x40003ff     0xb5       System.Boolean   instance 1 caseSensitiveAmbient
0x002d6970 0x4000400     0x44                CLASS   instance 0x00000000 culture
0x002d6970 0x4000401     0x48                CLASS   instance 0x00000000 displayExpression
0x002d6970 0x4000402     0x4c                CLASS   instance 0x01dddac8 compareInfo
0x002d6970 0x4000403     0xb0         System.Int32   instance 25 compareFlags
0x002d6970 0x4000404     0xb6       System.Boolean   instance 1 fNestedInDataset
0x002d6970 0x4000405     0x50                CLASS   instance 0x00000000 encodedTableName
0x002d6970 0x4000406     0x54                CLASS   instance 0x00000000 xmlText
0x002d6970 0x4000407     0x58                CLASS   instance 0x00000000 _colUnique
0x002d6970 0x4000408     0xb7       System.Boolean   instance 0 textOnly
0x002d6970 0x4000409     0xc4            VALUETYPE   instance start at 01e08b28 minOccurs
0x002d6970 0x400040a     0xd4            VALUETYPE   instance start at 01e08b38 maxOccurs
0x002d6970 0x400040b     0xb8       System.Boolean   instance 0 repeatableElement
0x002d6970 0x400040c     0x5c                CLASS   instance 0x01e08b68 typeName
0x002d6970 0x400040f     0x60                CLASS   instance 0x00000000 primaryKey
0x002d6970 0x4000410     0x64                CLASS   instance 0x01e08b4c primaryIndex
0x002d6970 0x4000411     0x68                CLASS   instance 0x00000000 delayedSetPrimaryKey
..................................

查看具体的columnCollection
0:003> !do 0x01e09080
Name: System.Data.DataColumnCollection
MethodTable 0x002d71dc
EEClass 0x03df0c98
Size 52(0x34) bytes
GC Generation: 1
mdToken: 0x0200001a  (c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll)
FieldDesc*: 0x002d6e18
        MT      Field     Offset                 Type       Attr      Value Name
0x002d6da0 0x4000331     0x3c                CLASS     static 0x01e08de4 RefreshEventArgs
0x002d71dc 0x4000376      0x4                CLASS   instance 0x01e08a64 table
0x002d71dc 0x4000377      0x8                CLASS   instance 0x01e090b4 list
0x002d71dc 0x4000378     0x28         System.Int32   instance 1 defaultNameIndex
0x002d71dc 0x4000379      0xc                CLASS   instance 0x00000000 delayedAddRangeColumns
0x002d71dc 0x400037a     0x10                CLASS   instance 0x01e09670 columnQueue
0x002d71dc 0x400037b     0x14                CLASS   instance 0x01e0911c columnFromName
0x002d71dc 0x400037c     0x18                CLASS   instance 0x01e091e0 hashCodeProvider
0x002d71dc 0x400037d     0x1c                CLASS   instance 0x00000000 onCollectionChangedDelegate
0x002d71dc 0x400037e     0x20                CLASS   instance 0x00000000 onCollectionChangingDelegate
0x002d71dc 0x400037f     0x24                CLASS   instance 0x00000000 onColumnPropertyChangedDelegate
0x002d71dc 0x4000380     0x2c       System.Boolean   instance 0 fInClear

查看list
0:003> !do 0x01e090b4
Name: System.Collections.ArrayList
MethodTable 0x79ba2f5c
EEClass 0x79ba3098
Size 24(0x18) bytes
GC Generation: 1
mdToken: 0x02000100  (c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll)
FieldDesc*: 0x79ba30fc
        MT      Field     Offset                 Type       Attr      Value Name
0x79ba2f5c 0x4000362      0x4                CLASS   instance 0x01e090cc _items
0x79ba2f5c 0x4000363      0xc         System.Int32   instance 2 _size
0x79ba2f5c 0x4000364     0x10         System.Int32   instance 3 _version
0x79ba2f5c 0x4000365      0x8                CLASS   instance 0x00000000 _syncRoot

我们知道
0:003> !do -v 0x01e090cc
Name: System.Object[]
MethodTable 0x003f209c
EEClass 0x003f2018
Size 80(0x50) bytes
GC Generation: 1
Array: Rank 1, Type CLASS
Element Type: System.Object
Content: 16 items
------ Will only dump out valid managed objects ----
   Address            MT    Class Name
0x01e0932c    0x002d7bc8    System.Data.DataColumn
0x01e09518    0x002d7bc8    System.Data.DataColumn

----------
所有DataTable的数据都是存放在System.Data.DataColumn中,在System.Data.DataColumn中有一个数组,加上表中有100行数据的话,那么上面这个结合中的每个System.Data.DataColumn都有一个数组来存放这100行的当前列的数据。ok,让我们接到向下看。
以第一列数据为例
0:003> !do 0x01e0932c
Name: System.Data.DataColumn
MethodTable 0x002d7bc8
EEClass 0x03df0cfc
Size 128(0x80) bytes
GC Generation: 1
mdToken: 0x02000017  (c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll)
FieldDesc*: 0x002d7304
        MT      Field     Offset                 Type       Attr      Value Name
0x7b308b0c 0x4000583      0x4                CLASS   instance 0x00000000 site
..............................................
0x002d7bc8 0x4000369     0x40                CLASS   instance 0x00000000 extendedProperties
0x002d7bc8 0x400036a     0x44                CLASS   instance 0x00000000 onPropertyChangingDelegate
0x002d7bc8 0x400036b     0x48                CLASS   instance 0x01e11688 storage
0x002d7bc8 0x400036c     0x1c         System.Int64   instance 0 autoIncrementCurrent

数据就存放在storage中。
0:003> !do 0x01e11688
Name: System.Data.Common.StringStorage
MethodTable 0x040562b4
EEClass 0x03dfc674
Size 24(0x18) bytes
GC Generation: 0
mdToken: 0x020000c6  (c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll)
FieldDesc*: 0x04056198
        MT      Field     Offset                 Type       Attr      Value Name
0x0405557c 0x4000665      0x4                CLASS   instance 0x01dd43c4 type
0x0405557c 0x4000666      0x8                CLASS   instance 0x01e08a64 table
0x0405557c 0x4000667      0xc                CLASS   instance 0x00000000 dbNullBits
0x040562b4 0x4000761     0x10                CLASS   instance 0x01e116c8 values
0x040562b4 0x4000760     0x4c                CLASS     static 0x01e116a0 DBNullObject

使用!do -v 查看数组对象

0:003> !do -v 0x01e116c8
Name: System.Object[]
MethodTable 0x003f209c
EEClass 0x003f2018
Size 528(0x210) bytes
GC Generation: 0
Array: Rank 1, Type CLASS
Element Type: System.Object
Content: 128 items
------ Will only dump out valid managed objects ----
   Address            MT    Class Name
0x01e11da4    0x79b946b0    System.String
0x01e11f18    0x79b946b0    System.String
0x01e11ff4    0x79b946b0    System.String
0x01e120d0    0x79b946b0    System.String
0x01e121ac    0x79b946b0    System.String
0x01e12288    0x79b946b0    System.String
0x01e12364    0x79b946b0    System.String
0x01e12440    0x79b946b0    System.String
0x01e1251c    0x79b946b0    System.String
0x01e125f8    0x79b946b0    System.String
0x01e126d8    0x79b946b0    System.String
0x01e127bc    0x79b946b0    System.String
...........................
顺便找个数据来看看呢
0:003> !do 0x01e11da4
String: Test0

终于找到了他了吧。
posted @ 2009-08-04 19:12 启点 阅读(277) 评论(1) 编辑
本节主要介绍一下如何通过Windbg来查看静态变量的值,由于静态对象是被CLR直接引用的,因此在使用windbg查看无法从根对象逐级找到待查看对象,因此我的思路是用windbg在有引用到静态变量的函数内打上断点,在windbg在断点停下时,通过查看当前堆栈数据来查找到这个静态变量。

下面是系统中的一个片段,我的目的是要查看 s_htAllCtrl中的类容。
Code

我的思路如下:
1. 查询到待打断点的对象的MethodTable
2. 查看此MethodTable函数详细信息
3. 在需要打断点的函数上打算断点
4. 运行代码直到断点停下然后查看堆栈
5. 我要在函数的中间打断点,因此需要反汇编当前断点函数,然后在函数中间打断点
7. 在断点停下后,查看当前堆栈来取得待查参数的值
让我们一步一步的来吧:
1. 查询到函数地址
0:025> !Name2EE Sobey.MAM.SystemUI.Controls.dll Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar
Searching modules...

Module: 0017fdf8 (sobey.mam.systemui.controls.dll)
MethodTable: 0x06847e78
EEClass: 0x068aa800
Name: Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar

2. 查看函数
0:025> !dumpmt -md 0x06847e78
EEClass : 0x068aa800
Module : 0x0017fc20
Name: Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar
mdToken: 0x02000051  (d:\sony\sonaps\archive\app_server\sobey.mam.systemui.controls.dll)
BaseSize: 0xc
MethodTable Flags : 0x80000
Number of IFaces in IFaceMap : 0x0
Interface Map : 0x06847ed0
Slots in VTable : 9
--------------------------------------
MethodDesc Table
  Entry  MethodDesc   JIT   Name
0x799f6eb8 0x79b93010    PreJIT [DEFAULT] [hasThis] String System.Object.ToString()
0x799abbe8 0x79b93020    PreJIT [DEFAULT] [hasThis] Boolean System.Object.Equals(Object)
0x7999f680 0x79b93050    PreJIT [DEFAULT] [hasThis] I4 System.Object.GetHashCode()
0x79997c00 0x79b93070    PreJIT [DEFAULT] [hasThis] Void System.Object.Finalize()
0x0687e6c0 0x06847e08    JIT    [DEFAULT] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar.HookScrollBar(Class System.Windows.Forms.Control)
0x06847e53 0x06847e58    None   [DEFAULT] Boolean Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar.ShowScrollBar(I,I4,Boolean)
0x0877c2f8 0x06847e18    JIT    [DEFAULT] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar.c_VisibleChanged(Object,Class System.EventArgs)
0x0687e668 0x06847e28    JIT    [DEFAULT] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar..cctor()
0x06847e33 0x06847e38    None   [DEFAULT] [hasThis] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar..ctor()

3. 打断点

0:025> bp 0x0687e6c0
0:025> g

4. 查看堆栈

0:000> !clrstack
Thread 0
ESP         EIP       
0x0012e7f0  0x0687e6c0 [DEFAULT] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar.HookScrollBar(Class System.Windows.Forms.Control)
0x0012e7f4  0x087765b3 [DEFAULT] [hasThis] Void Sobey.MAM.SystemUI.ObjectList.UCObjectList..ctor()
  at [+0x113] [+0x95]
0x0012e828  0x08776489 [DEFAULT] [hasThis] Void Sobey.MAM.SystemUI.ObjectList.UCDBObjectList..ctor()
  at [+0x19] [+0xd]
0x0012e838  0x08773ff1 [DEFAULT] [hasThis] Void Sobey.MAM.AppServer.CommandTaskMonitor.UCCommandTaskList..ctor()
0x0012e86c  0x0877337e [DEFAULT] [hasThis] Void Sobey.MAM.AppServer.Console.ConsoleMainForm..ctor()
0x0012e990  0x7923c069 [FRAME: GCFrame]
0x0012ead0  0x7923c069 [FRAME: ECallMethodFrame] [DEFAULT] [hasThis] Object System.RuntimeType.CreateInstanceImpl(Boolean)
0x0012eae0  0x799b31bb [DEFAULT] Object System.Activator.CreateInstance(Class System.Type,Boolean)
0x0012eb04  0x0877314f [DEFAULT] [hasThis] Class Sobey.MAM.SystemUI.DockControls.IDockContent Sobey.MAM.AppServer.Console.ConsoleCarrierForm.GetContentFromPersistString(String)
0x0012eb3c  0x087717da [DEFAULT] Void Sobey.MAM.SystemUI.DockControls.DockPanelPersist.LoadFromXml(Class Sobey.MAM.SystemUI.DockControls.DockPanel,Class System.IO.Stream,Class Sobey.MAM.SystemUI.DockControls.DeserializeDockContent,Boolean)
0x0012f000  0x091af9cb [DEFAULT] [hasThis] Void Sobey.MAM.SystemUI.DockControls.DockPanel.LoadFromXml(Class System.IO.Stream,Class Sobey.MAM.SystemUI.DockControls.DeserializeDockContent)
0x0012f008  0x0687fd62 [DEFAULT] [hasThis] Void Sobey.MAM.AppServer.Console.ConsoleCarrierForm.LoadDockLayout(Boolean)
0x0012f054  0x091af705 [DEFAULT] [hasThis] Void Sobey.MAM.AppServer.Console.ConsoleCarrierForm.imgToolBar_ToolBarButtonClick(Object,Object,Class System.EventArgs)
0x0012f068  0x091af66e [DEFAULT] [hasThis] Void Sobey.MAM.SystemUI.Controls.ImgToolBar.button_Click(Object,Class System.EventArgs)
0x0012f09c  0x7b881fc4 [DEFAULT] [hasThis] Void System.Windows.Forms.Control.OnClick(Class System.EventArgs)
0x0012f0a8  0x7b885079 [DEFAULT] [hasThis] Void System.Windows.Forms.Control.WmMouseUp(ByRef ValueClass System.Windows.Forms.Message,ValueClass System.Windows.Forms.MouseButtons,I4)
0x0012f0ec  0x7b8234d0 [DEFAULT] [hasThis] Void System.Windows.Forms.Control.WndProc(ByRef ValueClass System.Windows.Forms.Message)
0x0012f100  0x7b823056 [FRAME: InlinedCallFrame]


5.反汇编当前断点
0:000> !u eip
Will print '>>> ' at address: 0x0687e6c0
Normal JIT generated code
[DEFAULT] Void Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar.HookScrollBar(Class System.Windows.Forms.Control)
Begin 0x0687e6c0, size 0xae
>>> 0687e6c0 55              push    ebp
0687e6c1 8bec            mov     ebp,esp
0687e6c3 83ec14          sub     esp,14h
0687e6c6 57              push    edi
0687e6c7 56              push    esi
0687e6c8 53              push    ebx
0687e6c9 33c0            xor     eax,eax
0687e6cb 8945ec          mov     dword ptr [ebp-14h],eax
0687e6ce c745f800000000  mov     dword ptr [ebp-8],0
0687e6d5 8bf1            mov     esi,ecx
0687e6d7 a1f0971602      mov     eax,dword ptr ds:[021697F0h]
0687e6dc 8945ec          mov     dword ptr [ebp-14h],eax
0687e6df 8bc8            mov     ecx,eax
0687e6e1 e896339372      call    mscorwks!JIT_MonEnter (791b1a7c)
0687e6e6 8b0df0971602    mov     ecx,dword ptr ds:[21697F0h]
0687e6ec 8bd6            mov     edx,esi
0687e6ee 8b01            mov     eax,dword ptr [ecx]
0687e6f0 ff5038          call    dword ptr [eax+38h]
0687e6f3 25ff000000      and     eax,0FFh
0687e6f8 7546            jne     0687e740
0687e6fa b98c57bc79      mov     ecx,offset mscorlib_79990000+0x23578c (79bc578c)
0687e6ff e8143918fa      call    00a02018mscorwks.pdb not exist
Use alternate method which may not work.

0687e704 8bf8            mov     edi,eax
0687e706 68137e8406      push    6847E13h
0687e70b 8bcf            mov     ecx,edi
0687e70d 33d2            xor     edx,edx
0687e70f e87f713473      call    mscorlib_79990000+0x235893 (79bc5893) (System.EventHandler..ctor)
0687e714 8bd7            mov     edx,edi
0687e716 8bce            mov     ecx,esi
0687e718 3909            cmp     dword ptr [ecx],ecx
0687e71a ff15482d9e7b    call    dword ptr [system_windows_forms_7b810000+0x1d2d48 (7b9e2d48)] (System.Windows.Forms.Control.add_VisibleChanged)
0687e720 b9b0449106      mov     ecx,69144B0h
0687e725 e8ee3818fa      call    00a02018mscorwks.pdb not exist
Use alternate method which may not work.

0687e72a c6400400        mov     byte ptr [eax+4],0
0687e72e c6400400        mov     byte ptr [eax+4],0
0687e732 50              push    eax
0687e733 8b0df0971602    mov     ecx,dword ptr ds:[21697F0h]
0687e739 8bd6            mov     edx,esi
0687e73b 8b01            mov     eax,dword ptr [ecx]
0687e73d ff5050          call    dword ptr [eax+50h]
0687e740 c745f400000000  mov     dword ptr [ebp-0Ch],0
0687e747 c745f8fc000000  mov     dword ptr [ebp-8],0FCh
0687e74e 6860e78706      push    687E760h
0687e753 eb00            jmp     0687e755
0687e755 8b4dec          mov     ecx,dword ptr [ebp-14h]
0687e758 e841359372      call    mscorwks!JIT_MonExit (791b1c9e)
0687e75d 58              pop     eax
0687e75e ffe0            jmp     eax
0687e760 c745f800000000  mov     dword ptr [ebp-8],0
0687e767 5b              pop     ebx
0687e768 5e              pop     esi
0687e769 5f              pop     edi
0687e76a 8be5            mov     esp,ebp
0687e76c 5d              pop     ebp
0687e76d c3              ret

6.在汇编代码处打上断点
0:000> bp 0687e6e1
0:000> g
7. 查看当前堆栈信息,然后就可以检查堆栈上的参数
0:000> !dso
Thread 0
ESP/REG    Object     Name
ecx        0x1210e90 System.Collections.Hashtable
edx        0x19a1bf8 System.Windows.Forms.Panel
esi        0x19a1bf8 System.Windows.Forms.Panel
edi        0x1139b10 System.Reflection.Assembly
0x12e7d0 0x19a10b0 Sobey.MAM.SystemUI.ObjectList.UCDBObjectList
0x12e7d4 0x1139b10 System.Reflection.Assembly
0x12e7d8 0x1210e90 System.Collections.Hashtable



0:000> !clr10\sos.help

8. 查看当前参数的值
0:000> !dc 0x1210e90
Going to dump the Collection passed.
Collection 0x01210e90: System.Collections.Hashtable
buckets:

        Address            MT    Class Name
key: 0x0120c870    0x0120c870    0x7ba3d688    System.Windows.Forms.RichTextBox
val: 0x01210ef4    0x01210ef4    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x01309220    0x01309220    0x7ba18fec    System.Windows.Forms.Panel
val: 0x0130a6a4    0x0130a6a4    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0130d7f8    0x0130d7f8    0x7ba270e4    System.Windows.Forms.TreeView
val: 0x01312288    0x01312288    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0124d328    0x0124d328    0x7ba3d688    System.Windows.Forms.RichTextBox
val: 0x0124d7f4    0x0124d7f4    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0131db60    0x0131db60    0x7ba18fec    System.Windows.Forms.Panel
val: 0x0131dfb4    0x0131dfb4    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0126c178    0x0126c178    0x7ba18fec    System.Windows.Forms.Panel
val: 0x0126d0dc    0x0126d0dc    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x01313c7c    0x01313c7c    0x7ba3d688    System.Windows.Forms.RichTextBox
val: 0x01313f84    0x01313f84    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x01234bac    0x01234bac    0x7ba18fec    System.Windows.Forms.Panel
val: 0x01235a58    0x01235a58    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0123c664    0x0123c664    0x7ba270e4    System.Windows.Forms.TreeView
val: 0x0124a8c0    0x0124a8c0    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0120c314    0x0120c314    0x7ba3d688    System.Windows.Forms.RichTextBox
val: 0x01210f30    0x01210f30    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

key: 0x0125ce1c    0x0125ce1c    0x7ba18fec    System.Windows.Forms.Panel
val: 0x0125d270    0x0125d270    0x069144b0    Sobey.MAM.SystemUI.Controls.Skin.CoolScrollBar/ScrollBarCtrlMsg

到这个时候,我就已经完全找到待查Hashtable的值了。
posted @ 2009-08-04 18:32 启点 阅读(1997) 评论(5) 编辑

http://www.cnblogs.com/leadzen/archive/2008/02/25/1073404.html
posted @ 2008-02-25 12:53 启点 阅读(82) 评论(0) 编辑
http://blog.csdn.net/niwalker/archive/2005/12/31/567022.aspx


http://www.codeproject.com/KB/cs/object_builder.aspx
posted @ 2008-02-01 17:54 启点 阅读(46) 评论(0) 编辑
摘要: Windbg的入门介绍http://www.cnblogs.com/juqiang/category/118306.htmlWinDBG 技巧:分析程序漏洞是否可以被利用 (!exploitable 命令)http://blog.csdn.net/WinGeek/archive/2009/03/25/4022964.aspx WinDBG 技巧:设断点命令详解(bp, bu, bm, ba...阅读全文
posted @ 2008-01-30 10:48 启点 阅读(132) 评论(1) 编辑
摘要: ProxySocket是对Socket的一个封装。下载地址http://www.mentalis.org。阅读全文
posted @ 2008-01-30 10:27 启点 阅读(66) 评论(0) 编辑