zoukankan      html  css  js  c++  java
  • WinDbg 查看静态变量

    有如下Class。若想查看静态变量内容。因为静态变量和类绑定,仅需要查看类即可。

    namespace ConsoleApplication13
    {
        class Program
        {
            public static string public_string = "pubstr_static";
            public static string private_string = "pristr_static";
    ...
    } }

    1、查找类。 !Name2EE ConsoleApplication13.exe ConsoleApplication13.Program

    0:000> !Name2EE ConsoleApplication13.exe ConsoleApplication13.Program
    Module:      00007ff83abd40c0
    Assembly:    ConsoleApplication13.exe
    Token:       0000000002000002
    MethodTable: 00007ff83abd5d98
    EEClass:     00007ff83ace3238
    Name:        ConsoleApplication13.Program

    2、导出类。 !DumpClass 00007ff83ace3238

    0:000> !DumpClass 00007ff83ace3238
    Class Name:      ConsoleApplication13.Program
    mdToken:         0000000002000002
    File:            E:新建文件夹ConsoleApplication13inDebugConsoleApplication13.exe
    Parent Class:    00007ff887de4b60
    Module:          00007ff83abd40c0
    Method Table:    00007ff83abd5d98
    Vtable Slots:    4
    Total Method Slots:  6
    Class Attributes:    100000  
    Transparency:        Critical
    NumInstanceFields:   0
    NumStaticFields:     3
                  MT    Field   Offset                 Type VT     Attr            Value Name
    00007ff888498538  4000001        8        System.String  0   static 000000000f0143a0 public_string
    00007ff888498538  4000002       10        System.String  0   static 000000000f0143d8 private_string
    0000000000000000  4000003       18                       0   static 0000000000000000 CS$<>9__CachedAnonymousMethodDelegate1

    3、可看出3个静态变量,其中2个String。!do  000000000f0143a0 。红色即为内容。

    0:000> !do  000000000f0143a0 
    Name:        System.String
    MethodTable: 00007ff888498538
    EEClass:     00007ff887de4ab8
    Size:        52(0x34) bytes
    File:        C:WindowsMicrosoft.NetassemblyGAC_64mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll
    String:      pubstr_static
    Fields:
                  MT    Field   Offset                 Type VT     Attr            Value Name
    00007ff88849af60  4000243        8         System.Int32  1 instance               13 m_stringLength
    00007ff8884996e8  4000244        c          System.Char  1 instance               70 m_firstChar
    00007ff888498538  4000248       80        System.String  0   shared           static Empty
                                     >> Domain:Value  0000000000559b60:NotInit  <<
  • 相关阅读:
    建立文件类型关联
    Delphi程序员,你们现在还好吗?
    加一文档到开始菜单中的文件夹下
    文本转换为GIF
    取消文件类型的关联
    取得任务栏的高度
    TeeChart使用范例
    同步SQL Server服务器时间
    注册系统热键
    山西襄汾溃坝事故已造成259人死亡
  • 原文地址:https://www.cnblogs.com/wigis/p/7484983.html
Copyright © 2011-2022 走看看