summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolBox/SOS')
-rw-r--r--src/ToolBox/SOS/NETCore/SOS.NETCore.csproj10
-rw-r--r--src/ToolBox/SOS/NETCore/SymbolReader.cs37
-rw-r--r--src/ToolBox/SOS/NETCore/project.json6
-rw-r--r--src/ToolBox/SOS/Strike/disasm.h3
-rw-r--r--src/ToolBox/SOS/Strike/gcroot.cpp4
-rw-r--r--src/ToolBox/SOS/Strike/sos.cpp2
-rw-r--r--src/ToolBox/SOS/Strike/sos_md.h2
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp12
-rw-r--r--src/ToolBox/SOS/Strike/util.cpp4
-rw-r--r--src/ToolBox/SOS/lldbplugin/CMakeLists.txt13
10 files changed, 55 insertions, 38 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": {},
diff --git a/src/ToolBox/SOS/Strike/disasm.h b/src/ToolBox/SOS/Strike/disasm.h
index 59fc168a6e..2a2d9f7779 100644
--- a/src/ToolBox/SOS/Strike/disasm.h
+++ b/src/ToolBox/SOS/Strike/disasm.h
@@ -54,9 +54,6 @@ LPCWSTR EHTypedClauseTypeName(const DACEHInfo* pEHInfo);
struct SOSEHInfo
{
-#ifndef FEATURE_CORECLR
- __field_ecount(EHCount)
-#endif
DACEHInfo *m_pInfos;
UINT EHCount;
CLRDATA_ADDRESS methodStart;
diff --git a/src/ToolBox/SOS/Strike/gcroot.cpp b/src/ToolBox/SOS/Strike/gcroot.cpp
index f68b935e21..86080989ec 100644
--- a/src/ToolBox/SOS/Strike/gcroot.cpp
+++ b/src/ToolBox/SOS/Strike/gcroot.cpp
@@ -40,18 +40,14 @@
#include "safemath.h"
-#ifdef _ASSERTE
#undef _ASSERTE
-#endif
-#ifndef _ASSERTE
#ifdef _DEBUG
#define _ASSERTE(expr) \
do { if (!(expr) ) { ExtErr("_ASSERTE fired:\n\t%s\n", #expr); if (IsDebuggerPresent()) DebugBreak(); } } while (0)
#else
#define _ASSERTE(x)
#endif
-#endif // ASSERTE
inline size_t ALIGN_DOWN( size_t val, size_t alignment )
{
diff --git a/src/ToolBox/SOS/Strike/sos.cpp b/src/ToolBox/SOS/Strike/sos.cpp
index 351199c058..64ee4b9a0c 100644
--- a/src/ToolBox/SOS/Strike/sos.cpp
+++ b/src/ToolBox/SOS/Strike/sos.cpp
@@ -17,9 +17,7 @@
#include "gcdesc.h"
-#ifdef _ASSERTE
#undef _ASSERTE
-#endif
namespace sos
{
diff --git a/src/ToolBox/SOS/Strike/sos_md.h b/src/ToolBox/SOS/Strike/sos_md.h
index f1a34cd706..b589109986 100644
--- a/src/ToolBox/SOS/Strike/sos_md.h
+++ b/src/ToolBox/SOS/Strike/sos_md.h
@@ -33,7 +33,7 @@ class CQuickBytes;
* Always keep the definitions below in sync with the originals.
* NOTES:
* Since SOS runs in a native debugger session, since it does not use EnC,
- * and in roder to minimize the amount of duplication we changed the
+ * and in order to minimize the amount of duplication we changed the
* method definitions that deal with UTSemReadWrite* arguments to take
* void* arguments instead.
* Also, some of the interface methods take CQuickBytes as arguments.
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index 3bb3f50200..2b54b4f037 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -2090,11 +2090,9 @@ struct StackTraceElement
UINT_PTR ip;
UINT_PTR sp;
DWORD_PTR pFunc; // MethodDesc
-#if defined(FEATURE_EXCEPTIONDISPATCHINFO)
// TRUE if this element represents the last frame of the foreign
// exception stack trace.
BOOL fIsLastFrameFromForeignStackTrace;
-#endif // defined(FEATURE_EXCEPTIONDISPATCHINFO)
};
@@ -8840,28 +8838,28 @@ void PrintInterestingGCInfo(DacpGCInterestingInfoData* dataPerHeap)
{
ExtOut("Interesting data points\n");
size_t* data = dataPerHeap->interestingDataPoints;
- for (int i = 0; i < NUM_GC_DATA_POINTS; i++)
+ for (int i = 0; i < DAC_NUM_GC_DATA_POINTS; i++)
{
ExtOut("%20s: %d\n", str_interesting_data_points[i], data[i]);
}
ExtOut("\nCompacting reasons\n");
data = dataPerHeap->compactReasons;
- for (int i = 0; i < MAX_COMPACT_REASONS_COUNT; i++)
+ for (int i = 0; i < DAC_MAX_COMPACT_REASONS_COUNT; i++)
{
ExtOut("[%s]%35s: %d\n", (gc_heap_compact_reason_mandatory_p[i] ? "M" : "W"), str_heap_compact_reasons[i], data[i]);
}
ExtOut("\nExpansion mechanisms\n");
data = dataPerHeap->expandMechanisms;
- for (int i = 0; i < MAX_EXPAND_MECHANISMS_COUNT; i++)
+ for (int i = 0; i < DAC_MAX_EXPAND_MECHANISMS_COUNT; i++)
{
ExtOut("%30s: %d\n", str_heap_expand_mechanisms[i], data[i]);
}
ExtOut("\nOther mechanisms enabled\n");
data = dataPerHeap->bitMechanisms;
- for (int i = 0; i < MAX_GC_MECHANISM_BITS_COUNT; i++)
+ for (int i = 0; i < DAC_MAX_GC_MECHANISM_BITS_COUNT; i++)
{
ExtOut("%20s: %d\n", str_bit_mechanisms[i], data[i]);
}
@@ -8883,7 +8881,7 @@ DECLARE_API(DumpGCData)
DacpGCInterestingInfoData interestingInfo;
interestingInfo.RequestGlobal(g_sos);
- for (int i = 0; i < MAX_GLOBAL_GC_MECHANISMS_COUNT; i++)
+ for (int i = 0; i < DAC_MAX_GLOBAL_GC_MECHANISMS_COUNT; i++)
{
ExtOut("%-30s: %d\n", str_gc_global_mechanisms[i], interestingInfo.globalMechanisms[i]);
}
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp
index b6336fb143..3cdebcf0f4 100644
--- a/src/ToolBox/SOS/Strike/util.cpp
+++ b/src/ToolBox/SOS/Strike/util.cpp
@@ -4793,10 +4793,8 @@ HRESULT InitCorDebugInterface()
// Need to pick the appropriate SKU of CLR to detect
#if defined(FEATURE_CORESYSTEM)
GUID skuId = CLR_ID_ONECORE_CLR;
-#elif defined(FEATURE_CORECLR)
- GUID skuId = CLR_ID_CORECLR;
#else
- GUID skuId = CLR_ID_V4_DESKTOP;
+ GUID skuId = CLR_ID_CORECLR;
#endif
CLRDebuggingImpl* pDebuggingImpl = new CLRDebuggingImpl(skuId);
hr = pDebuggingImpl->QueryInterface(IID_ICLRDebugging, (LPVOID *)&pClrDebugging);
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index 29b36e8fa2..247c70033b 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -15,6 +15,13 @@ endif (CORECLR_SET_RPATH)
add_definitions(-DPAL_STDCPP_COMPAT)
+set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
+set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")
+
+if(SKIP_LLDBPLUGIN)
+ SET(REQUIRE_LLDBPLUGIN false)
+endif()
+
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
add_definitions(-D_TARGET_AMD64_=1)
add_definitions(-DDBG_TARGET_64BIT=1)
@@ -35,14 +42,10 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-DDBG_TARGET_ARM64=1)
add_definitions(-DDBG_TARGET_WIN64=1)
add_definitions(-DBIT64)
+ SET(REQUIRE_LLDBPLUGIN false)
endif()
-set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
-set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")
-if(SKIP_LLDBPLUGIN)
- SET(REQUIRE_LLDBPLUGIN false)
-endif()
set(LLVM_HOST_DIR "$ENV{LLVM_HOME}")
set(WITH_LLDB_LIBS "${LLVM_HOST_DIR}/lib" CACHE PATH "Path to LLDB libraries")
set(WITH_LLDB_INCLUDES "${LLVM_HOST_DIR}/include" CACHE PATH "Path to LLDB headers")