[Mono-devel-list] about Metada (OT)

Piers Haken piersh at friskit.com
Mon Aug 4 15:54:15 EDT 2003


I'm not sure about other debuggers, but Visual C++ (since v2) has had a
'most derive type' field in its watch windows. It can do this because
the symbol table has an entry for the vtable for each class so (*this)
effectively contains the type info for every object regardless of the
static type.

Piers.

> -----Original Message-----
> From: Jonathan Pryor [mailto:jonpryor at vt.edu] 
> Sent: Monday, August 04, 2003 4:34 AM
> To: Fernando Diaz
> Cc: Modo devel list
> Subject: Re: [Mono-devel-list] about Metada
> 
> 
> You don't see the instance fields in your .png because of the 
> debugger. The debugger knows nothing of subclasses, so when 
> it says "1: ob;
> (MonoObject*) 0x80f3a20", it's showing you *only* the 
> MonoObject fields.
> 
> It would be no different inside a C++ app, with:
> 
> 	Base* b = new Derived;
> 	// look at b in debugger
> 
> The debugger doesn't actually know that b is of Derived type, 
> it only knows the static type (Base).  So you can't look at 
> the Derived instance fields unless you cast `b' to the proper 
> type from within the debugger:
> 
> 	(gdb) p ((Derived*)b) # etc...
> 
> At least, this has been my experience with most debuggers.  
> (I can't think of an exception, anyway.)
> 
> You're facing the same basic issue.  However, it's worse for 
> you, as the C debugger knows nothing of the managed world, so 
> you can't say "p
> (Prueba) ob", as the type Prueba is unknown.  Which is 
> precisely why a managed/unmanaged debugger is so useful.  
> (Too bad it doesn't appear to work anymore.  At least, I 
> haven't heard any messages about it working
> now...)
> 
>  - Jon
> 
> On Mon, 2003-08-04 at 05:01, Fernando Diaz wrote:
> > El jue, 24 de 07 de 2003 a las 14:35, Paolo Molaro escribió:
> > 
> > > MonoClassField is just a runtime representation of the 
> metadata for 
> > > field, it doesn't contain the data directly. Static fields are 
> > > stored in MonoVTable->data. Instance fields are allocated in the 
> > > objects after the object header:
> > > 
> > > 
> > > -----		<----- start of object
> > > vtable 		<----- pointer for MonoVTable for the 
> object's class
> > > syncblock	<----- lock/unlock support
> > > first field
> > > second field
> > > ...
> > > 
> > > lupus
> > 
> > I have the Class Prueba with three atributes, the source code is:
> > 
> > class Prueba{
> > 	private string texto;
> > 	private Prueba puntero;	
> >         private int entero;
> >         
> >         public Prueba(string texto,Prueba puntero,int entero){
> > 		this.texto=texto;
> > 		this.puntero=puntero;
> >                 this.entero=entero;
> >         }
> > }
> > 
> > If i examine the memory to look for this atributes (it 
> would be after 
> > de object header) i get this (look the picture). The data 
> isn't after 
> > the object header and the data isn't static.
> > 
> > Why?
> > 
> > Regards. Fernando Díaz
> > 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-devel-> list
> 



More information about the Mono-devel-list mailing list