none
Method Table Field Details List? RRS feed

  • Question

  • Hello,

    A debugger dump of an object instance's method table gives use a bunch of DWORDs representing the values of the method table's fields, like:

    0:000> dd 001d335c001d335c 00000000 00000014 00040011 00000004001d336c 710d061c 001d2f2c 001d3394 001d1338001d337c 00000000 00000000 71026aa0 71026ac0001d338c 71026b30 71097410 00000080 00000000001d339c 00000000 00000000 00000000 00000000001d33ac 00000000 00000000 00000000 00000000001d33bc 00000000 00000000 00000000 00000000001d33cc 00000000 00000000 00000000 00000000

    Does anyone know where to locate a complete list of field descriptions (names, purpose, etc.) for CLR 4.0 method tables or earlier versions)? There are several different method table diagrams for various versions of the CLR floating around that are more or less detailed. But I'd like to the 'real' diagram/list.

    Thanks

    Thursday, April 15, 2010 11:27 PM

Answers

  • MethodTable fields are internal implementation detail which CLR team doesn't ship publicly (IMO from general reasons like security and intelectual property).
    If you are interested in general design of 2.0 behavior, you can always look at MethodTable definition in rotor sources.

    BTW: Reverse engineering SOS is probably violation of EULA, so I wouldn't recommend it ;-). Anyway it would be IMO very difficult (based on my knowledge of the source code).

    If you have some specific questions about general principles, I can try to answer them (I am developer on CLR TypeSystem team which means that I own MethodTable). Of course I cannot answer too technical details (from the reasons mentioned above), but I think I can help you with some questions especially about rotor sources.

    -Karel

    • Marked as answer by Bob Bedell Friday, April 16, 2010 9:41 PM
    Friday, April 16, 2010 5:11 PM
    Moderator

All replies

  • Here are couple of them that could help in answering your question

    http://www.codeproject.com/KB/cs/net_type_internals.aspx

    http://msdn.microsoft.com/en-us/magazine/cc163791.aspx

     

    FYI Method table would be info would be in 0x06000000 , Field Def would be 0x04000000

     

     


    Thanks Naveen http://naveensrinivasan.com
    Friday, April 16, 2010 2:40 AM
  • Thanks for you're reply. I've already been over both of those articles extensiely. The second has the best method table diagram I've come across so far, but it is also a .NET 1.1 article. I'm reading Mario Hewardt's "Advanced .NET Debugging" at the moment, which targets CLR 2, and he is reporting  a similar, but different, field sequence. One can do a method table dump with a tool like SOS.dll, but the output is incomplete.

    Anyway, no big deal. Just curious.

    Bob

    Friday, April 16, 2010 9:26 AM
  • You can always use another native debugger to try and find out how SOS reads the method table :) 

    By the way, I'm also reading that book. It's a great reading! 


    -- Blog: http://geeklyeverafter.blogspot.com/
    Friday, April 16, 2010 9:40 AM
  • MethodTable fields are internal implementation detail which CLR team doesn't ship publicly (IMO from general reasons like security and intelectual property).
    If you are interested in general design of 2.0 behavior, you can always look at MethodTable definition in rotor sources.

    BTW: Reverse engineering SOS is probably violation of EULA, so I wouldn't recommend it ;-). Anyway it would be IMO very difficult (based on my knowledge of the source code).

    If you have some specific questions about general principles, I can try to answer them (I am developer on CLR TypeSystem team which means that I own MethodTable). Of course I cannot answer too technical details (from the reasons mentioned above), but I think I can help you with some questions especially about rotor sources.

    -Karel

    • Marked as answer by Bob Bedell Friday, April 16, 2010 9:41 PM
    Friday, April 16, 2010 5:11 PM
    Moderator
  • Actually a copy of Stutz, Neward, Shilling's "Shared Source CLI Essentials " just showed up in the mail today. I got it on Amazon last week for $2.00.

    I think MethodTable and EEClass are both in the 'class.h' file. Please correct me if that isn't right, or if there are other relevant source files. I'll have to poke around a bit.

    Thanks for the reply.

     

    Friday, April 16, 2010 9:41 PM
  • hi Karel,

    Does a types method table directly contain a pointer to the type's parent method table, or does it just contain a pointer to EEClass, which in turn has a pointer to the types parent method table (in CLR 2 and 4). I've read both versions of this story before.

    Friday, April 16, 2010 10:20 PM
  • Never mind. I found the the parent method table pointer and the EEClass pointer. 2 different fields.
    Friday, April 16, 2010 11:17 PM
  • EEClass is in VM\class.h, MethodTable is in VM\MethodTable.h. Find-In-Files will confirm that for you.

    EEClass is cold part of MethodTable. With generics EEClass points only to shared MethodTable, while multiple MethodTables (shared instantiations) can point to the same EEClass. And yes, MethodTable has pointer to its parent (m_pParentMethodTable).

    -Karel

    Friday, April 16, 2010 11:27 PM
    Moderator
  • Thanks. I didn't know about MethodTable.h.
    Friday, April 16, 2010 11:43 PM