[mono-symbolicate] Handle wrapper stackframes
authorMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 18 Jul 2016 13:57:08 +0000 (14:57 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 18 Jul 2016 16:04:19 +0000 (17:04 +0100)
mcs/tools/mono-symbolicate/StackFrameData.cs
mcs/tools/mono-symbolicate/symbolicate.cs

index cc9b44c91e4c84433198d5d8f10e89c0bf52e83c..ed5134709cd774a025ee43a933407712df6d3d55 100644 (file)
@@ -1,3 +1,4 @@
+using System;
 using System.Text.RegularExpressions;
 using System.Globalization;
 
@@ -14,6 +15,8 @@ namespace Mono
                public readonly uint MethodIndex;
                public readonly string Line;
 
+               public readonly bool IsValid;
+
                public string File { get; private set; }
                public int LineNumber { get; private set; }
 
@@ -27,6 +30,15 @@ namespace Mono
                        Offset = offset;
                        IsILOffset = isILOffset;
                        MethodIndex = methodIndex;
+
+                       IsValid = true;
+               }
+
+               private StackFrameData (string line)
+               {
+                       LineNumber = -1;
+
+                       Line = line;
                }
 
                public static bool TryParse (string line, out StackFrameData stackFrame)
@@ -34,8 +46,13 @@ namespace Mono
                        stackFrame = null;
 
                        var match = regex.Match (line);
-                       if (!match.Success)
+                       if (!match.Success) {
+                               if (line.Trim ().StartsWith ("at ", StringComparison.InvariantCulture)) {
+                                       stackFrame = new StackFrameData (line);
+                                       return true;
+                               }
                                return false;
+                       }
 
                        string typeFullName, methodSignature;
                        var methodStr = match.Groups ["Method"].Value.Trim ();
index 0619a6f1cad0bec570a73e16882202ad168a862d..dea62ebe58deb946797cf39bf65d2dac98016625 100644 (file)
@@ -145,11 +145,14 @@ namespace Mono
                                aotid = aotidMetadata.Value;
 
                        var linesMvid = ProcessLinesMVID (metadata);
-                       var lineNumber = 0;
+                       var lineNumber = -1;
                        foreach (var sfData in stackFrames) {
                                string mvid = null;
+                               lineNumber++;
+                               if (!sfData.IsValid)
+                                       continue;
                                if (linesMvid.ContainsKey (lineNumber))
-                                       mvid = linesMvid [lineNumber++];
+                                       mvid = linesMvid [lineNumber];
 
                                symbolManager.TryResolveLocation (sfData, mvid, aotid);