From: Mike McLaughlin Date: Thu, 9 Sep 2021 20:37:29 +0000 (-0700) Subject: Enable crash dump report generation in SOS tests (#2558) X-Git-Tag: submit/tizen/20220302.040122~21^2^2~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6946f55d9aa61400628d93de0fa6e179bc8515e0;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Enable crash dump report generation in SOS tests (#2558) Enable crash dump report generation in SOS tests Load crash report json file and check some common values. Enable Windows triage and heap dump testing Check for ctrl-c on console writelines Fix arm32/x86 sign extensions problems in C++ data targets Fix dotnet-dump collect dump type and the exception display in commands Fix eeversion command when private build version like 42.42.42.42424 Add the directory of the dump to the symbol search path Remove "ChangeEngineState" message on every stop in windbg. Fix module relocations fixes. It was using the wrong rva. Needed the original rva not the translated file layout one. Better SOS module load failure message. Remove System.Memory dependencies --- diff --git a/eng/Versions.props b/eng/Versions.props index 399e46c7b..b3e54f963 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -51,5 +51,6 @@ 2.0.3 7.0.0-beta.21453.2 10.0.18362 + 12.0.2 diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs index 8ceeb7605..2c9015129 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs @@ -151,7 +151,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation if ((rva + size) <= block.Length) { data = block.GetReader(rva, size).ReadBytes(size); - ApplyRelocations(module, reader, rva, data); + ApplyRelocations(module, reader, (int)(address - module.ImageBase), data); } else { @@ -182,7 +182,9 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation Debug.Assert(rva >= 0); try { +#if TRACE_VERBOSE Trace.TraceInformation($"ReadMemoryFromModule: address {address:X16} rva {rva:X16} size {bytesRequested:X8} in ELF or MachO file {module.FileName}"); +#endif byte[] data = new byte[bytesRequested]; uint read = virtualAddressReader.Read(rva, data, 0, (uint)bytesRequested); if (read == 0) diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs index 71f1a1cee..2da9ac5eb 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs @@ -183,6 +183,11 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation if (versionString != null) { int spaceIndex = versionString.IndexOf(' '); + if (spaceIndex < 0) + { + // It is probably a private build version that doesn't end with a space (no commit id after) + spaceIndex = versionString.Length; + } if (spaceIndex > 0) { if (versionString[spaceIndex - 1] == '.') diff --git a/src/Microsoft.Diagnostics.DebugServices/CommandBase.cs b/src/Microsoft.Diagnostics.DebugServices/CommandBase.cs index 3470680e4..2898669a4 100644 --- a/src/Microsoft.Diagnostics.DebugServices/CommandBase.cs +++ b/src/Microsoft.Diagnostics.DebugServices/CommandBase.cs @@ -38,6 +38,7 @@ namespace Microsoft.Diagnostics.DebugServices protected void WriteLine(string message) { Console.Write(message + Environment.NewLine); + Console.CancellationToken.ThrowIfCancellationRequested(); } /// @@ -48,6 +49,7 @@ namespace Microsoft.Diagnostics.DebugServices protected void WriteLine(string format, params object[] args) { Console.Write(string.Format(format, args) + Environment.NewLine); + Console.CancellationToken.ThrowIfCancellationRequested(); } /// @@ -58,6 +60,7 @@ namespace Microsoft.Diagnostics.DebugServices protected void WriteLineWarning(string format, params object[] args) { Console.WriteWarning(string.Format(format, args) + Environment.NewLine); + Console.CancellationToken.ThrowIfCancellationRequested(); } /// @@ -68,6 +71,7 @@ namespace Microsoft.Diagnostics.DebugServices protected void WriteLineError(string format, params object[] args) { Console.WriteError(string.Format(format, args) + Environment.NewLine); + Console.CancellationToken.ThrowIfCancellationRequested(); } /// diff --git a/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj b/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj index 08b9efdb0..2e6484914 100644 --- a/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj +++ b/src/Microsoft.Diagnostics.DebugServices/Microsoft.Diagnostics.DebugServices.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs index f5b1d5e19..b3c4af85a 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs @@ -32,7 +32,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands var heap = Runtime.Heap; var type = heap.GetObjectType(address); - if (type == null) + if (type?.Name is null) { WriteLine($"{Address:x16} is not referencing an object..."); return; diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/DumpGen.cs b/src/Microsoft.Diagnostics.ExtensionCommands/DumpGen.cs index 9261b1c3a..7d341ee3a 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/DumpGen.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/DumpGen.cs @@ -49,7 +49,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands private static bool IsTypeNameMatching(string typeName, string typeNameFilter) { - return typeName.IndexOf(typeNameFilter, StringComparison.OrdinalIgnoreCase) >= 0; + return typeName != null && typeName.IndexOf(typeNameFilter, StringComparison.OrdinalIgnoreCase) >= 0; } } } diff --git a/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs b/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs index cddc21a07..cce0c9a8b 100644 --- a/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs +++ b/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs @@ -240,14 +240,20 @@ namespace Microsoft.Diagnostics.Repl private void OnException(Exception ex, InvocationContext context) { + if (ex is TargetInvocationException) + { + ex = ex.InnerException; + } if (ex is NullReferenceException || ex is ArgumentException || ex is ArgumentNullException || ex is ArgumentOutOfRangeException || - ex is NotImplementedException) { + ex is NotImplementedException) + { context.Console.Error.WriteLine(ex.ToString()); } - else { + else + { context.Console.Error.WriteLine(ex.Message); } Trace.TraceError(ex.ToString()); @@ -368,18 +374,11 @@ namespace Microsoft.Diagnostics.Repl private void Invoke(MethodInfo methodInfo, InvocationContext context, Parser parser, IServiceProvider services) { - try - { - object instance = _factory(services); - SetProperties(context, parser, services, instance); + object instance = _factory(services); + SetProperties(context, parser, services, instance); - object[] arguments = BuildArguments(methodInfo, services); - methodInfo.Invoke(instance, arguments); - } - catch (TargetInvocationException ex) - { - throw ex.InnerException; - } + object[] arguments = BuildArguments(methodInfo, services); + methodInfo.Invoke(instance, arguments); } private void SetProperties(InvocationContext context, Parser parser, IServiceProvider services, object instance) diff --git a/src/SOS/SOS.Hosting/SOSLibrary.cs b/src/SOS/SOS.Hosting/SOSLibrary.cs index 6d0ce843f..10d45761b 100644 --- a/src/SOS/SOS.Hosting/SOSLibrary.cs +++ b/src/SOS/SOS.Hosting/SOSLibrary.cs @@ -107,11 +107,11 @@ namespace SOS.Hosting // This is a workaround for the Microsoft SDK docker images. Can fail when LoadLibrary uses libdl.so to load the SOS module. if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - throw new DllNotFoundException("Problem loading SOS module. Try installing libc6-dev (apt-get install libc6-dev) to work around this problem.", ex); + throw new DllNotFoundException($"Problem loading SOS module from {sosPath}. Try installing libc6-dev (apt-get install libc6-dev) to work around this problem.", ex); } else { - throw; + throw new DllNotFoundException($"Problem loading SOS module from {sosPath}", ex); } } if (_sosLibrary == IntPtr.Zero) diff --git a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj index 80842426f..b5c2c4b31 100644 --- a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj +++ b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj @@ -32,6 +32,7 @@ + diff --git a/src/SOS/SOS.UnitTests/SOS.cs b/src/SOS/SOS.UnitTests/SOS.cs index 1f3ad1689..b9bb0c8ff 100644 --- a/src/SOS/SOS.UnitTests/SOS.cs +++ b/src/SOS/SOS.UnitTests/SOS.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.TestHelpers; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -41,7 +42,6 @@ public class SOS { information.OutputHelper = Output; - // TODO: enable either when bpmd is fixed on Alpine or the bpmd tests are ifdef'ed out of the scripts for Alpine if (testLive) { // Live @@ -53,13 +53,15 @@ public class SOS if (testDump) { + string dumpName = null; + // Create and test dumps on OSX or Alpine only if the runtime is 6.0 or greater if (!(OS.Kind == OSKind.OSX || SOSRunner.IsAlpine()) || information.TestConfiguration.RuntimeFrameworkVersionMajor > 5) { // Generate a crash dump. if (information.TestConfiguration.DebuggeeDumpOutputRootDir() != null) { - await SOSRunner.CreateDump(information); + dumpName = await SOSRunner.CreateDump(information); } // Test against a crash dump. @@ -85,8 +87,64 @@ public class SOS } } } + + // Test the crash report json file + if (dumpName != null && information.TestCrashReport) + { + TestCrashReport(dumpName, information); + } + } + } + } + + private void TestCrashReport(string dumpName, SOSRunner.TestInformation information) + { + string crashReportPath = dumpName + ".crashreport.json"; + TestRunner.OutputHelper outputHelper = TestRunner.ConfigureLogging(information.TestConfiguration, information.OutputHelper, information.TestName + ".CrashReportTest"); + try + { + outputHelper.WriteLine("CrashReportTest for {0}", crashReportPath); + outputHelper.WriteLine("{"); + + AssertX.FileExists("CrashReport", crashReportPath, outputHelper.IndentedOutput); + + dynamic crashReport = JsonConvert.DeserializeObject(File.ReadAllText(crashReportPath)); + Assert.NotNull(crashReport); + + dynamic payload = crashReport.payload; + Assert.NotNull(payload); + Version protocol_version = Version.Parse((string)payload.protocol_version); + Assert.True(protocol_version >= new Version("1.0.0")); + outputHelper.IndentedOutput.WriteLine($"protocol_version {protocol_version}"); + + string process_name = (string)payload.process_name; + Assert.NotNull(process_name); + outputHelper.IndentedOutput.WriteLine($"process_name {process_name}"); + + Assert.NotNull(payload.threads); + IEnumerable threads = payload.threads; + Assert.True(threads.Any()); + outputHelper.IndentedOutput.WriteLine($"threads # {threads.Count()}"); + + if (OS.Kind == OSKind.OSX) + { + dynamic parameters = crashReport.parameters; + Assert.NotNull(parameters); + Assert.NotNull(parameters.ExceptionType); + Assert.NotNull(parameters.OSVersion); + Assert.Equal(parameters.SystemManufacturer, "apple"); } } + catch (Exception ex) + { + // Log the exception + outputHelper.IndentedOutput.WriteLine(ex.ToString()); + } + finally + { + outputHelper.WriteLine("}"); + outputHelper.Dispose(); + } } private async Task RunTest(TestConfiguration config, string debuggeeName, string scriptName, string testName = null, bool testLive = true, bool testDump = true, bool testTriage = false) @@ -127,7 +185,7 @@ public class SOS [SkippableTheory, MemberData(nameof(Configurations))] public async Task GCPOHTests(TestConfiguration config) { - if (!config.IsNETCore || config.RuntimeFrameworkVersionMajor < 5) + if (config.IsDesktop || config.RuntimeFrameworkVersionMajor < 5) { throw new SkipTestException("This test validates POH behavior, which was introduced in .net 5"); } @@ -142,7 +200,7 @@ public class SOS TestConfiguration = config, DebuggeeName = "Overflow", // Generating the logging for overflow test causes so much output from createdump that it hangs/timesout the test run - DumpDiagnostics = false, + DumpDiagnostics = config.IsNETCore && config.RuntimeFrameworkVersionMajor >= 6, DumpGenerator = config.StackOverflowCreatesDump ? SOSRunner.DumpGenerator.CreateDump : SOSRunner.DumpGenerator.NativeDebugger }); } diff --git a/src/SOS/SOS.UnitTests/SOSRunner.cs b/src/SOS/SOS.UnitTests/SOSRunner.cs index c8566c98e..056c12bcd 100644 --- a/src/SOS/SOS.UnitTests/SOSRunner.cs +++ b/src/SOS/SOS.UnitTests/SOSRunner.cs @@ -67,6 +67,8 @@ public class SOSRunner : IDisposable public class TestInformation { private string _testName; + private bool _testCrashReport = true; + private DumpGenerator _dumpGenerator = DumpGenerator.CreateDump; public TestConfiguration TestConfiguration { get; set; } @@ -82,7 +84,21 @@ public class SOSRunner : IDisposable public string DebuggeeArguments { get; set; } - public DumpGenerator DumpGenerator { get; set; } = DumpGenerator.CreateDump; + public DumpGenerator DumpGenerator + { + get { + DumpGenerator dumpGeneration = _dumpGenerator; + if (dumpGeneration == DumpGenerator.CreateDump) + { + if (!TestConfiguration.CreateDumpExists || TestConfiguration.GenerateDumpWithLLDB() || TestConfiguration.GenerateDumpWithGDB()) + { + dumpGeneration = DumpGenerator.NativeDebugger; + } + } + return dumpGeneration; + } + set { _dumpGenerator = value; } + } public DumpType DumpType { get; set; } = DumpType.Heap; @@ -92,6 +108,12 @@ public class SOSRunner : IDisposable public string DumpNameSuffix { get; set; } + public bool TestCrashReport + { + get { return _testCrashReport && DumpGenerator == DumpGenerator.CreateDump && OS.Kind != OSKind.Windows && TestConfiguration.RuntimeFrameworkVersionMajor >= 6; } + set { _testCrashReport = value; } + } + public bool IsValid() { return TestConfiguration != null && OutputHelper != null && DebuggeeName != null; @@ -134,24 +156,18 @@ public class SOSRunner : IDisposable /// Run a debuggee and create a dump. /// /// test info - public static async Task CreateDump(TestInformation information) + /// full dump name + public static async Task CreateDump(TestInformation information) { if (!information.IsValid()) { throw new ArgumentException("Invalid TestInformation"); } TestConfiguration config = information.TestConfiguration; DumpGenerator dumpGeneration = information.DumpGenerator; + string dumpName = null; Directory.CreateDirectory(config.DebuggeeDumpOutputRootDir()); - if (dumpGeneration == DumpGenerator.CreateDump) - { - if (!config.CreateDumpExists || config.GenerateDumpWithLLDB() || config.GenerateDumpWithGDB()) - { - dumpGeneration = DumpGenerator.NativeDebugger; - } - } - if (dumpGeneration == DumpGenerator.NativeDebugger) { // Force the dump type to full for .NET Core 1.1 because the heap dumps are broken (can't read ThreadStore). @@ -160,6 +176,7 @@ public class SOSRunner : IDisposable information.DumpType = DumpType.Full; } using SOSRunner runner = await SOSRunner.StartDebugger(information, DebuggerAction.GenerateDump); + dumpName = runner.ReplaceVariables("%DUMP_NAME%"); try { await runner.LoadSosExtension(); @@ -215,6 +232,7 @@ public class SOSRunner : IDisposable // source directory name has been lowercased by the build system. DebuggeeConfiguration debuggeeConfig = await DebuggeeCompiler.Execute(config, information.DebuggeeName, outputHelper); Dictionary variables = GenerateVariables(information, debuggeeConfig, DebuggerAction.GenerateDump); + dumpName = ReplaceVariables(variables, "%DUMP_NAME%"); outputHelper.WriteLine("Starting {0}", information.TestName); outputHelper.WriteLine("{"); @@ -264,14 +282,19 @@ public class SOSRunner : IDisposable // Run the debuggee with the createdump environment variables set to generate a coredump on unhandled exception processRunner. WithEnvironmentVariable("COMPlus_DbgEnableMiniDump", "1"). - WithEnvironmentVariable("COMPlus_DbgMiniDumpName", ReplaceVariables(variables, "%DUMP_NAME%")); + WithEnvironmentVariable("COMPlus_DbgMiniDumpName", dumpName); if (information.DumpDiagnostics) { processRunner.WithEnvironmentVariable("COMPlus_CreateDumpDiagnostics", "1"); } - - // TODO: temporary hack to disable using createdump for triage type until the failures can be fixed + if (information.TestCrashReport) + { + processRunner.WithEnvironmentVariable("COMPlus_EnableCrashReport", "1"); + } + // Windows createdump's triage MiniDumpWriteDump flags for .NET 5.0 are broken + // Disable testing triage dumps on 6.0 until the DAC signing issue is resolved - issue https://github.com/dotnet/diagnostics/issues/2542 + // if (OS.Kind == OSKind.Windows && dumpType == DumpType.Triage && config.IsNETCore && config.RuntimeFrameworkVersionMajor < 6) DumpType dumpType = information.DumpType; if (OS.Kind == OSKind.Windows && dumpType == DumpType.Triage) { @@ -315,9 +338,14 @@ public class SOSRunner : IDisposable } // Start dotnet-dump collect + DumpType dumpType = information.DumpType; + if (config.IsDesktop || config.RuntimeFrameworkVersionMajor < 6) + { + dumpType = DumpType.Full; + } var dotnetDumpArguments = new StringBuilder(); dotnetDumpArguments.Append(config.DotNetDumpPath()); - dotnetDumpArguments.AppendFormat(" collect --process-id {0} --output %DUMP_NAME%", processRunner.ProcessId); + dotnetDumpArguments.AppendFormat($" collect --process-id {processRunner.ProcessId} --output {dumpName} --type {dumpType}"); if (information.DumpDiagnostics) { dotnetDumpArguments.Append(" --diag"); @@ -362,6 +390,7 @@ public class SOSRunner : IDisposable pipeServer?.Dispose(); } } + return dumpName; } /// @@ -809,6 +838,15 @@ public class SOSRunner : IDisposable { commands.Add($"!SetHostRuntime {setHostRuntime}"); } + // Add the path to runtime so SOS can find DAC/DBI for triage dumps + if (_dumpType.HasValue && _dumpType == DumpType.Triage) + { + string runtimeSymbolsPath = _config.RuntimeSymbolsPath; + if (runtimeSymbolsPath != null) + { + commands.Add("!SetClrPath " + runtimeSymbolsPath); + } + } break; case NativeDebugger.Lldb: commands.Add($"plugin load {sosPath}"); diff --git a/src/SOS/Strike/dbgengservices.cpp b/src/SOS/Strike/dbgengservices.cpp index 3b1c47b10..adbd7e5d5 100644 --- a/src/SOS/Strike/dbgengservices.cpp +++ b/src/SOS/Strike/dbgengservices.cpp @@ -502,8 +502,6 @@ HRESULT DbgEngServices::ChangeEngineState( { if (((Argument & DEBUG_STATUS_MASK) == DEBUG_STATUS_BREAK) && ((Argument & DEBUG_STATUS_INSIDE_WAIT) == 0)) { - m_control->Output(DEBUG_OUTPUT_NORMAL, "ChangeEngineState\n"); - // Flush the target when the debugger target breaks Extensions::GetInstance()->FlushTarget(); } diff --git a/src/SOS/Strike/platform/cordebugdatatarget.h b/src/SOS/Strike/platform/cordebugdatatarget.h index 27a7b0eb9..94ee03a6c 100644 --- a/src/SOS/Strike/platform/cordebugdatatarget.h +++ b/src/SOS/Strike/platform/cordebugdatatarget.h @@ -114,6 +114,7 @@ public: { return E_UNEXPECTED; } + address = CONVERT_FROM_SIGN_EXTENDED(address); #ifdef FEATURE_PAL if (g_sos != nullptr) { diff --git a/src/SOS/Strike/platform/datatarget.cpp b/src/SOS/Strike/platform/datatarget.cpp index 7e21a89d0..9c9dc2e48 100644 --- a/src/SOS/Strike/platform/datatarget.cpp +++ b/src/SOS/Strike/platform/datatarget.cpp @@ -148,6 +148,7 @@ DataTarget::ReadVirtual( { return E_UNEXPECTED; } + address = CONVERT_FROM_SIGN_EXTENDED(address); #ifdef FEATURE_PAL if (g_sos != nullptr) { diff --git a/src/SOS/Strike/util.h b/src/SOS/Strike/util.h index 51c3da0c6..6f68cafb2 100644 --- a/src/SOS/Strike/util.h +++ b/src/SOS/Strike/util.h @@ -7,6 +7,8 @@ #define LIMITED_METHOD_CONTRACT +#define CONVERT_FROM_SIGN_EXTENDED(offset) ((ULONG_PTR)(offset)) + // So we can use the PAL_TRY_NAKED family of macros without dependencies on utilcode. inline void RestoreSOToleranceState() {} diff --git a/src/Tools/dotnet-dump/Analyzer.cs b/src/Tools/dotnet-dump/Analyzer.cs index d6b7be75f..8ec88179a 100644 --- a/src/Tools/dotnet-dump/Analyzer.cs +++ b/src/Tools/dotnet-dump/Analyzer.cs @@ -98,9 +98,10 @@ namespace Microsoft.Diagnostics.Tools.Dump _target.ServiceProvider.AddServiceFactory(() => new SOSHost(_contextService.Services)); - // Automatically enable symbol server support + // Automatically enable symbol server support, default cache and search for symbols in the dump directory _symbolService.AddSymbolServer(msdl: true, symweb: false, symbolServerPath: null, authToken: null, timeoutInMinutes: 0); _symbolService.AddCachePath(_symbolService.DefaultSymbolCache); + _symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName)); // Run the commands from the dotnet-dump command line if (command != null) diff --git a/src/Tools/dotnet-dump/Dumper.Windows.cs b/src/Tools/dotnet-dump/Dumper.Windows.cs index dda341879..3f8b5d19a 100644 --- a/src/Tools/dotnet-dump/Dumper.Windows.cs +++ b/src/Tools/dotnet-dump/Dumper.Windows.cs @@ -42,7 +42,20 @@ namespace Microsoft.Diagnostics.Tools.Dump NativeMethods.MINIDUMP_TYPE.MiniDumpWithTokenInformation; break; case DumpTypeOption.Mini: - dumpType = NativeMethods.MINIDUMP_TYPE.MiniDumpWithThreadInfo; + dumpType = NativeMethods.MINIDUMP_TYPE.MiniDumpNormal | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithDataSegs | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithHandleData | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithThreadInfo; + break; + case DumpTypeOption.Triage: + dumpType = NativeMethods.MINIDUMP_TYPE.MiniDumpFilterTriage | + NativeMethods.MINIDUMP_TYPE.MiniDumpIgnoreInaccessibleMemory | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithoutOptionalData | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithProcessThreadData | + NativeMethods.MINIDUMP_TYPE.MiniDumpFilterModulePaths | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithUnloadedModules | + NativeMethods.MINIDUMP_TYPE.MiniDumpFilterMemory | + NativeMethods.MINIDUMP_TYPE.MiniDumpWithHandleData; break; } diff --git a/src/Tools/dotnet-dump/Dumper.cs b/src/Tools/dotnet-dump/Dumper.cs index efe81a836..8d9140a96 100644 --- a/src/Tools/dotnet-dump/Dumper.cs +++ b/src/Tools/dotnet-dump/Dumper.cs @@ -26,6 +26,8 @@ namespace Microsoft.Diagnostics.Tools.Dump // stacks, exception information, handle information, and all memory except for mapped images. Mini, // A small dump containing module lists, thread lists, exception information and all stacks. + + Triage // A small dump containing module lists, thread lists, exception information, all stacks and PMI removed. } public Dumper() @@ -105,6 +107,9 @@ namespace Microsoft.Diagnostics.Tools.Dump case DumpTypeOption.Mini: dumpType = DumpType.Normal; break; + case DumpTypeOption.Triage: + dumpType = DumpType.Triage; + break; } // Send the command to the runtime to initiate the core dump diff --git a/src/tests/dotnet-counters/DotnetCounters.UnitTests.csproj b/src/tests/dotnet-counters/DotnetCounters.UnitTests.csproj index 822d483b3..3e891e2a4 100644 --- a/src/tests/dotnet-counters/DotnetCounters.UnitTests.csproj +++ b/src/tests/dotnet-counters/DotnetCounters.UnitTests.csproj @@ -9,7 +9,7 @@ - +