[Mono-list] Nasty x86_magic_trampoline gremlin: ambiguous call sequences

Paolo Molaro lupus@ximian.com
Mon, 25 Feb 2002 16:20:40 +0100

On 02/24/02 Eric Kidd wrote:
> 0x48f7c091 <Mono_CSharp_FieldExpr__Emit_0x820f0d8+137>:	
>     mov    0xffffffe4(%ebp),%ecx
> 0x48f7c094 <Mono_CSharp_FieldExpr__Emit_0x820f0d8+140>:	movzbl 0x24(%ecx),%ecx
> End of assembler dump.
> (gdb) p $ecx
> $1 = 0
> (gdb) p $ebp
> $2 = (void *) 0xbffff600
> Now that I've got debugging symbols, I've got a *much* better chance of
> figuring out what's going on. ;-)

Yes, it helps:-)
Here is what I found in mcs/ecore.cs:

		if (FieldInfo is FieldBuilder){
			Field f = TypeManager.GetField (FieldInfo);
			if (f != null && (f.ModFlags & Modifiers.VOLATILE) != 0)
				is_volatile = true;
			f.status |= Field.Status.USED;

For some reason TypeManager.GetField (FieldInfo) returns NULL (ecx)
and while f != null is checked before inspecting f.ModFlags, it is not
before setting f.status (I guess status is at offset 0x24 in the Field
object). So this is an error in mcs for sure. There may be a bug in
TypeManager.GetField (), too (or more probably in our corlib
implementation that triggers it): miguel might know if it's supposed to
return null in this case. It doesn't help that I still haven't added
support for events in our reflection code;-) But they are not used by
the compiler AFAIK, so they are a lower priority now.

> Are there any C functions buried down somewhere in the runtime which
> could be called from GDB to call ToString on a value?

Currently you can inspect a few object types by casting the address to
one of the C structures defined in object.h or reflection.j and you can

(gdb) print mono_string_to_utf8 (pointer)

My plan is to complete mono_debug_add_type() in jit/debug.c to add
to the stabs information about the objects that is readyly available
in klass->fields: field name, type and offset in the struct.
That way you should be able to print the contents of any object just
like when debugging a C program.


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better