From: j-h.choi Date: Thu, 26 Aug 2021 03:46:10 +0000 (+0900) Subject: Add new 'symbolicate' commands to dotnet-stack of diagnostics X-Git-Tag: submit/tizen/20220124.030110^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=294ada1484952bee613c0ee8051c9db6b906b3e8;p=platform%2Fcore%2Fdotnet%2Flauncher.git Add new 'symbolicate' commands to dotnet-stack of diagnostics Change-Id: Ibc1ee9dae02eb7b1321e6970516285dd5ca5300d --- diff --git a/tools/Extractor/README.md b/tools/Extractor/README.md deleted file mode 100644 index b777807..0000000 --- a/tools/Extractor/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Line Number Extractor tool - -### Usage - -``` -dotnet-extractor [Commands] -``` - -``` -dotnet-extractor convert [Options] -``` - -#### Commands -* convert - Get the line number from the token value in the stacktrace - -#### Interactive shell -* Input string - Input the exception log string directly - -#### Options -* -h, --help - Show this help message - -* -i, --input [Input path] - Path to the exception log file (File extension: xxxxx.log) - -* -a, --assembly [Path1:Path2:...] - Multiple paths with assembly directories separated by colon(':') - -* -p, --pdb [Pdb path] - Path to the pdb directory (Can be omitted if it is the same as the assembly directory path) - -* -o, --output [Output path] - Path to the output file (Default: Output to console. If omitted, the xxxxx.out file is created in the same location as the log file) - -#### Example -* If you enter the exception log string directly -``` - # dotnet extractor convert - ### Dotnet Extractor Tool (v1.0) ### - Enter the exception log string: - I/DOTNET_LAUNCHER(12345): at TestApp.Program.TestMethod1() in TestApp.Tizen.dll: token 0x6000001+0x5 - I/DOTNET_LAUNCHER(12345): at TestApp.Program.OnCreate() in TestApp.Tizen.dll: token 0x6000002+0x1 -``` - -* If both assembly and pdb are in the current directory -``` - # dotnet extractor convert --input /tmp/Exception1.log -``` - -* If both assembly and pdb are in the same directory specified -``` - # dotnet extractor convert --input /tmp/Exception2.log --assembly /opt/usr/globalapps/org.tizen.example.TestApp.Tizen/:/usr/share/dotnet.tizen/ -``` - -* If assembly and pdb are separated in each directory -``` - # dotnet extractor convert --input /tmp/Exception3.log --assembly /usr/share/dotnet.tizen/framework/ --pdb /tmp/pdbs/ -``` - -#### Others -* Log format -``` - I/DOTNET_LAUNCHER(12345): System.NullReferenceException: Object reference not set to an instance of an object. - I/DOTNET_LAUNCHER(12345): at TestApp.Program.TestMethod1() in TestApp.Tizen.dll: token 0x6000001+0x5 - I/DOTNET_LAUNCHER(12345): at TestApp.Program.OnCreate() in TestApp.Tizen.dll: token 0x6000002+0x1 - ------- Format ------- - I/DOTNET_LAUNCHER(00000): at {typeName}.{methodName}({parameters}) in {moduleName}: token {methodToken}+{ilOffset} -``` - ----- - -#### Sample -``` -sh-3.2# cat /tmp/Exception.log -I/DOTNET_LAUNCHER(12345): System.NullReferenceException: Object reference not set to an instance of an object. -I/DOTNET_LAUNCHER(12345): at TestApp.Program.TestMethod1() in TestApp.Tizen.dll: token 0x6000001+0x5 -I/DOTNET_LAUNCHER(12345): at TestApp.Program.TestMethod2() in TestApp.Tizen.dll: token 0x6000002+0x1 -I/DOTNET_LAUNCHER(12345): at TestApp.Program.OnCreate() in TestApp.Tizen.dll: token 0x6000004+0x15 -sh-3.2# -sh-3.2# dotnet extractor convert --input /tmp/Exception.log --assembly /opt/usr/globalapps/org.tizen.example.TestApp.Tizen/ - -##### Line Number Extractor Tool (v1.0) ##### - -Extraction result: - at TestApp.Program.TestMethod1() in U:\TestApp\TestApp\TestApp.Tizen\TestApp.Tizen.cs:line 14 - at TestApp.Program.TestMethod2() in U:\TestApp\TestApp\TestApp.Tizen\TestApp.Tizen.cs:line 19 - at TestApp.Program.OnCreate() in U:\TestApp\TestApp\TestApp.Tizen\TestApp.Tizen.cs:line 58 - -Output: /tmp/Exception.out - -sh-3.2# -``` diff --git a/tools/Extractor/build.sh b/tools/Extractor/build.sh deleted file mode 100755 index 52f490a..0000000 --- a/tools/Extractor/build.sh +++ /dev/null @@ -1,78 +0,0 @@ -#! /bin/bash - -SCRIPT_DIR=$(dirname $(readlink -f $0)) - -CONFIGURATION=Release -SLN_NAME=dotnet-extractor/dotnet-extractor -TARGET_FRAMEWORK=netcoreapp3.1 -SLN_FILE=$SCRIPT_DIR/$SLN_NAME.sln -OUTDIR=$SCRIPT_DIR/$SLN_NAME/bin/$CONFIGURATION/$TARGET_FRAMEWORK -TARGET_ASSEMBLY_DIR=/home/owner/share/.dotnet/tools - -usage() { - echo "Usage: $0 [command]" - echo "Commands:" - echo " -b, --build Build a ExtractLine module" - echo " -i, --install Install assemblies to the target device" - echo " -c, --clean Clean all artifacts" -} - -remove_intermediates() { - find $1 -type d \( -name bin -o -name obj \) -print0 | xargs -0 -I {} rm -fr "{}" -} - -clean() { - remove_intermediates $SCRIPT_DIR/$SLN_NAME - rm -f msbuild.log -} - -build() { - clean - dotnet build -c $CONFIGURATION $SLN_FILE -} - -install() { - DEVICE_ID=$1 - - RUNTIME_ASSEMBLIES="$OUTDIR/*.dll" - - device_cnt=$(sdb devices | grep -v "List" | wc -l) - - if [ $device_cnt -eq 0 ]; then - echo "No connected devices" - exit 1 - fi - - if [ $device_cnt -gt 1 ] && [ -z "$DEVICE_ID" ]; then - echo "Multiple devices are connected. Specify the device. (ex: ./build.sh --install [device-id])" - sdb devices - exit 1 - fi - - SDB_OPTIONS="" - if [ -n "$DEVICE_ID" ]; then - SDB_OPTIONS="-s $DEVICE_ID" - fi - - sdb $SDB_OPTIONS root on - sdb $SDB_OPTIONS shell mount -o remount,rw / - sdb $SDB_OPTIONS push $RUNTIME_ASSEMBLIES $TARGET_ASSEMBLY_DIR - - nifile_cnt=$(sdb $SDB_OPTIONS shell find $TARGET_ASSEMBLY_DIR -name 'Microsoft.DiaSymReader*.ni.dll' | wc -l) - if [ $nifile_cnt -gt 0 ]; then - sdb $SDB_OPTIONS shell "rm -f $TARGET_ASSEMBLY_DIR/Microsoft.DiaSymReader*.ni.dll" - fi - - #sdb $SDB_OPTIONS shell dotnettool --ni-dll $TARGET_ASSEMBLY_DIR/Microsoft.DiaSymReader*.dll - sdb $SDB_OPTIONS shell chsmack -a '_' $TARGET_ASSEMBLY_DIR/*.dll - sdb $SDB_OPTIONS shell chown owner:users $TARGET_ASSEMBLY_DIR/*.dll - sdb $SDB_OPTIONS shell chmod 644 $TARGET_ASSEMBLY_DIR/*.dll -} - -cmd=$1; [ $# -gt 0 ] && shift; -case "$cmd" in - build|--build|-b) build ;; - install|--install|-i) install $@ ;; - clean|--clean|-c) clean ;; - *) usage ;; -esac diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor.sln b/tools/Extractor/dotnet-extractor/dotnet-extractor.sln deleted file mode 100644 index b54341f..0000000 --- a/tools/Extractor/dotnet-extractor/dotnet-extractor.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29613.14 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-extractor", "dotnet-extractor\dotnet-extractor.csproj", "{452A02D6-B803-4F73-BF0F-62A53D6FF367}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {452A02D6-B803-4F73-BF0F-62A53D6FF367}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {452A02D6-B803-4F73-BF0F-62A53D6FF367}.Debug|Any CPU.Build.0 = Debug|Any CPU - {452A02D6-B803-4F73-BF0F-62A53D6FF367}.Release|Any CPU.ActiveCfg = Release|Any CPU - {452A02D6-B803-4F73-BF0F-62A53D6FF367}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B0A7D6D5-EC91-4FB0-8A1B-DB9B39D1073B} - EndGlobalSection -EndGlobal diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor/CodeBlock.cs b/tools/Extractor/dotnet-extractor/dotnet-extractor/CodeBlock.cs deleted file mode 100644 index 26c91a7..0000000 --- a/tools/Extractor/dotnet-extractor/dotnet-extractor/CodeBlock.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Tizen.Runtime.Tools -{ - public class CodeBlock - { - public CodeBlock() - { - } - - public void CodeBlocks() - { - Console.WriteLine("Not implemented yet\n"); - } - } -} \ No newline at end of file diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor/Extractor.cs b/tools/Extractor/dotnet-extractor/dotnet-extractor/Extractor.cs deleted file mode 100644 index 757b1b8..0000000 --- a/tools/Extractor/dotnet-extractor/dotnet-extractor/Extractor.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.IO; - -namespace Tizen.Runtime.Tools -{ - class Extractor - { - private static readonly string version = "1.0"; - - public static void Main(string[] args) - { - Console.WriteLine($"\n### Dotnet Extractor Tool (v{version}) ###\n"); - - try - { - string command = null; - if (0 < args.Length) - { - switch (args[0]) - { - case "-h": - case "--help": - UsageCommand(); - Environment.Exit(0); - break; - case "convert": - command = "line"; - break; - case "code-block": - command = "code"; - break; - default: - UsageCommand(); - Console.WriteLine($"Unknown option [{args[0]}]\n"); - Environment.Exit(0); - break; - } - } - if (command == null) - { - UsageCommand(); - throw new InvalidDataException("Required command was not provided\n"); - } - else if (command == "line") - { - new LineNumber().LineNumbers(args); - } - else if (command == "code") - { - new CodeBlock().CodeBlocks(); - } - } - catch (Exception e) - { - Console.Error.WriteLine(e.Message); - } - } - - public static void UsageCommand() - { - string UsageMsg = "Usage: dotnet-extractor [Command]\n\n" - + "Commands:\n" - + " convert Get the line number from the token value in the stacktrace\n"; - //+ " code-block Get code block\n"; - Console.WriteLine(UsageMsg); - } - } -} diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor/LineNumber.cs b/tools/Extractor/dotnet-extractor/dotnet-extractor/LineNumber.cs deleted file mode 100644 index 085d960..0000000 --- a/tools/Extractor/dotnet-extractor/dotnet-extractor/LineNumber.cs +++ /dev/null @@ -1,495 +0,0 @@ -using Microsoft.DiaSymReader.Tools; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; - -namespace Tizen.Runtime.Tools -{ - public class LineNumber - { - private static readonly string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); - - internal sealed class Args - { - public readonly string[] AssemblyPaths; - public readonly string[] PdbPaths; - public readonly string ExceptionPath; - public readonly List ExceptionString; - public readonly string OutputPath; - - public Args(string[] assemblyPaths, string[] pdbPaths, string exceptionPath, List exceptionString, string outputPath) - { - AssemblyPaths = assemblyPaths; - PdbPaths = pdbPaths; - ExceptionPath = exceptionPath; - ExceptionString = exceptionString; - OutputPath = outputPath; - } - } - - public static void UsageLine() - { - string UsageMsg = "Usage: dotnet-extractor convert [Options]\n\n" - + "Interactive shell:\n" - + " Input the exception log string directly\n\n" - + "Options:\n" - + " -h, --help Show this help message\n" - + " -i, --input Path to the exception log file (File extension: xxxxx.log)\n" - + " -a, --assembly Multiple paths with assembly directories separated by colon(':')\n" - + " -p, --pdb Path to the pdb directory (Can be omitted if it is the same as the assembly directory path)\n" - + " -o, --output Path to the output file (Default: Output to console. If omitted, the xxxxx.out file is created in the same location as the log file)\n\n" - + "Example:\n" - + "1. If you enter the exception log string directly\n" - + " # dotnet extractor convert\n" - + " Enter the exception log string:\n" - + " I/DOTNET_LAUNCHER(12345): at TestApp.Program.TestMethod() in TestApp.Tizen.dll: token 0x6000001+0x5\n" - + " I/DOTNET_LAUNCHER(12345): at TestApp.Program.OnCreate() in TestApp.Tizen.dll: token 0x6000002+0x1\n\n" - + "2. If both assembly and pdb are in the current directory\n" - + " # dotnet extractor convert --input /tmp/Exception1.log\n\n" - + "3. If both assembly and pdb are in the same directory specified\n" - + " # dotnet extractor convert --input /tmp/Exception2.log --assembly /opt/usr/globalapps/org.tizen.example.TestApp.Tizen/:/usr/share/dotnet.tizen/\n\n" - + "4. If assembly and pdb are separated in each directory\n" - + " # dotnet extractor convert --input /tmp/Exception3.log --assembly /usr/share/dotnet.tizen/framework/ --pdb /tmp/pdbs/\n"; - Console.WriteLine(UsageMsg); - } - - public void LineNumbers(string[] args) - { - try - { - Args parsedArgs = ParseArgs(args); - Extract(parsedArgs, Convert(parsedArgs)); - } - catch (Exception e) - { - UsageLine(); - Console.Error.WriteLine(e.Message); - } - } - - internal static Args ParseArgs(string[] args) - { - string[] assemblyPaths = null; - string[] pdbPaths = null; - string exceptionPath = null; - List exceptionString = new List(); - string outputPath = null; - - int i = 1; - while (i < args.Length) - { - var arg = args[i++]; - string ReadValue() => (i < args.Length) ? args[i++] : throw new InvalidDataException(string.Format("Missing value for option '{0}'", arg)); - switch (arg) - { - case "-h": - case "--help": - UsageLine(); - Environment.Exit(0); - break; - case "-i": - case "--input": - exceptionPath = ReadValue(); - break; - case "-a": - case "--assembly": - assemblyPaths = ReadValue().Split(":"); - break; - case "-p": - case "--pdb": - pdbPaths = ReadValue().Split(":"); - break; - case "-o": - case "--output": - outputPath = ReadValue(); - break; - default: - UsageLine(); - Console.WriteLine($"Unknown option [{arg}]\n"); - Environment.Exit(0); - break; - } - } - if (exceptionPath == null) - { - Console.WriteLine("Enter the exception log string:"); - string line; - while ((line = Console.ReadLine()) != null && line != "") - { - if (!line.Contains(":")) - { - exceptionPath = line; - exceptionString.Clear(); - break; - } - exceptionString.Add(line); - } - } - if (exceptionString.Count == 0) - { - if (exceptionPath == null) - { - throw new InvalidDataException("Missing exception log path or log string\n"); - } - else if (!File.Exists(exceptionPath)) - { - throw new FileNotFoundException("Exception log file not found\n"); - } - } - - assemblyPaths ??= new string[] { Directory.GetCurrentDirectory() }; - pdbPaths ??= assemblyPaths; - try - { - outputPath ??= Path.ChangeExtension(exceptionPath, "out"); - } - catch (Exception e) - { - throw new InvalidDataException(e.Message); - } - - return new Args( - assemblyPaths: assemblyPaths, - pdbPaths: pdbPaths, - exceptionPath: exceptionPath, - exceptionString: exceptionString, - outputPath: outputPath); - } - - private static List GrabFiles(string[] paths, string searchPattern) - { - List files = new List(); - foreach (var assemDir in paths) - { - if (Directory.Exists(assemDir)) - { - foreach (var peFile in Directory.GetFiles(assemDir, searchPattern, SearchOption.AllDirectories)) - { - files.Add(peFile); - } - } - } - return files; - } - - /* - * Convert - */ - private static List Convert(Args args) - { - List peFiles = GrabFiles(args.AssemblyPaths, "*.dll"); - if (peFiles.Count == 0) - { - throw new FileNotFoundException("Assembly file not found\n"); - } - - List pdbFiles = GrabFiles(args.PdbPaths, "*.pdb"); - if (pdbFiles.Count == 0) - { - throw new FileNotFoundException("PDB file not found\n"); - } - - Console.Write("Converting pdb to xml..."); - Console.SetCursorPosition(0, Console.CursorTop); - - Directory.CreateDirectory(tempDirectory); - - List xmlList = new List(); - foreach (var pdbFile in pdbFiles) - { - foreach (var peFile in peFiles) - { - if (Path.GetFileNameWithoutExtension(peFile) == Path.GetFileNameWithoutExtension(pdbFile)) - { - string xmlPath = Path.Combine(tempDirectory, Path.GetFileName(Path.ChangeExtension(peFile, "xml"))); - GenXmlFromPdb(peFile, pdbFile, xmlPath); - xmlList.Add(xmlPath); - break; - } - } - } - return xmlList; - } - - private static void GenXmlFromPdb(string assemblyPath, string pdbPath, string xmlPath) - { - using var peStream = new FileStream(assemblyPath, FileMode.Open, FileAccess.Read); - using var pdbStream = new FileStream(pdbPath, FileMode.Open, FileAccess.Read); - using var dstFileStream = new FileStream(xmlPath, FileMode.Create, FileAccess.ReadWrite); - using var sw = new StreamWriter(dstFileStream, Encoding.UTF8); - PdbToXmlOptions options = PdbToXmlOptions.ResolveTokens | PdbToXmlOptions.IncludeModuleDebugInfo | PdbToXmlOptions.IncludeTokens; - - PdbToXmlConverter.ToXml(sw, pdbStream, peStream, options); - } - - private static void RemoveTempDirectory() - { - if (Directory.Exists(tempDirectory)) - { - Directory.Delete(tempDirectory, true); - } - } - - /* - * Extract - */ - private static void Extract(Args args, List xmlList) - { - if (xmlList.Count == 0) - { - RemoveTempDirectory(); - throw new FileNotFoundException("Xml file not found\n"); - } - - GetLineFromLog(args, xmlList); - - RemoveTempDirectory(); - } - - internal sealed class StackTraceInfo - { - public string Type; - public string Method; - public string Param; - public string Assembly; - public string Token; - public string Offset; - public string Document; - public string Filepath; - public string Filename; - public string StartLine; - public string EndLine; - } - - private static string GetRegex(string line, List xmlList) - { - string ret = line; - string logtagStr = Regex.Match(line, "(?.*?) at").Groups["splitdata"].Value; - if (logtagStr.Length != 0) - { - ret = line.Replace(logtagStr, ""); - } - string typeMethodStr = Regex.Match(line, "at (?.*?)\\((.*)\\)").Groups["splitdata"].Value; - string methodStr = typeMethodStr.Split(".")[^1]; - string typenameStr = typeMethodStr.Replace("." + methodStr, ""); - string parameterStr = Regex.Match(line, methodStr + "\\((?.*?)\\)").Groups["splitdata"].Value; - string assemblyStr = Regex.Match(line, " in (?.*?)\\: ").Groups["splitdata"].Value; - string[] tokenOffsetStr = Regex.Match(line, "\\: token (?.*)?").Groups["splitdata"].Value.Split("+"); - string xmlStr = assemblyStr.Contains(".ni.dll") ? assemblyStr.Replace(".ni.dll", ".xml") : assemblyStr.Replace(".dll", ".xml"); - - if (tokenOffsetStr.Length != 2 || methodStr == "" || typenameStr == "" || assemblyStr == "") - { - return ret; - } - - StackTraceInfo stInfo = new StackTraceInfo() { Type = typenameStr, Method = methodStr, Assembly = assemblyStr, Token = tokenOffsetStr[0], Offset = tokenOffsetStr[1] }; - - foreach (var xmlPath in xmlList) - { - if (xmlPath.Contains(xmlStr)) - { - GetLineFromXml(xmlPath, stInfo); - if (stInfo.Filepath != null && stInfo.StartLine != null) - { - ret = $" at {stInfo.Type}.{stInfo.Method}({parameterStr}) in {stInfo.Filepath}:line {stInfo.StartLine}"; - break; - } - } - } - return ret; - } - - private static void GetLineFromLog(Args args, List xmlList) - { - Console.WriteLine("Extraction result: "); - - try - { - List result = new List(); - if (args.ExceptionPath == null) - { - // - foreach (var line in args.ExceptionString) - { - if (!line.Contains("at ")) - { - continue; - } - string ret = GetRegex(line, xmlList); - result.Add(ret); - Console.WriteLine(ret); - } - } - else - { - // - using StreamReader fsr = new StreamReader(new FileStream(args.ExceptionPath, FileMode.Open, FileAccess.Read)); - while (!fsr.EndOfStream) - { - string line = fsr.ReadLine(); - if (!line.Contains(" at ")) - { - continue; - } - string ret = GetRegex(line, xmlList); - result.Add(ret); - Console.WriteLine(ret); - } - } - - string output = string.Empty; - if (args.OutputPath != null) - { - using StreamWriter fsw = new StreamWriter(new FileStream(args.OutputPath, FileMode.Create, FileAccess.Write)); - foreach (var ret in result) - { - fsw.WriteLine(ret); - } - output = $"\nOutput: {args.OutputPath}\n"; - } - Console.WriteLine($"{output}"); - } - catch (Exception e) - { - Console.WriteLine(e); - } - } - - private static void GetLineFromXml(string xmlPath, StackTraceInfo stInfo) - { - try - { - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(xmlPath); - XmlElement xRoot = xmlDoc.DocumentElement; - XmlNodeList xnList = xRoot.ChildNodes; - int xnCount = xnList.Count; - if (xnCount > 0) - { - for (int i = xnCount - 1; i >= 0; i--) - { - XmlNode node = xnList[i]; - if (node.Name == "files") - { - ParseFile(node.ChildNodes, stInfo); - } - else if (node.Name == "methods") - { - ParseMethod(node.ChildNodes, stInfo); - } - } - } - } - catch (ArgumentException e) - { - Console.WriteLine(e); - } - } - - private static void ParseFile(XmlNodeList xn, StackTraceInfo stInfo) - { - try - { - foreach (XmlNode node in xn) - { - if (stInfo.Document == node.Attributes["id"].Value) - { - stInfo.Filepath = node.Attributes["name"].Value; - stInfo.Filename = Path.GetFileName(node.Attributes["name"].Value); - } - } - } - catch (ArgumentException e) - { - Console.WriteLine(e); - } - } - - private static void ParseMethod(XmlNodeList xn, StackTraceInfo stInfo) - { - try - { - foreach (XmlNode node in xn) - { - if (stInfo.Type == node.Attributes["containingType"].Value && - stInfo.Method == node.Attributes["name"].Value && - stInfo.Token == node.Attributes["token"].Value) - { - if (node.Attributes.Item(2).Name == "parameterNames") - { - stInfo.Param = node.Attributes["parameterNames"].Value; - } - ParseSequence(node.ChildNodes, stInfo); - } - } - } - catch (ArgumentException e) - { - Console.WriteLine(e); - } - } - - private static void ParseSequence(XmlNodeList xn, StackTraceInfo stInfo) - { - try - { - foreach (XmlNode node in xn) - { - if (node.Name == "sequencePoints") - { - ParseEntry(node.ChildNodes, stInfo); - } - } - } - catch (ArgumentException e) - { - Console.WriteLine(e); - } - } - - private static int HexToInt(string value) - { - // strip the leading 0x - if (value.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) - { - value = value.Substring(2); - } - return Int32.Parse(value, NumberStyles.HexNumber); - } - - private static void ParseEntry(XmlNodeList xn, StackTraceInfo stInfo) - { - try - { - XmlNode bestPointSoFar = null; - int ilOffset = HexToInt(stInfo.Offset); - foreach (XmlNode node in xn) - { - // If the attribute is not 'startLine', but 'hidden', select the best value so far - if (HexToInt(node.Attributes["offset"].Value) > ilOffset) - { - break; - } - if (node.Attributes["startLine"] != null) - { - bestPointSoFar = node; - } - } - if (bestPointSoFar != null) - { - stInfo.StartLine = bestPointSoFar.Attributes["startLine"].Value; - stInfo.EndLine = bestPointSoFar.Attributes["endLine"].Value; - stInfo.Document = bestPointSoFar.Attributes["document"].Value; - } - } - catch (ArgumentException e) - { - Console.WriteLine(e); - } - } - } -} diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor/Microsoft.DiaSymReader.Converter.Xml.dll b/tools/Extractor/dotnet-extractor/dotnet-extractor/Microsoft.DiaSymReader.Converter.Xml.dll deleted file mode 100644 index 0d204d2..0000000 Binary files a/tools/Extractor/dotnet-extractor/dotnet-extractor/Microsoft.DiaSymReader.Converter.Xml.dll and /dev/null differ diff --git a/tools/Extractor/dotnet-extractor/dotnet-extractor/dotnet-extractor.csproj b/tools/Extractor/dotnet-extractor/dotnet-extractor/dotnet-extractor.csproj deleted file mode 100644 index 6b388ca..0000000 --- a/tools/Extractor/dotnet-extractor/dotnet-extractor/dotnet-extractor.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Exe - netcoreapp3.1 - dotnet_extractor - - - - - - - - - - Microsoft.DiaSymReader.Converter.Xml.dll - - - -