[mono-symbolicate] Use IKVM.Reflection instead of System.Reflection
authorAlexis Christoforides <alexis@thenull.net>
Thu, 7 Apr 2016 21:53:14 +0000 (17:53 -0400)
committerAlexis Christoforides <alexis@thenull.net>
Thu, 7 Apr 2016 21:53:14 +0000 (17:53 -0400)
This is so that the tool can work independently of runtime assembly resolution (ie. to load alternate corlibs)

mcs/class/corlib/System.Diagnostics/StackTraceHelper.cs
mcs/tools/mono-symbolicate/LocationProvider.cs
mcs/tools/mono-symbolicate/Makefile
mcs/tools/mono-symbolicate/Test/symbolicate.expected
mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources

index 3bf9995ecdbac6ba7142d72d8da834c04d2cdada..e9e0a07ebb62df9fb45addb95e9726bfdcfcc091 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System.Text;
-using System.Reflection;
-
 namespace System.Diagnostics {
 
+       using System.Text;
+#if INSIDE_CORLIB
+       using System.Reflection;
+#else
+       using IKVM.Reflection;
+       using IKVM.Reflection.Reader;
+       using Type = IKVM.Reflection.Type;
+#endif
        // This class exists so tools such as mono-symbolicate can use it directly.
        class StackTraceHelper {
                
@@ -76,11 +81,8 @@ namespace System.Diagnostics {
                                if (pt.IsGenericType && ! pt.IsGenericTypeDefinition)
                                        pt = pt.GetGenericTypeDefinition ();
 
-                               if (pt.IsClass && !String.IsNullOrEmpty (pt.Namespace)) {
-                                       sb.Append (pt.Namespace);
-                                       sb.Append (".");
-                               }
-                               sb.Append (pt.Name);
+                               sb.Append (pt.ToString());
+
                                if (p [i].Name != null) {
                                        sb.Append (" ");
                                        sb.Append (p [i].Name);
index 0580eeb9615db86aba1c056ff7e1256b528423e6..333ad1885b7e24b8506cf2da39f5474873eed0c7 100644 (file)
@@ -2,7 +2,7 @@ using System;
 using System.IO;
 using System.Linq;
 using System.Text;
-using System.Reflection;
+using IKVM.Reflection;
 using System.Diagnostics;
 using System.Collections.Generic;
 using Mono.Cecil;
@@ -77,6 +77,7 @@ namespace Symbolicate
                        }
                }
 
+               static readonly Universe ikvm_reflection = new Universe ();
                Dictionary<string, AssemblyLocationProvider> assemblies;
                HashSet<string> directories;
 
@@ -94,14 +95,14 @@ namespace Symbolicate
                        if (!File.Exists (assemblyPath))
                                throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
 
-                       var assembly = Assembly.ReflectionOnlyLoadFrom (assemblyPath);
+                       var assembly = ikvm_reflection.LoadFile (assemblyPath);
                        MonoSymbolFile symbolFile = null;
 
                        var symbolPath = assemblyPath + ".mdb";
                        if (!File.Exists (symbolPath))
                                Debug.WriteLine (".mdb file was not found for " + assemblyPath);
                        else
-                               symbolFile = MonoSymbolFile.ReadSymbolFile (assemblyPath + ".mdb");
+                               symbolFile = MonoSymbolFile.ReadSymbolFile (symbolPath);
 
                        var seqPointDataPath = assemblyPath + ".msym";
                        if (!File.Exists (seqPointDataPath))
index 1a621f6f825d481048b2f70abf119b4d4a9c925b..528fbcee7f50dc5e1fc4cf955f71c123fbd20c65 100644 (file)
@@ -4,7 +4,8 @@ include ../../build/rules.make
 
 PROGRAM = mono-symbolicate.exe
 
-LOCAL_MCS_FLAGS =
+LOCAL_MCS_FLAGS = \
+       /D:NO_AUTHENTICODE
 
 LIB_REFS = Mono.Cecil Mono.CompilerServices.SymbolWriter System.Xml System.Core System
 
index a426d61200eaed9a2c3e8664903605e3f015d807..a3cd72acd0ef271381ede360b4d50799ca61c8fb 100644 (file)
@@ -11,22 +11,22 @@ Stacktrace:
   at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
 
 System.Exception: Stacktrace with 3 frames
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:78 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
   at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
   at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:78 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
   at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
   at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
 
 System.Exception: Stacktrace with 4 frames
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:76 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
   at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
   at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, Int32 i) in StackTraceDumper.cs:76 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
   at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
   at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
 
index 7f50e887c2032b2fde8f5f62f689241af91c5237..858bf2a9584a302e74674438feece12d801c80d5 100644 (file)
@@ -2,3 +2,9 @@ symbolicate.cs
 LocationProvider.cs
 SeqPointInfo.cs
 ../../class/corlib/System.Diagnostics/StackTraceHelper.cs
+../../../external/ikvm/reflect/*.cs
+../../../external/ikvm/reflect/Impl/*.cs
+../../../external/ikvm/reflect/Emit/*.cs
+../../../external/ikvm/reflect/Metadata/*.cs
+../../../external/ikvm/reflect/Reader/*.cs
+../../../external/ikvm/reflect/Writer/*.cs