[Mono-dev] AOT compiler crash

Michael Bayne mdb at samskivert.com
Fri Jan 20 20:44:01 UTC 2012


On Fri, Jan 20, 2012 at 11:38 AM, Michael Bayne <mdb at samskivert.com> wrote:
> since I don't have the source

I guess this isn't completely true. I can at least look at the mono
source and try to triangulate from there. Based on that, I'm seeing
only two likely callers of mono_marshal_get_delegate_begin_invoke,
which is what contains the failing assert:

	g_assert (method && method->klass->parent ==
mono_defaults.multicastdelegate_class &&
		  !strcmp (method->name, "BeginInvoke"));

One in mini/aot-compiler.c:

		if (klass->delegate && klass != mono_defaults.delegate_class &&
klass != mono_defaults.multicastdelegate_class &&
!klass->generic_container) {
			method = mono_get_delegate_invoke (klass);
...
			method = mono_class_get_method_from_name_flags (klass, "BeginInvoke", -1, 0);
			if (method)
				add_method (acfg, mono_marshal_get_delegate_begin_invoke (method));

which seems to meet two of the failing assert conditions (that method
be non-null and that the method name be "BeginInvoke"), which leaves
the possibility of method->klass->parent not being
mono_defaults.multicastdelegate_class.

The other caller in mini/mini.c:

		if (method->klass->parent == mono_defaults.multicastdelegate_class) {
			if (*name == '.' && (strcmp (name, ".ctor") == 0)) {
...
			} else if (*name == 'I' && (strcmp (name, "Invoke") == 0)) {
...
			} else if (*name == 'B' && (strcmp (name, "BeginInvoke") == 0)) {
				nm = mono_marshal_get_delegate_begin_invoke (method);
				return mono_get_addr_from_ftnptr (mono_compile_method (nm));

seems to meet all three conditions, so I'm suspecting the first caller.

> Can someone point me in the direction of what useful debugging
> information I can obtain to help pin-point the issue (if it's
> something weird that IKVM is doing, I can certainly fix that).

I tried running arm-darwin-mono in gdb, but I can't seem to set a
breakpoint on mono_marshal_get_delegate_begin_invoke. I'm not super
fluent in Mac OS native development, but maybe that binary lacks
debugging symbols? (Is there a way to make otool show those?)

Just going off the hunch that maybe IKVM is generating a funny
delegate (that contains BeginInvoke but doesn't extend
MulticastDelegate), I tried running monodis on IKVM.OpenJDK.Core.dll.
Tragically that crashes with a bus error in:

0x0000f459 in dis_stringify_method_signature_full (m=0x902200,
method=0x0, methoddef_row=869, container=0x0, fully_qualified=0,
with_marshal_info=1) at get.c:913

before it gets very far into the dll.

Is it possible for me to rebuild arm-darwin-mono with debug symbols
based on the mono source checked out from Github? I don't know to what
extent the shipped version of MonoTouch differs from the open source
code on that front.

Thanks again for any pointers,

Michael

-- mdb at samskivert.com


More information about the Mono-devel-list mailing list