使用反汇编.NET对象布局结构 [英] object layout structure in .NET using disassembler

查看:180
本文介绍了使用反汇编.NET对象布局结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望看到的对象布局结构,并想使用在Visual Studio中拆卸。 以下是我的code:

I am interested in seeing the object layout structure, and am trying to use a disassembly in visual studio. Following is my code:

class myclass
{
  public int m_a;
}

myclass myc = new myclass();
myc.m_a = 23;
//I am setting a breakpoint after this line

我在地址栏中打开内存1窗口,键入MYC。我得到了以下细节诠释输出窗口(用于Windows XP的32位PC采用英特尔编译器):

I opened Memory1 window, and type myc in the Address field. I get the following details int the output window (used Windows XP PC 32bit with Intel compiler):

    0x0148B7BC  1c 93 a7 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00

似乎有其在对象数据,它通过4个字节增加对象大小的前面加一个附加的指针00a7931c。我的困惑是,文件说,对象大小是增加8个字节由于每个对象头。可有人请点我到其他的4个字节?

It appears that there is an additional pointer 00a7931c which is added in front of the object data, which increases the object size by 4 bytes. My confusion is that documentation says that object size is increase by 8 bytes due to header per object. Can someone please point me to where the other 4 bytes are?

推荐答案

从<一个href="http://netinverse.com/devblogs/debugging/advanced-net-debugging-clr-objects-internal-structure/626/">Advanced净调试 - CLR对象的内部结构:

这是对象的CLR的内部结构是:

An object’s CLR internal structure is:

[DWORD:的SyncBlock] [DWORD:方法表指针] [DWORD:引用类型的指针] ... [数值类型字段值] ...

[DWORD: SyncBlock][DWORD: MethodTable Pointer][DWORD: Reference type pointer]…[Value of Value Type field]…

对象标题:的[DWORD:的SyncBlock]
  的对象指针:的[DWORD:方法表指针] [DWORD:引用类型的指针] ... [数值类型字段值] ...

Object Header: [DWORD: SyncBlock]
Object Pointer: [DWORD: MethodTable Pointer][DWORD: Reference type pointer]…[Value of Value Type field]…

每一个对象是$ P $由ObjHeader pceded(在负偏移)。该ObjHeader的索引到的SyncBlock。

Every Object is preceded by an ObjHeader (at a negative offset). The ObjHeader has an index to a SyncBlock.

这篇关于使用反汇编.NET对象布局结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆