public static TryParse ( string line, |
||
line | string | |
stackFrame | ||
Результат | bool |
public static StringBuilder Process(StreamReader reader, SymbolManager symbolManager) { List <StackFrameData> stackFrames = new List <StackFrameData>(); List <StackTraceMetadata> metadata = new List <StackTraceMetadata>(); StringBuilder sb = new StringBuilder(); bool linesEnded = false; for (var line = reader.ReadLine(); line != null; line = reader.ReadLine()) { StackFrameData sfData; if (!linesEnded && StackFrameData.TryParse(line, out sfData)) { stackFrames.Add(sfData); continue; } if (stackFrames.Count > 0) { linesEnded = true; StackTraceMetadata stMetadata; if (StackTraceMetadata.TryParse(line, out stMetadata)) { metadata.Add(stMetadata); continue; } DumpStackTrace(symbolManager, sb, stackFrames, metadata); // Clear lists for next stack trace stackFrames.Clear(); metadata.Clear(); } linesEnded = false; // Append last line sb.AppendLine(line); } if (stackFrames.Count > 0) { DumpStackTrace(symbolManager, sb, stackFrames, metadata); } return(sb); }
private static void SymbolicateAction(List <string> args) { var msymDir = args [0]; var inputFile = args [1]; var symbolManager = new SymbolManager(msymDir, logger); using (StreamReader r = new StreamReader(inputFile)) { for (var line = r.ReadLine(); line != null; line = r.ReadLine()) { if (StackFrameData.TryParse(line, out var sfData) && symbolManager.TryResolveLocation(sfData, out var location)) { var sign = sfData.Line.Substring(0, sfData.Line.IndexOf(" in <", StringComparison.Ordinal)); line = $"{sign} in {location.File}:{location.Line}"; } Console.WriteLine(line); } } }
private static void SymbolicateAction(List <string> args) { var msymDir = args [0]; var inputFile = args [1]; var symbolManager = new SymbolManager(msymDir, logger); using (StreamReader r = new StreamReader(inputFile)) { for (var line = r.ReadLine(); line != null; line = r.ReadLine()) { StackFrameData sfData; if (StackFrameData.TryParse(line, out sfData) && symbolManager.TryResolveLocation(sfData)) { Console.WriteLine(sfData.ToString()); continue; } Console.WriteLine(line); } } }