Created
August 17, 2018 16:35
-
-
Save lambdageek/fccc5f71ede8bf48ead7717817105024 to your computer and use it in GitHub Desktop.
Dump method flags from Type.GetInterfaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From aef2462e3c0283734e2c2c36f2a3af162df825b0 Mon Sep 17 00:00:00 2001 | |
From: Aleksey Kliger <[email protected]> | |
Date: Fri, 17 Aug 2018 12:32:24 -0400 | |
Subject: [PATCH] dump some method info if env var FOOF is set | |
--- | |
mono/metadata/icall.c | 14 ++++++++++++++ | |
1 file changed, 14 insertions(+) | |
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c | |
index 1dcbce6a541..32c80e3b42f 100644 | |
--- a/mono/metadata/icall.c | |
+++ b/mono/metadata/icall.c | |
@@ -2588,6 +2588,20 @@ ves_icall_RuntimeType_GetInterfaces (MonoReflectionTypeHandle ref_type, MonoErro | |
MonoType *type = MONO_HANDLE_GETVAL (ref_type, type); | |
MonoClass *klass = mono_class_from_mono_type (type); | |
+ if (getenv ("FOOF") != NULL) { | |
+ gpointer iter = NULL; | |
+ MonoMethod *m = NULL; | |
+ while ((m = mono_class_get_methods (klass, &iter))) { | |
+ const char *method_name = mono_method_get_name (m); | |
+ guint32 method_flags = mono_method_get_flags (m, NULL); | |
+ fprintf (stderr, "method: %s, flags: 0x%0x\n", method_name, method_flags); | |
+ if ((method_flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) | |
+ fprintf (stderr, " public\n"); | |
+ else if ((method_flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_FAMILY) | |
+ fprintf (stderr, " family\n"); | |
+ } | |
+ } | |
+ | |
GHashTable *iface_hash = g_hash_table_new (get_interfaces_hash, NULL); | |
MonoGenericContext *context = NULL; | |
-- | |
2.18.0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
interface U {} | |
public class B : U { | |
protected T foo<T> () { | |
Console.WriteLine ("B"); | |
return default(T); | |
} | |
} | |
public class Foof { | |
public static void Main () | |
{ | |
var x = typeof(Foof).Assembly.GetType ("B"); | |
var its = x.GetInterfaces(); /* hacked this icall to dump method info about "x" */ | |
Console.WriteLine ("ints: "); | |
foreach (var i in its) { | |
Console.WriteLine (i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see this output: