• 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  <<
  • 相关阅读:
    [转帖]译文:如何使用SocketAsyncEventArgs类(How to use the SocketAsyncEventArgs class)
    如何建立一个“绑定友好的”usercontrol--wpf
    安卓学习(三)
    安卓学习(二)
    Android学习1
    用伪代码梳理springboot
    用伪代码梳理javaweb从零开始
    用伪代码梳理spring源码
    java如何写出简洁代码
    JAVA修复微信官方SDK支付XXE漏洞
  • 原文地址:https://www.cnblogs.com/wigis/p/7484983.html
Copyright © 2020-2023  润新知