Improve verifier error message.
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 27 Jul 2010 18:53:00 +0000 (15:53 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 27 Jul 2010 19:00:27 +0000 (16:00 -0300)
2010-07-27 Rodrigo Kumpera  <rkumpera@novell.com>

* verify.c (do_invoke_method): Improve error message.

mono/metadata/ChangeLog
mono/metadata/verify.c

index 980e3bbd836c1468c64fc976adbed370222e1c23..d78f55430852b30f93e085358a9c59a9a084103c 100644 (file)
@@ -3,6 +3,10 @@
        * sgen-archdep.h: Ensure we store the registers we actually
        need to scan.
 
+2010-07-27 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * verify.c (do_invoke_method): Improve error message.
+
 2010-07-27 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * verify.c (mono_generic_param_is_constraint_compatible): Don't
index 2e6fdb7ff763d085a24f620bd04254dbb1f19229..a62d5c79e28694f3d246ad9fb20805303e70a238 100644 (file)
@@ -2962,8 +2962,16 @@ do_invoke_method (VerifyContext *ctx, int method_token, gboolean virtual)
                        if (method->klass->valuetype && (stack_slot_is_boxed_value (value) || !stack_slot_is_managed_pointer (value)))
                                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Cannot use a boxed or literal valuetype to call a valuetype method at 0x%04x", ctx->ip_offset));
                }
-               if (!verify_stack_type_compatibility (ctx, type, &copy))
-                       CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible this argument on stack with method signature at 0x%04x", ctx->ip_offset));
+               if (!verify_stack_type_compatibility (ctx, type, &copy)) {
+                       char *expected = mono_type_full_name (type);
+                       char *effective = stack_slot_full_name (&copy);
+                       char *method_name = mono_method_full_name (method, TRUE);
+                       CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible this argument on stack with method signature expected '%s' but got '%s' for a call to '%s' at 0x%04x",
+                                       expected, effective, method_name, ctx->ip_offset));
+                       g_free (method_name);
+                       g_free (effective);
+                       g_free (expected);
+               }
 
                if (!IS_SKIP_VISIBILITY (ctx) && !mono_method_can_access_method_full (ctx->method, method, mono_class_from_mono_type (value->type))) {
                        char *name = mono_method_full_name (method, TRUE);