Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions debuggees.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FindRootsOlderGeneration",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpGCData", "src\SOS\SOS.UnitTests\Debuggees\DumpGCData\DumpGCData.csproj", "{CBE13BD1-EA24-4A95-818C-EE6FFA4F09A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniDumpLocalVarLookup", "src\SOS\SOS.UnitTests\Debuggees\MiniDumpLocalVarLookup\MiniDumpLocalVarLookup.csproj", "{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Checked|Any CPU = Checked|Any CPU
Expand Down Expand Up @@ -835,6 +837,46 @@ Global
{CBE13BD1-EA24-4A95-818C-EE6FFA4F09A5}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU
{CBE13BD1-EA24-4A95-818C-EE6FFA4F09A5}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU
{CBE13BD1-EA24-4A95-818C-EE6FFA4F09A5}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|Any CPU.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|Any CPU.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|ARM.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|ARM.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|ARM64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|ARM64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|x64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|x64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|x86.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Checked|x86.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|ARM.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|ARM64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|x64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|x64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Debug|x86.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|Any CPU.Build.0 = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|ARM.ActiveCfg = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|ARM.Build.0 = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|ARM64.ActiveCfg = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|ARM64.Build.0 = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|x64.ActiveCfg = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|x64.Build.0 = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|x86.ActiveCfg = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.Release|x86.Build.0 = Release|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|ARM.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|ARM.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|ARM64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|ARM64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -863,6 +905,7 @@ Global
{AE071195-19FD-4215-87A9-D4A77A4ACC52} = {D25F6D55-E7B6-4231-F185-513E693BEEA2}
{B7954E17-D190-42F2-B34F-284BCA70FD97} = {D25F6D55-E7B6-4231-F185-513E693BEEA2}
{CBE13BD1-EA24-4A95-818C-EE6FFA4F09A5} = {D25F6D55-E7B6-4231-F185-513E693BEEA2}
{B042D2AB-D74C-46D8-94DD-68E9AA293FF5} = {D25F6D55-E7B6-4231-F185-513E693BEEA2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46465737-C938-44FC-BE1A-4CE139EBB5E0}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework>
<TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(SupportedSubProcessTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Diagnostics;

namespace MiniDumpLocalVarLookup;

internal class Program
{
static public void Main()
{
int intValue = 42;
string stringValue = "Hello, World!";

PrintValues(intValue, stringValue);
}

static void PrintValues(int intValue, string stringValue)
{
int length = stringValue.Length;
Debugger.Break();
Console.WriteLine($"intValue: {intValue}");
Console.WriteLine($"stringValue: {stringValue} (length = {length})");
}
}
50 changes: 47 additions & 3 deletions src/SOS/SOS.UnitTests/SOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ internal static async Task RunTest(
string testName = null,
bool testLive = true,
bool testDump = true,
bool testTriage = false)
bool testTriage = false,
bool testMini = false,
SOSRunner.DumpGenerator dumpGenerator = SOSRunner.DumpGenerator.CreateDump)
{
await RunTest(scriptName,
new SOSRunner.TestInformation
Expand All @@ -149,7 +151,8 @@ await RunTest(scriptName,
TestLive = testLive,
TestDump = testDump,
DebuggeeName = debuggeeName,
DumpType = SOSRunner.DumpType.Heap
DumpType = SOSRunner.DumpType.Heap,
DumpGenerator = dumpGenerator,
},
output);

Expand All @@ -165,7 +168,23 @@ await RunTest(scriptName,
TestLive = false,
TestDump = testDump,
DebuggeeName = debuggeeName,
DumpType = SOSRunner.DumpType.Triage
DumpType = SOSRunner.DumpType.Triage,
DumpGenerator = dumpGenerator,
},
output);
}
if (testMini && !config.PublishSingleFile)
{
await RunTest(scriptName,
new SOSRunner.TestInformation
{
TestConfiguration = config,
TestName = testName,
TestLive = false,
TestDump = testDump,
DebuggeeName = debuggeeName,
DumpType = SOSRunner.DumpType.Mini,
DumpGenerator = dumpGenerator,
},
output);
}
Expand Down Expand Up @@ -234,6 +253,31 @@ public SOS(ITestOutputHelper output)

public static IEnumerable<object[]> Configurations => SOSTestHelpers.GetConfigurations("TestName", value: null);

[SkippableTheory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task MiniDumpLocalVarLookup(TestConfiguration config)
{
if (OS.Kind != OSKind.Windows)
{
throw new SkipTestException("Test only supports CDB and therefore only runs on Windows");
}

if (config.PublishSingleFile)
{
throw new SkipTestException("Single file does not support mini dumps");
}

// The default dumpGenerator, CreateDump, only supports taking dumps at exceptions.
// DotnetDump could support taking a dump at a breakpoint, but this SOS test framework doesn't currently support this operation.
// Therefore we use the NativeDebugger to take a dump at the DebugBreak() call in the debuggee.
await SOSTestHelpers.RunTest(
config,
debuggeeName: "MiniDumpLocalVarLookup",
scriptName: "MiniDumpLocalVarLookup.script",
Output,
testName: "SOS.MiniDumpLocalVarLookup",
testMini: true,
dumpGenerator: SOSRunner.DumpGenerator.NativeDebugger);
}

[SkippableTheory, MemberData(nameof(SOSTestHelpers.GetNetCoreConfigurations), MemberType = typeof(SOSTestHelpers))]
public async Task VarargPInvokeInteropMD(TestConfiguration config)
Expand Down
10 changes: 10 additions & 0 deletions src/SOS/SOS.UnitTests/SOSRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum DumpGenerator
public enum DumpType
{
Triage,
Mini,
Heap,
Full
}
Expand Down Expand Up @@ -235,6 +236,9 @@ public static async Task<string> CreateDump(TestInformation information)
await runner.ContinueExecution();
switch (information.DumpType)
{
case DumpType.Mini:
command = ".dump /o /m %DUMP_NAME%";
break;
case DumpType.Heap:
command = ".dump /o /mw %DUMP_NAME%";
break;
Expand Down Expand Up @@ -349,6 +353,9 @@ public static async Task<string> CreateDump(TestInformation information)
}
switch (dumpType)
{
case DumpType.Mini:
processRunner.WithRuntimeConfiguration("DbgMiniDumpType", "1");
break;
case DumpType.Heap:
processRunner.WithRuntimeConfiguration("DbgMiniDumpType", "2");
break;
Expand Down Expand Up @@ -1498,6 +1505,9 @@ private HashSet<string> GetEnabledDefines()
{
switch (_dumpType.Value)
{
case DumpType.Mini:
defines.Add("MINI_DUMP");
break;
case DumpType.Triage:
defines.Add("TRIAGE_DUMP");
break;
Expand Down
15 changes: 15 additions & 0 deletions src/SOS/SOS.UnitTests/Scripts/MiniDumpLocalVarLookup.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Verifies that local stack value variables are able to be parsed by the debugger in mini/triage dumps
# Utilizes the ICorDebug stackwalk with -i
#

CONTINUE

LOADSOS

# stackwalk with locals
SOSCOMMAND:clrstack -l

# stackwalk through ICorDebug with locals
SOSCOMMAND:clrstack -i -l
VERIFY:int\s+length\s+=\s+13
Loading