diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5b42068c72..8fb6bcdb96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -28,9 +28,9 @@ https://github.com/dotnet/arcade ccfe6da198c5f05534863bbb1bff66e830e0c6ab - + https://github.com/dotnet/installer - 8f639696e6d57fb09e03e89c6397d913de1231ed + 84d26a070704dc4eb7870f15d44880228bb82cb8 https://github.com/dotnet/aspnetcore diff --git a/eng/Versions.props b/eng/Versions.props index 990044f2a0..74e1950cae 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -24,7 +24,7 @@ 7.0.0-rc.2.22424.4 7.0.0-rc.2.22424.4 - 7.0.100-rc.1.22407.1 + 7.0.100-rc.2.22419.24 @@ -34,7 +34,7 @@ $(MicrosoftNETCoreApp60Version) 6.0.8 - 7.0.0-rc.1.22403.8 + 7.0.0-rc.1.22411.12 diff --git a/src/SOS/SOS.UnitTests/SOS.cs b/src/SOS/SOS.UnitTests/SOS.cs index df0b0b4b6c..a2ca729366 100644 --- a/src/SOS/SOS.UnitTests/SOS.cs +++ b/src/SOS/SOS.UnitTests/SOS.cs @@ -366,6 +366,8 @@ public async Task DumpGen(TestConfiguration config) [SkippableTheory, MemberData(nameof(Configurations))] public async Task LLDBPluginTests(TestConfiguration config) { + SkipIfArm(config); + if (OS.Kind == OSKind.Windows || config.IsDesktop || config.RuntimeFrameworkVersionMajor == 1 || OS.IsAlpine) { throw new SkipTestException("lldb plugin tests not supported on Windows, Alpine Linux or .NET Core 1.1"); diff --git a/src/SOS/SOS.UnitTests/Scripts/StackAndOtherTests.script b/src/SOS/SOS.UnitTests/Scripts/StackAndOtherTests.script index cbef0dbcbf..bd796f7176 100644 --- a/src/SOS/SOS.UnitTests/Scripts/StackAndOtherTests.script +++ b/src/SOS/SOS.UnitTests/Scripts/StackAndOtherTests.script @@ -198,6 +198,7 @@ ENDIF:NETCORE_OR_DOTNETDUMP # Issue: https://github.com/dotnet/diagnostics/issues/2947 !IFDEF:DOTNETDUMP +!IFDEF:ARM64 !IFDEF:ARM # Verify DumpStack works @@ -218,6 +219,7 @@ VERIFY:.*Child(-SP|EBP|FP)\s+RetAddr\s+Caller, Callee\s+ VERIFY:(.*\s+\s+\s+\(MethodDesc\s+\s+(\+\s*0x\s+)?SymbolTestApp\.Program\.Foo4\(System\.String\)\),\s+calling.*\s+)|(.*\s+\s+\s+\(MethodDesc\s+\s+(\+\s*0x\s+)?SymbolTestApp\.Program\.Foo2\(Int32, System\.String\)\),\s+calling.*\s+) ENDIF:ARM +ENDIF:ARM64 ENDIF:DOTNETDUMP # Verify that IP2MD works (uses IP from ClrStack) diff --git a/src/SOS/SOS.UnitTests/Scripts/StackTests.script b/src/SOS/SOS.UnitTests/Scripts/StackTests.script index d73d25805c..b406e5d338 100644 --- a/src/SOS/SOS.UnitTests/Scripts/StackTests.script +++ b/src/SOS/SOS.UnitTests/Scripts/StackTests.script @@ -152,6 +152,7 @@ VERIFY:.*\s+\s+\s+System\.String.* # Issue: https://github.com/dotnet/diagnostics/issues/2947 !IFDEF:DOTNETDUMP +!IFDEF:ARM64 !IFDEF:ARM # 9) Verify DumpStack works @@ -172,4 +173,5 @@ VERIFY:.*Child(-SP|EBP|FP)\s+RetAddr\s+Caller, Callee\s+ VERIFY:.*\s+\s+\s+\(MethodDesc\s+\s+\+\s*0x\s+NestedExceptionTest\.Program\.Main\(System\.String\[\]\)\),\s+calling.* ENDIF:ARM +ENDIF:ARM64 ENDIF:DOTNETDUMP diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index f5156d38a9..efd0124967 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -3956,6 +3956,12 @@ DECLARE_API(DumpRuntimeTypes) "Address", "Domain", "MT"); ExtOut("------------------------------------------------------------------------------\n"); + if (!g_snapshot.Build()) + { + ExtOut("Unable to build snapshot of the garbage collector state\n"); + return E_FAIL; + } + PrintRuntimeTypeArgs pargs; ZeroMemory(&pargs, sizeof(PrintRuntimeTypeArgs)); diff --git a/src/SOS/lldbplugin/services.cpp b/src/SOS/lldbplugin/services.cpp index fde35e73f8..ffdadb0b61 100644 --- a/src/SOS/lldbplugin/services.cpp +++ b/src/SOS/lldbplugin/services.cpp @@ -19,6 +19,13 @@ #define InvalidTimeStamp 0xFFFFFFFE; #define InvalidChecksum 0xFFFFFFFF; +#ifndef PAGE_SIZE +#define PAGE_SIZE 0x1000 +#endif + +#undef PAGE_MASK +#define PAGE_MASK (~(PAGE_SIZE-1)) + char *g_coreclrDirectory = nullptr; char *g_pluginModuleDirectory = nullptr; @@ -432,7 +439,7 @@ HRESULT LLDBServices::GetPageSize( PULONG size) { - *size = 4096; + *size = PAGE_SIZE; return S_OK; } @@ -762,10 +769,21 @@ LLDBServices::ReadVirtual( ULONG64 offset, PVOID buffer, ULONG bufferSize, - PULONG bytesRead) + PULONG pbytesRead) { lldb::SBError error; - size_t read = 0; + size_t bytesRead = 0; + ULONG64 nextPageStart; + + // Reading 0 bytes must succeed + if (bufferSize == 0) + { + if (pbytesRead) + { + *pbytesRead = 0; + } + return S_OK; + } // lldb doesn't expect sign-extended address offset = CONVERT_FROM_SIGN_EXTENDED(offset); @@ -776,9 +794,41 @@ LLDBServices::ReadVirtual( goto exit; } - read = process.ReadMemory(offset, buffer, bufferSize, error); + // Try the full read and return if successful + bytesRead = process.ReadMemory(offset, buffer, bufferSize, error); + if (error.Success()) + { + goto exit; + } + + // As it turns out the lldb ReadMemory API doesn't do partial reads and the SOS + // caching depends on that behavior. Round up to the next page boundry and attempt + // to read up to the page boundries. + nextPageStart = (offset + PAGE_SIZE - 1) & PAGE_MASK; - if (!error.Success()) + while (bufferSize > 0) + { + size_t size = nextPageStart - offset; + if (size > bufferSize) + { + size = bufferSize; + } + size_t read = process.ReadMemory(offset, buffer, size, error); + + bytesRead += read; + offset += read; + buffer = (BYTE*)buffer + read; + bufferSize -= read; + nextPageStart += PAGE_SIZE; + + if (!error.Success()) + { + break; + } + } + + // If the read isn't complete, try reading directly from native modules in the address range. + if (bufferSize > 0) { lldb::SBTarget target = process.GetTarget(); if (!target.IsValid()) @@ -787,8 +837,7 @@ LLDBServices::ReadVirtual( } int numModules = target.GetNumModules(); - bool found = false; - for (int i = 0; !found && i < numModules; i++) + for (int i = 0; i < numModules; i++) { lldb::SBModule module = target.GetModuleAtIndex(i); int numSections = module.GetNumSections(); @@ -803,9 +852,8 @@ LLDBServices::ReadVirtual( lldb::SBData sectionData = section.GetSectionData(offset - loadAddr, bufferSize); if (sectionData.IsValid()) { - read = sectionData.ReadRawData(error, 0, buffer, bufferSize); - found = true; - break; + bytesRead += sectionData.ReadRawData(error, 0, buffer, bufferSize); + goto exit; } } } @@ -813,11 +861,11 @@ LLDBServices::ReadVirtual( } exit: - if (bytesRead) + if (pbytesRead) { - *bytesRead = read; + *pbytesRead = bytesRead; } - return error.Success() || (read != 0) ? S_OK : E_FAIL; + return bytesRead > 0 ? S_OK : E_FAIL; } HRESULT