[main] Update dependencies from microsoft/clrmd (#2242)
authordotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Tue, 4 May 2021 22:25:16 +0000 (15:25 -0700)
committerGitHub <noreply@github.com>
Tue, 4 May 2021 22:25:16 +0000 (15:25 -0700)
* Update dependencies from https://github.com/microsoft/clrmd build 20210503.2

Microsoft.Diagnostics.Runtime , Microsoft.Diagnostics.Runtime.Utilities
 From Version 2.0.220602 -> To Version 2.0.225302

* Fix build problems and cleanup with new clrmd

* Fix escaped exception from clrmd TryGetSymbolAddress

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Mike McLaughlin <mikem@microsoft.com>
13 files changed:
eng/Version.Details.xml
eng/Versions.props
src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs
src/SOS/SOS.Extensions/HostServices.cs
src/SOS/SOS.Hosting/CorDebugDataTargetWrapper.cs
src/SOS/SOS.Hosting/DataTargetWrapper.cs
src/SOS/SOS.Hosting/HostWrapper.cs
src/SOS/SOS.Hosting/LLDBServices.cs
src/SOS/SOS.Hosting/RuntimeWrapper.cs
src/SOS/SOS.Hosting/SOSHost.cs
src/SOS/SOS.Hosting/SymbolServiceWrapper.cs
src/SOS/SOS.Hosting/TargetWrapper.cs
src/SOS/SOS.Hosting/dbgeng/DebugClient.cs

index 9f8e00e68883f6a4ac3ebeae4588784c8af2602e..e6f14887fe3b342cba7c51ab363fccbe3e8dc0e2 100644 (file)
@@ -8,13 +8,13 @@
       <Uri>https://github.com/dotnet/symstore</Uri>
       <Sha>3ed87724fe4e98c7ecc77617720591783ee2e676</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.220602">
-      <Uri>https://github.com/Microsoft/clrmd</Uri>
-      <Sha>c7cd5b047b78f383530b4694e083535babb60c60</Sha>
+    <Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.225302">
+      <Uri>https://github.com/microsoft/clrmd</Uri>
+      <Sha>d0409daab70c27dcf4c8b8d39cf91c11ae0773e6</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.220602">
-      <Uri>https://github.com/Microsoft/clrmd</Uri>
-      <Sha>c7cd5b047b78f383530b4694e083535babb60c60</Sha>
+    <Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.225302">
+      <Uri>https://github.com/microsoft/clrmd</Uri>
+      <Sha>d0409daab70c27dcf4c8b8d39cf91c11ae0773e6</Sha>
     </Dependency>
     <Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-preview.1.21103.13">
       <Uri>https://github.com/dotnet/installer</Uri>
index 772e33b933d9e4361cf5abe18d45888f924f02a4..6f427aef225ccdebb8d6ed91046fc96b42608945 100644 (file)
@@ -36,8 +36,8 @@
     <MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
     <!-- Other libs -->
     <MicrosoftBclAsyncInterfacesVersion>1.1.0</MicrosoftBclAsyncInterfacesVersion>
-    <MicrosoftDiagnosticsRuntimeVersion>2.0.220602</MicrosoftDiagnosticsRuntimeVersion>
-    <MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.220602</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
+    <MicrosoftDiagnosticsRuntimeVersion>2.0.225302</MicrosoftDiagnosticsRuntimeVersion>
+    <MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.225302</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
     <MicrosoftDiaSymReaderNativePackageVersion>1.7.0</MicrosoftDiaSymReaderNativePackageVersion>
     <MicrosoftDiagnosticsTracingTraceEventVersion>2.0.64</MicrosoftDiagnosticsTracingTraceEventVersion>
     <MicrosoftExtensionsLoggingVersion>2.1.1</MicrosoftExtensionsLoggingVersion>
index de57074fcdf12a5c7737f1a9499a1791d5728247..de0d8b27f5a17d62c3e0c8d1567f1def7d3317a2 100644 (file)
@@ -6,6 +6,7 @@ using Microsoft.Diagnostics.Runtime;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
 
@@ -101,7 +102,15 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             {
                 if (_exportReader is not null)
                 {
-                    return _exportReader.TryGetSymbolAddress(ImageBase, name, out address);
+                    // Some exceptions are escaping from the clrmd ELF dump reader. This will be
+                    // fixed in a clrmd update.
+                    try
+                    {
+                        return _exportReader.TryGetSymbolAddress(ImageBase, name, out address);
+                    }
+                    catch (IOException)
+                    {
+                    }
                 }
                 address = 0;
                 return false;
index e8b93fe74f9ed5b1984089b7eb554200a79b26f4..30128a98c3f6e216ea2bda0f2f30e648212b238e 100644 (file)
@@ -120,6 +120,11 @@ namespace SOS.Extensions
             AddRef();
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("HostServices.Destroy");
+        }
+
         #region IHost
 
         public IServiceEvent OnShutdownEvent { get; } = new ServiceEvent();
index db1856e904447a1fc1aa58a46ee8ab2ab91c970b..2b6023fc31dfa4c3a89670da24e091149e8eae20 100644 (file)
@@ -58,6 +58,11 @@ namespace SOS.Hosting
             builder.Complete();
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("CorDebugDataTargetWrapper.Destroy");
+        }
+
         #region ICorDebugDataTarget
 
         private int GetPlatform(
index 335ec6123895eb37f7a4b64b20e8a2db6956d64e..61a77b861df882504ec36a97427fba371e8e1910 100644 (file)
@@ -92,6 +92,11 @@ namespace SOS.Hosting
             builder.AddMethod(new FreeVirtualDelegate(FreeVirtual));
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("DataTargetWrapper.Destroy");
+        }
+
         #region ICLRDataTarget
 
         private HResult GetMachineType(
index b6a61aaff2bf968c14590a5458ab6c1417a916b5..86c7074770a0056af0ee61453f55db66b9c38d72 100644 (file)
@@ -6,6 +6,7 @@ using Microsoft.Diagnostics.DebugServices;
 using Microsoft.Diagnostics.Runtime.Utilities;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Runtime.InteropServices;
 
 namespace SOS.Hosting
@@ -35,6 +36,11 @@ namespace SOS.Hosting
             AddRef();
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("HostWrapper.Destroy");
+        }
+
         /// <summary>
         /// Add service instance factory
         /// </summary>
@@ -80,7 +86,6 @@ namespace SOS.Hosting
         {
             if (_targetWrapper != null)
             {
-                _targetWrapper.Destroy();
                 _targetWrapper.Release();
                 _targetWrapper = null;
             }
index 93f08e4b5fd1621e414d80a7e2358127f9c7a0ec..ad130b310f5a25201ae2d54d16bfee87da3f02bf 100644 (file)
@@ -8,6 +8,7 @@ using Microsoft.Diagnostics.Runtime.Interop;
 using Microsoft.Diagnostics.Runtime.Utilities;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
@@ -88,6 +89,11 @@ namespace SOS.Hosting
             AddRef();
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("LLDBServices.Destroy");
+        }
+
         #region ILLDBServices
 
         string GetCoreClrDirectory(
index b185c6f6ad85f94de6da0419f363b69ba7116c5a..bcfd1fe6ac30e963afa647b587d3832ece73a8f6 100644 (file)
@@ -14,7 +14,7 @@ using System.Text;
 
 namespace SOS.Hosting
 {
-    internal sealed unsafe class RuntimeWrapper : COMCallableIUnknown, IDisposable
+    internal sealed unsafe class RuntimeWrapper : COMCallableIUnknown
     {
         /// <summary>
         /// The runtime OS and type. Must match IRuntime::RuntimeConfiguration in runtime.h.
@@ -120,20 +120,10 @@ namespace SOS.Hosting
             AddRef();
         }
 
-        public void Dispose()
+        protected override void Destroy()
         {
+            Trace.TraceInformation("RuntimeWrapper.Destroy");
             _onFlushEvent.Dispose();
-            Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        ~RuntimeWrapper()
-        {
-            Dispose(false);
-        }
-
-        private void Dispose(bool _)
-        {
             if (_dacHandle != IntPtr.Zero)
             {
                 DataTarget.PlatformFunctions.FreeLibrary(_dacHandle);
index c22457a053d8e800a5e0f42876ff0c1927a49c72..de9d7df03fc427d67330115efeb15f53e8f2a6db 100644 (file)
@@ -20,7 +20,7 @@ namespace SOS.Hosting
     /// <summary>
     /// Helper code to hosting SOS under ClrMD
     /// </summary>
-    public sealed class SOSHost
+    public sealed class SOSHost : IDisposable
     {
         [UnmanagedFunctionPointer(CallingConvention.Winapi)]
         private delegate int SOSCommandDelegate(
@@ -50,6 +50,7 @@ namespace SOS.Hosting
         private readonly HostWrapper _hostWrapper;
         private readonly ulong _ignoreAddressBitsMask;
         private IntPtr _sosLibrary = IntPtr.Zero;
+        private bool _disposed;
 
         /// <summary>
         /// The native SOS binaries path. Default is OS/architecture (RID) named directory in the same directory as this assembly.
@@ -142,6 +143,27 @@ namespace SOS.Hosting
             }
         }
 
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~SOSHost()
+        {
+            Dispose(false);
+        }
+
+        private void Dispose(bool _)
+        {
+            if (!_disposed)
+            {
+                Trace.TraceInformation("SOSHost.Dispose");
+                _disposed = true;
+                COMHelper.Release(_interface);
+            }
+        }
+
         /// <summary>
         /// Shutdown/clean up the native SOS.
         /// </summary>
index 9d0a10d423e057fa107223e102d794252e61f9ea..74973a5364e5015d354d4d156bd6ed8788648f7b 100644 (file)
@@ -103,6 +103,12 @@ namespace SOS.Hosting
             builder.AddMethod(new GetMetadataLocatorDelegate(GetMetadataLocator));
             builder.AddMethod(new GetICorDebugMetadataLocatorDelegate(GetICorDebugMetadataLocator));
             builder.Complete();
+            AddRef();
+        }
+
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("SymbolServiceWrapper.Destroy");
         }
 
         /// <summary>
index 5f50de51fad6d00f29d7ce42a3d28caa1ed967fd..229dca52758abba30ff88b2d3bf10b2a5c578364 100644 (file)
@@ -48,11 +48,11 @@ namespace SOS.Hosting
             AddRef();
         }
 
-        public void Destroy()
+        protected override void Destroy()
         {
+            Trace.TraceInformation("TargetWrapper.Destroy");
             foreach (RuntimeWrapper wrapper in _wrappers.Values)
             {
-                wrapper.Dispose();
                 wrapper.Release();
             }
             _wrappers.Clear();
index 5217a3f1897b837b2ad1837120f3e9573362a3e1..19e595cca8b2814a43fc28011ecc3b239f724ffd 100644 (file)
@@ -5,6 +5,7 @@
 using Microsoft.Diagnostics.Runtime.Interop;
 using Microsoft.Diagnostics.Runtime.Utilities;
 using System;
+using System.Diagnostics;
 using System.Runtime.InteropServices;
 using System.Text;
 
@@ -41,6 +42,11 @@ namespace SOS.Hosting
             AddRef();
         }
 
+        protected override void Destroy()
+        {
+            Trace.TraceInformation("DebugClient.Destroy");
+        }
+
         private static void AddDebugClient(VTableBuilder builder, SOSHost soshost)
         {
             builder.AddMethod(new AttachKernelDelegate((self, flags, connectOptions) => NotImplemented));