小编Egl*_*lin的帖子

在带有SOS的WinDbg中查找静态字段的地址

我无法弄清楚如何使用带有SOS的WinDBG来获取静态.NET类成员的地址.给定这样的输入程序:

namespace windg_static_test
{
    class StaticTest
    {
        public static bool static_bool_field = true;
        public void show_and_set()
        {
            while (static_bool_field)
            {
                Console.WriteLine("static_bool_field = " + static_bool_field + "\nEnter new value: ");
                static_bool_field = Console.ReadLine()[0] == '0' ? false : true;
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StaticTest st = new StaticTest();
            st.show_and_set();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我可以使用!name2ee找到EEClass,我可以使用!dumpclass w/name2ee值查看值.

0:004> !dumpclass 1c12e0
Class Name:      windg_static_test.StaticTest
mdToken:         02000002
File:            C:\Develop\Projects\windg static test\bin\Release\windg static test.exe
Parent Class:    64f84920
Module:          001c2e94 …
Run Code Online (Sandbox Code Playgroud)

.net static windbg sos memory-address

3
推荐指数
1
解决办法
2949
查看次数

标签 统计

.net ×1

memory-address ×1

sos ×1

static ×1

windbg ×1