Permalink
Browse files

Create SOS SymbolReader managed project and change SOS to use it. (#6783

)

* Change SOS to use wrapper class that is now in System.Diagnostics.StackTrace.

The portable PDB helper code for SOS source/line support has been moved from
System.Diagnostics.Debug.SymbolReader to a new managed SOS project in the coreclr
repo called SOS.NETCore.

The public APIs have now been made internal.

Plumb through the loaded PE address to the managed SymbolReader functions so it can be used as a key.

Fixed a stack trashing/overflow when a unresolved managed breakpoint is resolved because one of the
module name buffers was too small (MAX_PATH_FNAME). Changed it (and others) to MAXLONGPATH.

SOS now works with Portable PDBs on Windows.

New dac private get module data request. Used to get the necessary info for portable PDBs.

SOS now supports in-memory PE's on xplat and Windows. Needed to get and plumb though the in-memory
PE layout where it is file based or loaded.

Better Windows GetLineByILOffset support. Uses the SymbolReader and now works with in-memory PEs.

Misc code formatting and general cleanup.

* Code review feedback.
  • Loading branch information...
1 parent 9834cd1 commit 75890669d59ea8e1a28ade8222ebec2706082674 @mikem8361 mikem8361 committed on GitHub Aug 19, 2016
Showing with 1,478 additions and 653 deletions.
  1. +2 −1 build.proj
  2. +1 −1 dir.props
  3. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/debian/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  4. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/fedora/23/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  5. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/opensuse/13.2/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  6. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/osx/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  7. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/rhel/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  8. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/ubuntu/14.04/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  9. +2 −1 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/ubuntu/16.04/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  10. +1 −0 src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/win/Microsoft.NETCore.Runtime.CoreCLR.pkgproj
  11. +60 −0 src/ToolBox/SOS/NETCore/SOS.NETCore.csproj
  12. +22 −0 src/ToolBox/SOS/NETCore/SOS.NETCore.sln
  13. +680 −0 src/ToolBox/SOS/NETCore/SymbolReader.cs
  14. +20 −0 src/ToolBox/SOS/NETCore/project.json
  15. +1 −0 src/ToolBox/SOS/Strike/CMakeLists.txt
  16. +3 −4 src/ToolBox/SOS/Strike/disasmARM.cpp
  17. +4 −4 src/ToolBox/SOS/Strike/disasmARM64.cpp
  18. +3 −4 src/ToolBox/SOS/Strike/disasmX86.cpp
  19. +54 −87 src/ToolBox/SOS/Strike/strike.cpp
  20. +465 −493 src/ToolBox/SOS/Strike/util.cpp
  21. +42 −37 src/ToolBox/SOS/Strike/util.h
  22. +11 −0 src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
  23. +2 −1 src/build.proj
  24. +8 −3 src/debug/daccess/dacimpl.h
  25. +54 −2 src/debug/daccess/task.cpp
  26. +2 −2 src/dlls/mscoree/unixinterface.cpp
  27. +20 −4 src/inc/dacprivate.h
  28. +1 −0 src/inc/palclr.h
  29. +3 −3 src/mscorlib/src/System/Diagnostics/Stacktrace.cs
  30. +5 −0 src/vm/gdbjit.cpp
View
@@ -19,6 +19,7 @@
<!-- Override clean from dir.traversal.targets and just remove the full BinDir -->
<Target Name="Clean">
+ <Delete Files="$(BinDir)SOS.NETCore.*" />
<Delete Files="$(BinDir)mscorlib.*" />
<Delete Files="$(BinDir)System.Private.CoreLib.*" />
</Target>
@@ -27,4 +28,4 @@
<Exec Command="$(DnuRestoreCommand) &quot;$(SourceDir).nuget/init/project.json&quot; --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</Target>
-</Project>
+</Project>
View
@@ -82,7 +82,7 @@
<!-- Output paths -->
<PropertyGroup>
- <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootBinDir)obj/</BaseIntermediateOutputPath>
+ <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootBinDir)obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(BuildType)</IntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)' == ''">$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(BuildType)</OutputPath>
<FinalOutputPath Condition="'$(FinalOutputPath)' == ''">$(BinDir)</FinalOutputPath>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -20,6 +20,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -51,4 +52,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -22,6 +22,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" />
<File Include="@(ArchitectureSpecificNativeFile)">
@@ -53,4 +54,4 @@
</File>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project>
@@ -19,6 +19,7 @@
<ArchitectureSpecificNativeFile Include="$(BinDir)System.Private.CoreLib.ni.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
+ <ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen.exe" />
<CrossArchitectureSpecificToolFile Include="$(BinDir)$(CrossTargetComponentFolder)\crossgen.exe" />
<CrossArchitectureSpecificToolFile Include="$(BinDir)$(CrossTargetComponentFolder)\mscordaccore.dll" />
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <PropertyGroup>
+ <AssemblyName>SOS.NETCore</AssemblyName>
+ <AssemblyVersion>1.0.0.0</AssemblyVersion>
+ <ProjectGuid>{20513BA2-A156-4A17-4C70-5AC2DBD4F833}</ProjectGuid>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <OutputType>Library</OutputType>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <NoStdLib>true</NoStdLib>
+ <NoCompilerStandardLib>true</NoCompilerStandardLib>
+ </PropertyGroup>
+
+ <!-- Default configurations to help VS understand the options -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
+
+ <!-- Configuration specific properties -->
+ <PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineConstants>_DEBUG;DEBUG;TRACE;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
+ <DebugSymbols>false</DebugSymbols>
+ <DebugType>none</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="SymbolReader.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+
+ <Target Name="CopyItemsToDirectory" AfterTargets="Build">
+ <Copy
+ SourceFiles="$(OutputPath)$(AssemblyName).dll"
+ DestinationFolder="$(BinDir)"
+ SkipUnchangedFiles="false"
+ OverwriteReadOnlyFiles="false"
+ UseHardlinksIfPossible="false">
+ </Copy>
+
+ <Copy
+ Condition="'$(OsEnvironment)' != 'Unix'"
+ SourceFiles="$(OutputPath)$(AssemblyName).pdb"
+ DestinationFolder="$(BinDir)\PDB"
+ SkipUnchangedFiles="false"
+ OverwriteReadOnlyFiles="false"
+ UseHardlinksIfPossible="false">
+ </Copy>
+ </Target>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOS.NETCore", "SOS.NETCore.csproj", "{20513BA2-A156-4A17-4C70-5AC2DBD4F833}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {20513BA2-A156-4A17-4C70-5AC2DBD4F833}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {20513BA2-A156-4A17-4C70-5AC2DBD4F833}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {20513BA2-A156-4A17-4C70-5AC2DBD4F833}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {20513BA2-A156-4A17-4C70-5AC2DBD4F833}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Oops, something went wrong.

0 comments on commit 7589066

Please sign in to comment.