Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne rolfbjarne/foo.diff Secret
Created May 11, 2015

Embed
What would you like to do?
commit 61223de10a53ebe81a75a8abaa68e063fad42a97
Author: Rolf Bjarne Kvinge <rolf@xamarin.com>
Date: Thu May 7 13:04:28 2015 +0200
tmp
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
index b70897d..53b3342 100644
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -3613,6 +3613,10 @@ setup_interface_offsets (MonoClass *class, int cur_slot, gboolean overwrite)
if (class->interfaces_packed && !overwrite) {
g_assert (class->interface_offsets_count == interface_offsets_count);
} else {
+ if (!strcmp (class->name, "X509ChainStatusFlags") || !strcmp (class->name, "HandshakeType")) {
+ fprintf (stderr, "LOG (pid: %i tid: 0x%x): setup_interface_offsets %s interface_offsets_count: %i interfaces_packed: %p START\n",
+ getpid (), (int) pthread_self (), class->name, interface_offsets_count, class->interfaces_packed);
+ }
uint8_t *bitmap;
int bsize;
class->interface_offsets_count = interface_offsets_count;
@@ -3632,6 +3636,14 @@ setup_interface_offsets (MonoClass *class, int cur_slot, gboolean overwrite)
/*if (num_array_interfaces)
g_print ("type %s has %s offset at %d\n", mono_type_get_name_full (&class->byval_arg, 0), mono_type_get_name_full (&interfaces_full [i]->byval_arg, 0), interface_offsets_full [i]);*/
}
+ if (!strcmp (class->name, "X509ChainStatusFlags") || !strcmp (class->name, "HandshakeType")) {
+ fprintf (stderr, "LOG (pid: %i tid: 0x%x): setup_interface_offsets %s interface_offsets_count: %i #1: %p #2: %p #3: %p interfaces_packed: %p DONE\n",
+ getpid (), (int) pthread_self (), class->name, class->interface_offsets_count,
+ class->interface_offsets_count > 0 ? (void *) class->interfaces_packed [0] : (void *) 0xdeadf00d,
+ class->interface_offsets_count > 1 ? (void *) class->interfaces_packed [1] : (void *) 0xdeadf00d,
+ class->interface_offsets_count > 2 ? (void *) class->interfaces_packed [2] : (void *) 0xdeadf00d,
+ class->interfaces_packed);
+ }
#ifdef COMPRESSED_INTERFACE_BITMAP
i = mono_compress_bitmap (NULL, bitmap, bsize);
class->interface_bitmap = mono_class_alloc0 (class, i);
diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c
index 233efef..06f59a6 100644
--- a/mono/metadata/loader.c
+++ b/mono/metadata/loader.c
@@ -749,11 +749,28 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig
continue;
}
+ if (!strcmp (in_class->name, "X509ChainStatusFlags") || !strcmp (in_class->name, "HandshakeType")) {
+ fprintf (stderr, "LOG (pid: %i tid: 0x%x): find_method %s interface_offsets_count: %i #1: %p #2: %p #3: %p interfaces_packed: %p [START]\n",
+ getpid (), (int) pthread_self (), in_class->name, in_class->interface_offsets_count,
+ in_class->interface_offsets_count > 0 ? (void *) in_class->interfaces_packed [0] : (void *) 0xdeadf00d,
+ in_class->interface_offsets_count > 1 ? (void *) in_class->interfaces_packed [1] : (void *) 0xdeadf00d,
+ in_class->interface_offsets_count > 2 ? (void *) in_class->interfaces_packed [2] : (void *) 0xdeadf00d,
+ in_class->interfaces_packed);
+ }
+
+ MonoClass **i_packed = in_class->interfaces_packed;
for (i = 0; i < in_class->interface_offsets_count; i++) {
MonoClass *in_ic = in_class->interfaces_packed [i];
MonoClass *from_ic = from_class->interfaces_packed [i];
char *ic_qname, *ic_fqname, *ic_class_name;
+ if (!in_ic) {
+ kill (getpid (), SIGSTOP);
+ fprintf (stderr, "wtf? i_packed: %p\n", i_packed);
+ kill (getpid (), SIGABRT);
+ }
+ g_assert (in_ic);
+ g_assert (*(void ***)in_ic);
ic_class_name = mono_type_get_name_full (&in_ic->byval_arg, MONO_TYPE_NAME_FORMAT_IL);
ic_qname = g_strconcat (ic_class_name, ".", name, NULL);
if (in_ic->name_space && in_ic->name_space [0])
@@ -765,10 +782,25 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig
g_free (ic_class_name);
g_free (ic_fqname);
g_free (ic_qname);
+
+ // g_assert (i_packed == in_class->interfaces_packed);
+ // g_assert (in_ic == in_class->interfaces_packed [i]);
+
if (result || !mono_error_ok (error))
goto out;
}
+ if (!strcmp (in_class->name, "X509ChainStatusFlags") || !strcmp (in_class->name, "HandshakeType")) {
+ fprintf (stderr, "LOG (pid: %i tid: 0x%x): find_method %s interface_offsets_count: %i #1: %p #2: %p #3: %p interfaces_packed: %p [DONE]\n",
+ getpid (), (int) pthread_self (), in_class->name, in_class->interface_offsets_count,
+ in_class->interface_offsets_count > 0 ? (void *) in_class->interfaces_packed [0] : (void *) 0xdeadf00d,
+ in_class->interface_offsets_count > 1 ? (void *) in_class->interfaces_packed [1] : (void *) 0xdeadf00d,
+ in_class->interface_offsets_count > 2 ? (void *) in_class->interfaces_packed [2] : (void *) 0xdeadf00d,
+ in_class->interfaces_packed);
+ }
+
+ g_assert (i_packed == in_class->interfaces_packed);
+
in_class = in_class->parent;
from_class = from_class->parent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.