diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-04-13 14:17:19 +0900 |
commit | a56e30c8d33048216567753d9d3fefc2152af8ac (patch) | |
tree | 7e5d979695fc4a431740982eb1cfecc2898b23a5 /src/ToolBox/SOS/NETCore | |
parent | 4b11dc566a5bbfa1378d6266525c281b028abcc8 (diff) | |
download | coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.gz coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.bz2 coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.zip |
Imported Upstream version 2.0.0.11353upstream/2.0.0.11353
Diffstat (limited to 'src/ToolBox/SOS/NETCore')
-rw-r--r-- | src/ToolBox/SOS/NETCore/SOS.NETCore.csproj | 10 | ||||
-rw-r--r-- | src/ToolBox/SOS/NETCore/SymbolReader.cs | 37 | ||||
-rw-r--r-- | src/ToolBox/SOS/NETCore/project.json | 6 |
3 files changed, 40 insertions, 13 deletions
diff --git a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj index bd9d2395f8..440cff5d82 100644 --- a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj +++ b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj @@ -12,6 +12,12 @@ <NoStdLib>true</NoStdLib> <NoCompilerStandardLib>true</NoCompilerStandardLib> <UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey> + + <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip + the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). --> + <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)/Documentation</_TargetFrameworkDirectories> + <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)/Documentation</_FullFrameworkReferenceAssemblyPaths> + </PropertyGroup> <!-- Default configurations to help VS understand the options --> @@ -26,8 +32,7 @@ </PropertyGroup> <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'"> - <DebugSymbols>false</DebugSymbols> - <DebugType>none</DebugType> + <DebugType>portable</DebugType> </PropertyGroup> <ItemGroup> @@ -48,7 +53,6 @@ </Copy> <Copy - Condition="'$(OsEnvironment)' != 'Unix'" SourceFiles="$(OutputPath)$(AssemblyName).pdb" DestinationFolder="$(BinDir)\PDB" SkipUnchangedFiles="false" diff --git a/src/ToolBox/SOS/NETCore/SymbolReader.cs b/src/ToolBox/SOS/NETCore/SymbolReader.cs index 492f7cbd1f..e0fcdb517d 100644 --- a/src/ToolBox/SOS/NETCore/SymbolReader.cs +++ b/src/ToolBox/SOS/NETCore/SymbolReader.cs @@ -23,6 +23,14 @@ namespace SOS public string fileName; } + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct LocalVarInfo + { + public int startOffset; + public int endOffset; + public string name; + } + [StructLayout(LayoutKind.Sequential)] internal struct MethodDebugInfo { @@ -296,6 +304,9 @@ namespace SOS return false; MethodDebugInformationHandle methodDebugHandle = ((MethodDefinitionHandle)handle).ToDebugInformationHandle(); + if (methodDebugHandle.IsNil) + return false; + MethodDebugInformation methodDebugInfo = reader.GetMethodDebugInformation(methodDebugHandle); SequencePointCollection sequencePoints = methodDebugInfo.GetSequencePoints(); @@ -394,7 +405,7 @@ namespace SOS } return false; } - internal static bool GetLocalsInfoForMethod(string assemblyPath, int methodToken, out List<string> locals) + internal static bool GetLocalsInfoForMethod(string assemblyPath, int methodToken, out List<LocalVarInfo> locals) { locals = null; @@ -410,7 +421,7 @@ namespace SOS if (handle.Kind != HandleKind.MethodDefinition) return false; - locals = new List<string>(); + locals = new List<LocalVarInfo>(); MethodDebugInformationHandle methodDebugHandle = ((MethodDefinitionHandle)handle).ToDebugInformationHandle(); @@ -424,7 +435,11 @@ namespace SOS LocalVariable localVar = openedReader.Reader.GetLocalVariable(varHandle); if (localVar.Attributes == LocalVariableAttributes.DebuggerHidden) continue; - locals.Add(openedReader.Reader.GetString(localVar.Name)); + LocalVarInfo info = new LocalVarInfo(); + info.startOffset = scope.StartOffset; + info.endOffset = scope.EndOffset; + info.name = openedReader.Reader.GetString(localVar.Name); + locals.Add(info); } } } @@ -449,7 +464,7 @@ namespace SOS try { List<DebugInfo> points = null; - List<string> locals = null; + List<LocalVarInfo> locals = null; if (!GetDebugInfoForMethod(assemblyPath, methodToken, out points)) { @@ -470,14 +485,18 @@ namespace SOS Marshal.StructureToPtr(info, ptr, false); ptr = (IntPtr)(ptr.ToInt64() + structSize); } + + structSize = Marshal.SizeOf<LocalVarInfo>(); + debugInfo.localsSize = locals.Count; - debugInfo.locals = Marshal.AllocHGlobal(debugInfo.localsSize * Marshal.SizeOf<IntPtr>()); - IntPtr ptrLocals = debugInfo.locals; - foreach (string s in locals) + ptr = debugInfo.locals; + + foreach (var info in locals) { - Marshal.WriteIntPtr(ptrLocals, Marshal.StringToHGlobalUni(s)); - ptrLocals += Marshal.SizeOf<IntPtr>(); + Marshal.StructureToPtr(info, ptr, false); + ptr = (IntPtr)(ptr.ToInt64() + structSize); } + return true; } catch diff --git a/src/ToolBox/SOS/NETCore/project.json b/src/ToolBox/SOS/NETCore/project.json index 7a3cf4fe1d..6b2061a577 100644 --- a/src/ToolBox/SOS/NETCore/project.json +++ b/src/ToolBox/SOS/NETCore/project.json @@ -6,7 +6,11 @@ "System.Reflection.Metadata": "1.4.1" }, "frameworks": { - "netcoreapp1.0": {} + "netcoreapp1.0": { + "imports": [ + "portable-net45+win8" + ] + } }, "runtimes": { "win7-x86": {}, |