Remove obsolete patches
Former-commit-id: 1d656c06e9fe6fb86081e626de96651b8e9ab98b
This commit is contained in:
parent
4c77460e8d
commit
aa7da660d6
@ -1,71 +0,0 @@
|
||||
From ae495e8bd485f48ecdb7e53d7e98771220f31997 Mon Sep 17 00:00:00 2001
|
||||
From: Zoltan Varga <vargaz@gmail.com>
|
||||
Date: Wed, 6 May 2015 04:56:52 -0400
|
||||
Subject: [PATCH] [runtime] Fix support for callvirt delegates with a vtype
|
||||
first argument. Fixes #29665.
|
||||
|
||||
---
|
||||
mcs/class/corlib/Test/System/DelegateTest.cs | 21 +++++++++++++++++++++
|
||||
mono/metadata/marshal.c | 17 ++++++++++++-----
|
||||
2 files changed, 33 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: xamarin-pkg-mono/mcs/class/corlib/Test/System/DelegateTest.cs
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/class/corlib/Test/System/DelegateTest.cs 2015-06-13 10:05:39.446662338 +0100
|
||||
+++ xamarin-pkg-mono/mcs/class/corlib/Test/System/DelegateTest.cs 2015-06-13 10:05:39.438662337 +0100
|
||||
@@ -1069,6 +1069,27 @@
|
||||
action_int (42);
|
||||
}
|
||||
|
||||
+ struct FooStruct {
|
||||
+ public int i, j, k, l;
|
||||
+
|
||||
+ public int GetProp (int a, int b, int c, int d) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ delegate int ByRefDelegate (ref FooStruct s, int a, int b, int c, int d);
|
||||
+
|
||||
+#if MONOTOUCH
|
||||
+ [Category ("NotWorking")]
|
||||
+#endif
|
||||
+ [Test]
|
||||
+ public void CallVirtVType ()
|
||||
+ {
|
||||
+ var action = (ByRefDelegate)Delegate.CreateDelegate (typeof (ByRefDelegate), null, typeof (FooStruct).GetMethod ("GetProp"));
|
||||
+ var s = new FooStruct () { i = 42 };
|
||||
+ Assert.AreEqual (42, action (ref s, 1, 2, 3, 4));
|
||||
+ }
|
||||
+
|
||||
class Foo {
|
||||
|
||||
public void Bar ()
|
||||
Index: xamarin-pkg-mono/mono/metadata/marshal.c
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mono/metadata/marshal.c 2015-06-13 10:05:39.446662338 +0100
|
||||
+++ xamarin-pkg-mono/mono/metadata/marshal.c 2015-06-13 10:05:39.442662338 +0100
|
||||
@@ -3248,11 +3248,18 @@
|
||||
|
||||
if (callvirt) {
|
||||
if (!closed_over_null) {
|
||||
- mono_mb_emit_ldarg (mb, 1);
|
||||
- mono_mb_emit_op (mb, CEE_CASTCLASS, target_class);
|
||||
- for (i = 1; i < sig->param_count; ++i)
|
||||
- mono_mb_emit_ldarg (mb, i + 1);
|
||||
- mono_mb_emit_op (mb, CEE_CALLVIRT, target_method);
|
||||
+ if (target_class->valuetype) {
|
||||
+ mono_mb_emit_ldarg (mb, 1);
|
||||
+ for (i = 1; i < sig->param_count; ++i)
|
||||
+ mono_mb_emit_ldarg (mb, i + 1);
|
||||
+ mono_mb_emit_op (mb, CEE_CALL, target_method);
|
||||
+ } else {
|
||||
+ mono_mb_emit_ldarg (mb, 1);
|
||||
+ mono_mb_emit_op (mb, CEE_CASTCLASS, target_class);
|
||||
+ for (i = 1; i < sig->param_count; ++i)
|
||||
+ mono_mb_emit_ldarg (mb, i + 1);
|
||||
+ mono_mb_emit_op (mb, CEE_CALLVIRT, target_method);
|
||||
+ }
|
||||
} else {
|
||||
mono_mb_emit_byte (mb, CEE_LDNULL);
|
||||
for (i = 0; i < sig->param_count; ++i)
|
657
debian/patches/rename-and-package-symbolicate.patch
vendored
657
debian/patches/rename-and-package-symbolicate.patch
vendored
@ -1,657 +0,0 @@
|
||||
From 06a984fc8019f9f4c7214342f3f8502c5354d83f Mon Sep 17 00:00:00 2001
|
||||
From: Marcos Henrich <marcos.henrich@xamarin.com>
|
||||
Date: Wed, 18 Feb 2015 19:22:39 +0000
|
||||
Subject: [PATCH] [mono-symbolicate] Added tool man page and script.
|
||||
|
||||
---
|
||||
man/Makefile.am | 3 ++-
|
||||
man/mono-symbolicate.1 | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
scripts/Makefile.am | 3 ++-
|
||||
scripts/mono-symbolicate.in | 2 ++
|
||||
4 files changed, 45 insertions(+), 2 deletions(-)
|
||||
create mode 100644 man/mono-symbolicate.1
|
||||
create mode 100644 scripts/mono-symbolicate.in
|
||||
|
||||
Index: xamarin-pkg-mono/man/Makefile.am
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/man/Makefile.am 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ xamarin-pkg-mono/man/Makefile.am 2015-04-07 13:24:26.317635351 +0100
|
||||
@@ -56,6 +56,7 @@
|
||||
xsd.1 \
|
||||
mono-configuration-crypto.1 \
|
||||
ccrewrite.1 \
|
||||
- cccheck.1
|
||||
+ cccheck.1 \
|
||||
+ mono-symbolicate.1
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
Index: xamarin-pkg-mono/man/mono-symbolicate.1
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/man/mono-symbolicate.1 2015-04-07 13:24:26.317635351 +0100
|
||||
@@ -0,0 +1,39 @@
|
||||
+.\"
|
||||
+.\" mono-symbolicate manual page.
|
||||
+.\" Copyright 2015 Xamarin
|
||||
+.\" Author:
|
||||
+.\" Marcos Henrich <marcos.henrich@xamarin.com>
|
||||
+.\"
|
||||
+.TH "mono-symbolicate" 1
|
||||
+.SH NAME
|
||||
+mono-symbolicate \- Mono Symbolicate Tool
|
||||
+.SH SYNOPSIS
|
||||
+.PP
|
||||
+.B mono-symbolicate exefile stacktracesfile [directories...]
|
||||
+.SH DESCRIPTION
|
||||
+mono-symbolicate is a tool that converts a stack trace with <filename unknown>:0
|
||||
+into one with file names and line numbers.
|
||||
+.PP
|
||||
+The output of calling this tool will be the provided
|
||||
+.I stacktracesfile
|
||||
+where <filename unknown>:0 parts are replaced by
|
||||
+a file name and a line number.
|
||||
+.PP
|
||||
+For the tool to work it needs to load referenced assemblies, it will first look
|
||||
+in the same folder as
|
||||
+.I exefile
|
||||
+then from one of the provided
|
||||
+.I directories.
|
||||
+.PP
|
||||
+The tool assumes that the folder with a referenced assembly called for example
|
||||
+name.dll will also include name.dll.mdb,
|
||||
+if the referenced assembly is AOT compiled then the tool is also expecting to find
|
||||
+name.dll.msym.
|
||||
+.SH AUTHOR
|
||||
+Written by Marcos Henrich
|
||||
+.SH COPYRIGHT
|
||||
+Copyright (C) 2015 Xamarin.
|
||||
+.SH MAILING LISTS
|
||||
+Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
|
||||
+.SH WEB SITE
|
||||
+Visit http://www.mono-project.com for details
|
||||
Index: xamarin-pkg-mono/scripts/Makefile.am
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/scripts/Makefile.am 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ xamarin-pkg-mono/scripts/Makefile.am 2015-04-07 13:24:26.317635351 +0100
|
||||
@@ -100,7 +100,8 @@
|
||||
ccrewrite$(SCRIPT_SUFFIX) \
|
||||
cccheck$(SCRIPT_SUFFIX) \
|
||||
mdbrebase$(SCRIPT_SUFFIX) \
|
||||
- ikdasm$(SCRIPT_SUFFIX)
|
||||
+ ikdasm$(SCRIPT_SUFFIX) \
|
||||
+ mono-symbolicate$(SCRIPT_SUFFIX)
|
||||
|
||||
MDOC_SUBCOMMANDS = \
|
||||
mdoc-assemble \
|
||||
Index: xamarin-pkg-mono/scripts/mono-symbolicate.in
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/scripts/mono-symbolicate.in 2015-04-07 13:24:26.317635351 +0100
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh
|
||||
+exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/4.5/mono-symbolicate.exe "$@"
|
||||
Index: xamarin-pkg-mono/mcs/tools/Makefile
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/tools/Makefile 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ xamarin-pkg-mono/mcs/tools/Makefile 2015-04-07 13:24:26.321635351 +0100
|
||||
@@ -45,7 +45,7 @@
|
||||
security \
|
||||
mdbrebase \
|
||||
ikdasm \
|
||||
- symbolicate
|
||||
+ mono-symbolicate
|
||||
|
||||
build_SUBDIRS = gacutil security culevel
|
||||
net_4_5_SUBDIRS := $(net_4_5_dirs)
|
||||
Index: xamarin-pkg-mono/mcs/tools/symbolicate/LocationProvider.cs
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/tools/symbolicate/LocationProvider.cs 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -1,144 +0,0 @@
|
||||
-using System;
|
||||
-using System.IO;
|
||||
-using System.Linq;
|
||||
-using System.Diagnostics;
|
||||
-using System.Collections.Generic;
|
||||
-using Mono.Cecil;
|
||||
-using Mono.CompilerServices.SymbolWriter;
|
||||
-
|
||||
-namespace Symbolicate
|
||||
-{
|
||||
- struct Location {
|
||||
- public string FileName;
|
||||
- public int Line;
|
||||
- }
|
||||
-
|
||||
- class LocationProvider {
|
||||
- class AssemblyLocationProvider {
|
||||
- AssemblyDefinition assembly;
|
||||
- MonoSymbolFile symbolFile;
|
||||
-
|
||||
- public AssemblyLocationProvider (AssemblyDefinition assembly, MonoSymbolFile symbolFile)
|
||||
- {
|
||||
- this.assembly = assembly;
|
||||
- this.symbolFile = symbolFile;
|
||||
- }
|
||||
-
|
||||
- public bool TryGetLocation (string methodFullName, string[] methodParamsTypes, int ilOffset, out Location location)
|
||||
- {
|
||||
- location = default (Location);
|
||||
- if (symbolFile == null)
|
||||
- return false;
|
||||
-
|
||||
- var typeNameEnd = methodFullName.LastIndexOf (".");
|
||||
- var typeName = methodFullName.Substring (0, typeNameEnd);
|
||||
- var methodName = methodFullName.Substring (typeNameEnd + 1, methodFullName.Length - typeNameEnd - 1);
|
||||
-
|
||||
- var type = assembly.MainModule.Types.FirstOrDefault (t => t.FullName == typeName);
|
||||
- if (type == null)
|
||||
- return false;
|
||||
-
|
||||
- var method = type.Methods.FirstOrDefault (m => {
|
||||
- if (m.Name != methodName)
|
||||
- return false;
|
||||
-
|
||||
- if (m.Parameters.Count != methodParamsTypes.Length)
|
||||
- return false;
|
||||
-
|
||||
- for (var i = 0; i < methodParamsTypes.Length; i++) {
|
||||
- var paramType = m.Parameters[i].ParameterType;
|
||||
- if (paramType.Name != methodParamsTypes[i])
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- });
|
||||
-
|
||||
- if (method == null)
|
||||
- return false;
|
||||
-
|
||||
- var methodSymbol = symbolFile.Methods [method.MetadataToken.RID-1];
|
||||
-
|
||||
- foreach (var lineNumber in methodSymbol.GetLineNumberTable ().LineNumbers) {
|
||||
- if (lineNumber.Offset < ilOffset)
|
||||
- continue;
|
||||
-
|
||||
- location.FileName = symbolFile.Sources [lineNumber.File-1].FileName;
|
||||
- location.Line = lineNumber.Row;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- Dictionary<string, AssemblyLocationProvider> assemblies;
|
||||
- HashSet<string> directories;
|
||||
-
|
||||
- public LocationProvider () {
|
||||
- assemblies = new Dictionary<string, AssemblyLocationProvider> ();
|
||||
- directories = new HashSet<string> ();
|
||||
- }
|
||||
-
|
||||
- public void AddAssembly (string assemblyPath)
|
||||
- {
|
||||
- assemblyPath = Path.GetFullPath (assemblyPath);
|
||||
- if (assemblies.ContainsKey (assemblyPath))
|
||||
- return;
|
||||
-
|
||||
- if (!File.Exists (assemblyPath))
|
||||
- throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
|
||||
-
|
||||
- var assembly = AssemblyDefinition.ReadAssembly (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");
|
||||
-
|
||||
- assemblies.Add (assemblyPath, new AssemblyLocationProvider (assembly, symbolFile));
|
||||
-
|
||||
- directories.Add (Path.GetDirectoryName (assemblyPath));
|
||||
-
|
||||
- foreach (var assemblyRef in assembly.MainModule.AssemblyReferences) {
|
||||
- string refPath = null;
|
||||
- foreach (var dir in directories) {
|
||||
- refPath = Path.Combine (dir, assemblyRef.Name);
|
||||
- if (File.Exists (refPath))
|
||||
- break;
|
||||
- refPath = Path.Combine (dir, assemblyRef.Name + ".dll");
|
||||
- if (File.Exists (refPath))
|
||||
- break;
|
||||
- refPath = Path.Combine (dir, assemblyRef.Name + ".exe");
|
||||
- if (File.Exists (refPath))
|
||||
- break;
|
||||
- refPath = null;
|
||||
- }
|
||||
- if (refPath != null)
|
||||
- AddAssembly (refPath);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- public void AddDirectory (string directory)
|
||||
- {
|
||||
- if (Directory.Exists (directory))
|
||||
- throw new ArgumentException ("Directory " + directory + " does not exist.");
|
||||
-
|
||||
- directories.Add (directory);
|
||||
- }
|
||||
-
|
||||
- public bool TryGetLocation (string methodName, string[] methodParams, int ilOffset, out Location location)
|
||||
- {
|
||||
- location = default (Location);
|
||||
- foreach (var assembly in assemblies.Values) {
|
||||
- if (assembly.TryGetLocation (methodName, methodParams, ilOffset, out location))
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
Index: xamarin-pkg-mono/mcs/tools/symbolicate/Makefile
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/tools/symbolicate/Makefile 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -1,39 +0,0 @@
|
||||
-thisdir = tools/symbolicate
|
||||
-SUBDIRS =
|
||||
-include ../../build/rules.make
|
||||
-
|
||||
-PROGRAM = symbolicate.exe
|
||||
-
|
||||
-LOCAL_MCS_FLAGS = \
|
||||
- /r:Mono.Cecil.dll \
|
||||
- /r:Mono.CompilerServices.SymbolWriter.dll \
|
||||
- /r:System.Xml
|
||||
-
|
||||
-include ../../build/executable.make
|
||||
-
|
||||
-LIB_PATH = $(topdir)/class/lib/$(PROFILE)
|
||||
-
|
||||
-MONO = MONO_PATH=$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH $(RUNTIME)
|
||||
-
|
||||
-OUT_DIR = Test/out
|
||||
-TEST_CS = Test/StackTraceDumper.cs
|
||||
-TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
|
||||
-RELEASE_FILE = $(OUT_DIR)/release.out
|
||||
-SYMBOLICATE_FILE = $(OUT_DIR)/symbolicate.out
|
||||
-SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
|
||||
-
|
||||
-build-test:
|
||||
- @mkdir -p $(OUT_DIR)
|
||||
- @$(MCS) -debug $(TEST_CS) -out:$(TEST_EXE)
|
||||
-
|
||||
-check: all build-test
|
||||
- @MONO_DEBUG=gen-compact-seq-points $(MONO) $(TEST_EXE) > $(RELEASE_FILE)
|
||||
- @$(MONO) $(LIB_PATH)/symbolicate.exe $(TEST_EXE) $(RELEASE_FILE) | sed "s/\[.*Test\//in /" > $(SYMBOLICATE_FILE)
|
||||
- @DIFF=$$(diff $(SYMBOLICATE_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
|
||||
- if [ ! -z "$$DIFF" ]; then \
|
||||
- echo "Symbolicate tests failed."; \
|
||||
- echo "If $(SYMBOLICATE_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
|
||||
- echo "Otherwise runtime sequence points need to be fixed."; \
|
||||
- echo "$$DIFF"; \
|
||||
- exit 1; \
|
||||
- fi
|
||||
Index: xamarin-pkg-mono/mcs/tools/symbolicate/symbolicate.cs
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/tools/symbolicate/symbolicate.cs 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -1,69 +0,0 @@
|
||||
-using System;
|
||||
-using System.IO;
|
||||
-using System.Globalization;
|
||||
-using System.Text.RegularExpressions;
|
||||
-
|
||||
-namespace Symbolicate
|
||||
-{
|
||||
- public class Program
|
||||
- {
|
||||
- static Regex regex = new Regex (@"\w*at (?<MethodName>.+) \((?<MethodParams>.*)\) \[0x(?<IL>.+)\] in <filename unknown>:0");
|
||||
-
|
||||
- public static int Main (String[] args)
|
||||
- {
|
||||
- if (args.Length < 2) {
|
||||
- Console.Error.WriteLine ("Usage: symbolicate <assembly path> <input file> [lookup directories]");
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- var assemblyPath = args [0];
|
||||
- var inputFile = args [1];
|
||||
-
|
||||
- var locProvider = new LocationProvider ();
|
||||
-
|
||||
- for (var i = 2; i < args.Length; i++)
|
||||
- locProvider.AddDirectory (args [i]);
|
||||
-
|
||||
- locProvider.AddAssembly (assemblyPath);
|
||||
-
|
||||
- using (StreamReader r = new StreamReader (inputFile)) {
|
||||
- for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
|
||||
- line = SymbolicateLine (line, locProvider);
|
||||
- Console.WriteLine (line);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- static string SymbolicateLine (string line, LocationProvider locProvider)
|
||||
- {
|
||||
- var match = regex.Match (line);
|
||||
- if (!match.Success)
|
||||
- return line;
|
||||
-
|
||||
- var methodName = match.Groups ["MethodName"].Value;
|
||||
- var methodParams = ParseParametersTypes (match.Groups ["MethodParams"].Value);
|
||||
- var ilOffset = int.Parse (match.Groups ["IL"].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
-
|
||||
- Location location;
|
||||
- if (!locProvider.TryGetLocation (methodName, methodParams, ilOffset, out location))
|
||||
- return line;
|
||||
-
|
||||
- return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
|
||||
- }
|
||||
-
|
||||
- static string[] ParseParametersTypes (string parameters)
|
||||
- {
|
||||
- if (string.IsNullOrEmpty (parameters))
|
||||
- return new string [0];
|
||||
-
|
||||
- var paramsArray = parameters.Split (',');
|
||||
- var paramsTypes = new string [paramsArray.Length];
|
||||
- for (var i = 0; i < paramsArray.Length; i++)
|
||||
- paramsTypes [i] = paramsArray [i].Trim ().Split (new char[]{' '}, 2)[0];
|
||||
-
|
||||
- return paramsTypes;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
\ No newline at end of file
|
||||
Index: xamarin-pkg-mono/mcs/tools/symbolicate/symbolicate.exe.sources
|
||||
===================================================================
|
||||
--- xamarin-pkg-mono.orig/mcs/tools/symbolicate/symbolicate.exe.sources 2015-04-07 13:24:26.349635351 +0100
|
||||
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -1,2 +0,0 @@
|
||||
-symbolicate.cs
|
||||
-LocationProvider.cs
|
||||
\ No newline at end of file
|
||||
Index: xamarin-pkg-mono/mcs/tools/mono-symbolicate/LocationProvider.cs
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/mcs/tools/mono-symbolicate/LocationProvider.cs 2015-04-07 13:24:26.321635351 +0100
|
||||
@@ -0,0 +1,144 @@
|
||||
+using System;
|
||||
+using System.IO;
|
||||
+using System.Linq;
|
||||
+using System.Diagnostics;
|
||||
+using System.Collections.Generic;
|
||||
+using Mono.Cecil;
|
||||
+using Mono.CompilerServices.SymbolWriter;
|
||||
+
|
||||
+namespace Symbolicate
|
||||
+{
|
||||
+ struct Location {
|
||||
+ public string FileName;
|
||||
+ public int Line;
|
||||
+ }
|
||||
+
|
||||
+ class LocationProvider {
|
||||
+ class AssemblyLocationProvider {
|
||||
+ AssemblyDefinition assembly;
|
||||
+ MonoSymbolFile symbolFile;
|
||||
+
|
||||
+ public AssemblyLocationProvider (AssemblyDefinition assembly, MonoSymbolFile symbolFile)
|
||||
+ {
|
||||
+ this.assembly = assembly;
|
||||
+ this.symbolFile = symbolFile;
|
||||
+ }
|
||||
+
|
||||
+ public bool TryGetLocation (string methodFullName, string[] methodParamsTypes, int ilOffset, out Location location)
|
||||
+ {
|
||||
+ location = default (Location);
|
||||
+ if (symbolFile == null)
|
||||
+ return false;
|
||||
+
|
||||
+ var typeNameEnd = methodFullName.LastIndexOf (".");
|
||||
+ var typeName = methodFullName.Substring (0, typeNameEnd);
|
||||
+ var methodName = methodFullName.Substring (typeNameEnd + 1, methodFullName.Length - typeNameEnd - 1);
|
||||
+
|
||||
+ var type = assembly.MainModule.Types.FirstOrDefault (t => t.FullName == typeName);
|
||||
+ if (type == null)
|
||||
+ return false;
|
||||
+
|
||||
+ var method = type.Methods.FirstOrDefault (m => {
|
||||
+ if (m.Name != methodName)
|
||||
+ return false;
|
||||
+
|
||||
+ if (m.Parameters.Count != methodParamsTypes.Length)
|
||||
+ return false;
|
||||
+
|
||||
+ for (var i = 0; i < methodParamsTypes.Length; i++) {
|
||||
+ var paramType = m.Parameters[i].ParameterType;
|
||||
+ if (paramType.Name != methodParamsTypes[i])
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ });
|
||||
+
|
||||
+ if (method == null)
|
||||
+ return false;
|
||||
+
|
||||
+ var methodSymbol = symbolFile.Methods [method.MetadataToken.RID-1];
|
||||
+
|
||||
+ foreach (var lineNumber in methodSymbol.GetLineNumberTable ().LineNumbers) {
|
||||
+ if (lineNumber.Offset < ilOffset)
|
||||
+ continue;
|
||||
+
|
||||
+ location.FileName = symbolFile.Sources [lineNumber.File-1].FileName;
|
||||
+ location.Line = lineNumber.Row;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Dictionary<string, AssemblyLocationProvider> assemblies;
|
||||
+ HashSet<string> directories;
|
||||
+
|
||||
+ public LocationProvider () {
|
||||
+ assemblies = new Dictionary<string, AssemblyLocationProvider> ();
|
||||
+ directories = new HashSet<string> ();
|
||||
+ }
|
||||
+
|
||||
+ public void AddAssembly (string assemblyPath)
|
||||
+ {
|
||||
+ assemblyPath = Path.GetFullPath (assemblyPath);
|
||||
+ if (assemblies.ContainsKey (assemblyPath))
|
||||
+ return;
|
||||
+
|
||||
+ if (!File.Exists (assemblyPath))
|
||||
+ throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
|
||||
+
|
||||
+ var assembly = AssemblyDefinition.ReadAssembly (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");
|
||||
+
|
||||
+ assemblies.Add (assemblyPath, new AssemblyLocationProvider (assembly, symbolFile));
|
||||
+
|
||||
+ directories.Add (Path.GetDirectoryName (assemblyPath));
|
||||
+
|
||||
+ foreach (var assemblyRef in assembly.MainModule.AssemblyReferences) {
|
||||
+ string refPath = null;
|
||||
+ foreach (var dir in directories) {
|
||||
+ refPath = Path.Combine (dir, assemblyRef.Name);
|
||||
+ if (File.Exists (refPath))
|
||||
+ break;
|
||||
+ refPath = Path.Combine (dir, assemblyRef.Name + ".dll");
|
||||
+ if (File.Exists (refPath))
|
||||
+ break;
|
||||
+ refPath = Path.Combine (dir, assemblyRef.Name + ".exe");
|
||||
+ if (File.Exists (refPath))
|
||||
+ break;
|
||||
+ refPath = null;
|
||||
+ }
|
||||
+ if (refPath != null)
|
||||
+ AddAssembly (refPath);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void AddDirectory (string directory)
|
||||
+ {
|
||||
+ if (Directory.Exists (directory))
|
||||
+ throw new ArgumentException ("Directory " + directory + " does not exist.");
|
||||
+
|
||||
+ directories.Add (directory);
|
||||
+ }
|
||||
+
|
||||
+ public bool TryGetLocation (string methodName, string[] methodParams, int ilOffset, out Location location)
|
||||
+ {
|
||||
+ location = default (Location);
|
||||
+ foreach (var assembly in assemblies.Values) {
|
||||
+ if (assembly.TryGetLocation (methodName, methodParams, ilOffset, out location))
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
Index: xamarin-pkg-mono/mcs/tools/mono-symbolicate/Makefile
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/mcs/tools/mono-symbolicate/Makefile 2015-04-07 13:24:42.057635359 +0100
|
||||
@@ -0,0 +1,39 @@
|
||||
+thisdir = tools/mono-symbolicate
|
||||
+SUBDIRS =
|
||||
+include ../../build/rules.make
|
||||
+
|
||||
+PROGRAM = mono-symbolicate.exe
|
||||
+
|
||||
+LOCAL_MCS_FLAGS = \
|
||||
+ /r:Mono.Cecil.dll \
|
||||
+ /r:Mono.CompilerServices.SymbolWriter.dll \
|
||||
+ /r:System.Xml
|
||||
+
|
||||
+include ../../build/executable.make
|
||||
+
|
||||
+LIB_PATH = $(topdir)/class/lib/$(PROFILE)
|
||||
+
|
||||
+MONO = MONO_PATH=$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH $(RUNTIME)
|
||||
+
|
||||
+OUT_DIR = Test/out
|
||||
+TEST_CS = Test/StackTraceDumper.cs
|
||||
+TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
|
||||
+RELEASE_FILE = $(OUT_DIR)/release.out
|
||||
+SYMBOLICATE_FILE = $(OUT_DIR)/symbolicate.out
|
||||
+SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
|
||||
+
|
||||
+build-test:
|
||||
+ @mkdir -p $(OUT_DIR)
|
||||
+ @$(MCS) -debug $(TEST_CS) -out:$(TEST_EXE)
|
||||
+
|
||||
+check: all build-test
|
||||
+ @MONO_DEBUG=gen-compact-seq-points $(MONO) $(TEST_EXE) > $(RELEASE_FILE)
|
||||
+ @$(MONO) $(LIB_PATH)/symbolicate.exe $(TEST_EXE) $(RELEASE_FILE) | sed "s/\[.*Test\//in /" > $(SYMBOLICATE_FILE)
|
||||
+ @DIFF=$$(diff $(SYMBOLICATE_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
|
||||
+ if [ ! -z "$$DIFF" ]; then \
|
||||
+ echo "Symbolicate tests failed."; \
|
||||
+ echo "If $(SYMBOLICATE_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
|
||||
+ echo "Otherwise runtime sequence points need to be fixed."; \
|
||||
+ echo "$$DIFF"; \
|
||||
+ exit 1; \
|
||||
+ fi
|
||||
Index: xamarin-pkg-mono/mcs/tools/mono-symbolicate/symbolicate.cs
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/mcs/tools/mono-symbolicate/symbolicate.cs 2015-04-07 13:24:26.321635351 +0100
|
||||
@@ -0,0 +1,69 @@
|
||||
+using System;
|
||||
+using System.IO;
|
||||
+using System.Globalization;
|
||||
+using System.Text.RegularExpressions;
|
||||
+
|
||||
+namespace Symbolicate
|
||||
+{
|
||||
+ public class Program
|
||||
+ {
|
||||
+ static Regex regex = new Regex (@"\w*at (?<MethodName>.+) \((?<MethodParams>.*)\) \[0x(?<IL>.+)\] in <filename unknown>:0");
|
||||
+
|
||||
+ public static int Main (String[] args)
|
||||
+ {
|
||||
+ if (args.Length < 2) {
|
||||
+ Console.Error.WriteLine ("Usage: symbolicate <assembly path> <input file> [lookup directories]");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ var assemblyPath = args [0];
|
||||
+ var inputFile = args [1];
|
||||
+
|
||||
+ var locProvider = new LocationProvider ();
|
||||
+
|
||||
+ for (var i = 2; i < args.Length; i++)
|
||||
+ locProvider.AddDirectory (args [i]);
|
||||
+
|
||||
+ locProvider.AddAssembly (assemblyPath);
|
||||
+
|
||||
+ using (StreamReader r = new StreamReader (inputFile)) {
|
||||
+ for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
|
||||
+ line = SymbolicateLine (line, locProvider);
|
||||
+ Console.WriteLine (line);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ static string SymbolicateLine (string line, LocationProvider locProvider)
|
||||
+ {
|
||||
+ var match = regex.Match (line);
|
||||
+ if (!match.Success)
|
||||
+ return line;
|
||||
+
|
||||
+ var methodName = match.Groups ["MethodName"].Value;
|
||||
+ var methodParams = ParseParametersTypes (match.Groups ["MethodParams"].Value);
|
||||
+ var ilOffset = int.Parse (match.Groups ["IL"].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
+
|
||||
+ Location location;
|
||||
+ if (!locProvider.TryGetLocation (methodName, methodParams, ilOffset, out location))
|
||||
+ return line;
|
||||
+
|
||||
+ return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
|
||||
+ }
|
||||
+
|
||||
+ static string[] ParseParametersTypes (string parameters)
|
||||
+ {
|
||||
+ if (string.IsNullOrEmpty (parameters))
|
||||
+ return new string [0];
|
||||
+
|
||||
+ var paramsArray = parameters.Split (',');
|
||||
+ var paramsTypes = new string [paramsArray.Length];
|
||||
+ for (var i = 0; i < paramsArray.Length; i++)
|
||||
+ paramsTypes [i] = paramsArray [i].Trim ().Split (new char[]{' '}, 2)[0];
|
||||
+
|
||||
+ return paramsTypes;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
Index: xamarin-pkg-mono/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ xamarin-pkg-mono/mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources 2015-04-07 13:24:26.321635351 +0100
|
||||
@@ -0,0 +1,2 @@
|
||||
+symbolicate.cs
|
||||
+LocationProvider.cs
|
||||
\ No newline at end of file
|
2
debian/patches/series
vendored
2
debian/patches/series
vendored
@ -1,2 +0,0 @@
|
||||
0001-runtime-Fix-support-for-callvirt-delegates-with-a-vt.patch
|
||||
rename-and-package-symbolicate.patch
|
Loading…
x
Reference in New Issue
Block a user