Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Henrich <marcos.henrich@xamarin.com>2016-05-20 14:14:27 +0300
committerMarcos Henrich <marcos.henrich@xamarin.com>2016-07-09 00:40:38 +0300
commit15ddd55f0425da698489dd4ee67d064000a2ff19 (patch)
treeb2f9c6309d1cf439d1e7357f93de9c58ec59e15b
parent59cccab00da71a4d7e98947060718eab42e46682 (diff)
[corlib] Added MVID metadata to StackTrace
The MVID metadata handler displays multiple MVID(s) followed by the comma separated list of StackFrame lines whose method belongs to the module with the displayed MVID.
-rw-r--r--mcs/class/corlib/System.Diagnostics/StackTrace.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
index 8b3f76a439e..9cd19d159dc 100644
--- a/mcs/class/corlib/System.Diagnostics/StackTrace.cs
+++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
@@ -332,6 +332,26 @@ namespace System.Diagnostics {
string aotid = Assembly.GetAotId ();
if (aotid != "00000000-0000-0000-0000-000000000000")
AddMetadataHandler ("AOTID", st => { return aotid; });
+
+ AddMetadataHandler ("MVID", st => {
+ var mvidLines = new Dictionary<Guid, List<int>> ();
+ var frames = st.GetFrames ();
+ for (var lineNumber = 0; lineNumber < frames.Length; lineNumber++) {
+ var mvid = frames[lineNumber].GetMethod ().Module.ModuleVersionId;
+ if (!mvidLines.ContainsKey (mvid))
+ mvidLines.Add (mvid, new List<int> ());
+
+ mvidLines[mvid].Add (lineNumber);
+ }
+
+ var sb = new StringBuilder ();
+ foreach (var kv in mvidLines) {
+ var mvid = kv.Key.ToString ().ToUpper ();
+ sb.AppendLine (string.Format ("{0} {1}", mvid, string.Join (",", kv.Value)));
+ }
+
+ return sb.ToString ();
+ });
}
private static void AddMetadataHandler (string id, Func<StackTrace, string> handler)