[Mono-devel-list] about Metada

Jonathan Pryor jonpryor at vt.edu
Mon Aug 4 07:33:45 EDT 2003


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
> 




More information about the Mono-devel-list mailing list