Cross dbi (#1036)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Fri, 17 Apr 2020 20:05:50 +0000 (16:05 -0400)
committerMike McLaughlin <mikem@microsoft.com>
Thu, 23 Apr 2020 00:57:35 +0000 (17:57 -0700)
* Fix dotnet-dump analyze regression

* Fix CLRDebuggingImpl::GetCLRInfo()

* Fix CLRDebuggingImpl::GetPlatform()

* Fix FEATURE_PAL builds

src/SOS/Strike/cordebugdatatarget.h
src/SOS/Strike/runtime.cpp
src/SOS/debugshim/debugshim.cpp
src/SOS/debugshim/debugshim.h
src/Tools/dotnet-dump/Analyzer.cs

index fe5bece3a52dd25b5815ba7e2cacd8e0090fb828..3a9bbd4cd1f94259c9b9837a4e23b996f821588e 100644 (file)
@@ -74,27 +74,32 @@ public:
     virtual HRESULT STDMETHODCALLTYPE GetPlatform(CorDebugPlatform * pPlatform)
     {
         ULONG platformKind = g_targetMachine->GetPlatform();
-#ifdef FEATURE_PAL        
-        if(platformKind == IMAGE_FILE_MACHINE_I386)
-            *pPlatform = CORDB_PLATFORM_POSIX_X86;
-        else if(platformKind == IMAGE_FILE_MACHINE_AMD64)
-            *pPlatform = CORDB_PLATFORM_POSIX_AMD64;
-        else if(platformKind == IMAGE_FILE_MACHINE_ARMNT)
-            *pPlatform = CORDB_PLATFORM_POSIX_ARM;
-        else
-            return E_FAIL;
-#else
-        if(platformKind == IMAGE_FILE_MACHINE_I386)
-            *pPlatform = CORDB_PLATFORM_WINDOWS_X86;
-        else if(platformKind == IMAGE_FILE_MACHINE_AMD64)
-            *pPlatform = CORDB_PLATFORM_WINDOWS_AMD64;
-        else if(platformKind == IMAGE_FILE_MACHINE_ARMNT)
-            *pPlatform = CORDB_PLATFORM_WINDOWS_ARM;
-        else if(platformKind == IMAGE_FILE_MACHINE_ARM64)
-            *pPlatform = CORDB_PLATFORM_WINDOWS_ARM64;
+        if (IsWindowsTarget())
+        {
+            if (platformKind == IMAGE_FILE_MACHINE_I386)
+                *pPlatform = CORDB_PLATFORM_WINDOWS_X86;
+            else if (platformKind == IMAGE_FILE_MACHINE_AMD64)
+                *pPlatform = CORDB_PLATFORM_WINDOWS_AMD64;
+            else if (platformKind == IMAGE_FILE_MACHINE_ARMNT)
+                *pPlatform = CORDB_PLATFORM_WINDOWS_ARM;
+            else if (platformKind == IMAGE_FILE_MACHINE_ARM64)
+                *pPlatform = CORDB_PLATFORM_WINDOWS_ARM64;
+            else
+                return E_FAIL;
+        }
         else
-            return E_FAIL;        
-#endif        
+        {
+            if (platformKind == IMAGE_FILE_MACHINE_I386)
+                *pPlatform = CORDB_PLATFORM_POSIX_X86;
+            else if (platformKind == IMAGE_FILE_MACHINE_AMD64)
+                *pPlatform = CORDB_PLATFORM_POSIX_AMD64;
+            else if (platformKind == IMAGE_FILE_MACHINE_ARMNT)
+                *pPlatform = CORDB_PLATFORM_POSIX_ARM;
+            else if (platformKind == IMAGE_FILE_MACHINE_ARM64)
+                *pPlatform = CORDB_PLATFORM_POSIX_ARM64;
+            else
+                return E_FAIL;
+        }
     
         return S_OK;
     }
index 940863c20d370b4900d1ab9ac01b17f60719b6b5..2645bf983f209041c86caba9a9564a31bb6ff318 100644 (file)
@@ -477,7 +477,7 @@ HRESULT Runtime::GetCorDebugInterface(ICorDebugProcess** ppCorDebugProcess)
         skuId = CLR_ID_V4_DESKTOP;
     }
 #endif
-    CLRDebuggingImpl* pDebuggingImpl = new CLRDebuggingImpl(skuId);
+    CLRDebuggingImpl* pDebuggingImpl = new CLRDebuggingImpl(skuId, IsWindowsTarget());
     hr = pDebuggingImpl->QueryInterface(IID_ICLRDebugging, (LPVOID *)&pClrDebugging);
     if (FAILED(hr))
     {
index 828cbfeefa1e4170627805973583a8dc71b2defe..f23d25d24d5165087a362660daa5c3860d035d7f 100644 (file)
@@ -423,192 +423,197 @@ HRESULT CLRDebuggingImpl::GetCLRInfo(ICorDebugDataTarget* pDataTarget,
                                      DWORD  dwDacNameCharCount)
 {
 #ifndef FEATURE_PAL
-    WORD imageFileMachine = 0;
-    DWORD resourceSectionRVA = 0;
-    HRESULT hr = GetMachineAndResourceSectionRVA(pDataTarget, moduleBaseAddress, &imageFileMachine, &resourceSectionRVA);
-
-    // We want the version resource which has type = RT_VERSION = 16, name = 1, language = 0x409
-    DWORD versionResourceRVA = 0;
-    DWORD versionResourceSize = 0;
-    if(SUCCEEDED(hr))
+    if (m_isWindowsTarget)
     {
-        hr = GetResourceRvaFromResourceSectionRva(pDataTarget, moduleBaseAddress, resourceSectionRVA, 16, 1, 0x409,
-                 &versionResourceRVA, &versionResourceSize);
-    }
+        WORD imageFileMachine = 0;
+        DWORD resourceSectionRVA = 0;
+        HRESULT hr = GetMachineAndResourceSectionRVA(pDataTarget, moduleBaseAddress, &imageFileMachine, &resourceSectionRVA);
 
-    // At last we get our version info
-    VS_FIXEDFILEINFO fixedFileInfo = {0};
-    if(SUCCEEDED(hr))
-    {
-        // The version resource has 3 words, then the unicode string "VS_VERSION_INFO"
-        // (16 WCHARS including the null terminator) 
-        // then padding to a 32-bit boundary, then the VS_FIXEDFILEINFO struct
-        DWORD fixedFileInfoRVA = ((versionResourceRVA + 3*2 + 16*2 + 3)/4)*4;
-        hr = ReadFromDataTarget(pDataTarget, moduleBaseAddress + fixedFileInfoRVA, (BYTE*)&fixedFileInfo, sizeof(fixedFileInfo));
-    }
+        // We want the version resource which has type = RT_VERSION = 16, name = 1, language = 0x409
+        DWORD versionResourceRVA = 0;
+        DWORD versionResourceSize = 0;
+        if(SUCCEEDED(hr))
+        {
+            hr = GetResourceRvaFromResourceSectionRva(pDataTarget, moduleBaseAddress, resourceSectionRVA, 16, 1, 0x409,
+                     &versionResourceRVA, &versionResourceSize);
+        }
 
-    //Verify the signature on the version resource
-    if(SUCCEEDED(hr) && fixedFileInfo.dwSignature != PE_FIXEDFILEINFO_SIGNATURE)
-    {
-        hr = CORDBG_E_NOT_CLR;
-    }
+        // At last we get our version info
+        VS_FIXEDFILEINFO fixedFileInfo = {0};
+        if(SUCCEEDED(hr))
+        {
+            // The version resource has 3 words, then the unicode string "VS_VERSION_INFO"
+            // (16 WCHARS including the null terminator) 
+            // then padding to a 32-bit boundary, then the VS_FIXEDFILEINFO struct
+            DWORD fixedFileInfoRVA = ((versionResourceRVA + 3*2 + 16*2 + 3)/4)*4;
+            hr = ReadFromDataTarget(pDataTarget, moduleBaseAddress + fixedFileInfoRVA, (BYTE*)&fixedFileInfo, sizeof(fixedFileInfo));
+        }
 
-    // Record the version information
-    if(SUCCEEDED(hr))
-    {
-        pVersion->wMajor = (WORD) (fixedFileInfo.dwProductVersionMS >> 16);
-        pVersion->wMinor = (WORD) (fixedFileInfo.dwProductVersionMS & 0xFFFF);
-        pVersion->wBuild = (WORD) (fixedFileInfo.dwProductVersionLS >> 16);
-        pVersion->wRevision = (WORD) (fixedFileInfo.dwProductVersionLS & 0xFFFF);
-    }
+        //Verify the signature on the version resource
+        if(SUCCEEDED(hr) && fixedFileInfo.dwSignature != PE_FIXEDFILEINFO_SIGNATURE)
+        {
+            hr = CORDBG_E_NOT_CLR;
+        }
 
-    // Now grab the special clr debug info resource
-    // We may need to scan a few different names searching though...
-    // 1) CLRDEBUGINFO<host_os><host_arch> where host_os = 'WINDOWS' or 'CORESYS' and host_arch = 'X86' or 'ARM' or 'AMD64'
-    // 2) For back-compat if the host os is windows and the host architecture matches the target then CLRDEBUGINFO is used with no suffix.
-    DWORD debugResourceRVA = 0;
-    DWORD debugResourceSize = 0;
-    BOOL useCrossPlatformNaming = FALSE;
-    if(SUCCEEDED(hr))
-    {
-        // the initial state is that we haven't found a proper resource
-        HRESULT hrGetResource = E_FAIL; 
+        // Record the version information
+        if(SUCCEEDED(hr))
+        {
+            pVersion->wMajor = (WORD) (fixedFileInfo.dwProductVersionMS >> 16);
+            pVersion->wMinor = (WORD) (fixedFileInfo.dwProductVersionMS & 0xFFFF);
+            pVersion->wBuild = (WORD) (fixedFileInfo.dwProductVersionLS >> 16);
+            pVersion->wRevision = (WORD) (fixedFileInfo.dwProductVersionLS & 0xFFFF);
+        }
+
+        // Now grab the special clr debug info resource
+        // We may need to scan a few different names searching though...
+        // 1) CLRDEBUGINFO<host_os><host_arch> where host_os = 'WINDOWS' or 'CORESYS' and host_arch = 'X86' or 'ARM' or 'AMD64'
+        // 2) For back-compat if the host os is windows and the host architecture matches the target then CLRDEBUGINFO is used with no suffix.
+        DWORD debugResourceRVA = 0;
+        DWORD debugResourceSize = 0;
+        BOOL useCrossPlatformNaming = FALSE;
+        if(SUCCEEDED(hr))
+        {
+            // the initial state is that we haven't found a proper resource
+            HRESULT hrGetResource = E_FAIL; 
      
-        // First check for the resource which has type = RC_DATA = 10, name = "CLRDEBUGINFO<host_os><host_arch>", language = 0        
-#if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_X86_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSX86");
-#endif
+            // First check for the resource which has type = RC_DATA = 10, name = "CLRDEBUGINFO<host_os><host_arch>", language = 0        
+    #if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_X86_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSX86");
+    #endif
 
-#if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_X86_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSX86");
-#endif
+    #if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_X86_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSX86");
+    #endif
 
-#if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_AMD64_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSAMD64");
-#endif
+    #if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_AMD64_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSAMD64");
+    #endif
 
-#if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_AMD64_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSAMD64");
-#endif
+    #if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_AMD64_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSAMD64");
+    #endif
 
-#if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM64_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSARM64");
-#endif
+    #if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM64_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSARM64");
+    #endif
 
-#if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM64_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSARM64");
-#endif
+    #if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM64_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSARM64");
+    #endif
 
-#if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSARM");
-#endif
+    #if defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOWINDOWSARM");
+    #endif
 
-#if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM_)
-        const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSARM");
-#endif        
+    #if !defined (HOST_IS_WINDOWS_OS) && defined(_HOST_ARM_)
+            const WCHAR * resourceName = W("CLRDEBUGINFOCORESYSARM");
+    #endif        
 
-        hrGetResource = GetResourceRvaFromResourceSectionRvaByName(pDataTarget, moduleBaseAddress, resourceSectionRVA, 10, resourceName, 0,
-                 &debugResourceRVA, &debugResourceSize);
-        useCrossPlatformNaming = SUCCEEDED(hrGetResource);        
+            hrGetResource = GetResourceRvaFromResourceSectionRvaByName(pDataTarget, moduleBaseAddress, resourceSectionRVA, 10, resourceName, 0,
+                     &debugResourceRVA, &debugResourceSize);
+            useCrossPlatformNaming = SUCCEEDED(hrGetResource);        
 
         
-#if defined(HOST_IS_WINDOWS_OS) && (defined(_HOST_X86_) || defined(_HOST_AMD64_) || defined(_HOST_ARM_))
-  #if defined(_HOST_X86_)
-    #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_I386
-  #elif defined(_HOST_AMD64_)
-    #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_AMD64
-  #elif defined(_HOST_ARM_)
-    #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_ARMNT
-  #endif
-
-        // if this is windows, and if host_arch matches target arch then we can fallback to searching for CLRDEBUGINFO on failure
-        if(FAILED(hrGetResource) && (imageFileMachine == _HOST_MACHINE_TYPE))
-        {
-            hrGetResource = GetResourceRvaFromResourceSectionRvaByName(pDataTarget, moduleBaseAddress, resourceSectionRVA, 10, W("CLRDEBUGINFO"), 0,
-                 &debugResourceRVA, &debugResourceSize);
+    #if defined(HOST_IS_WINDOWS_OS) && (defined(_HOST_X86_) || defined(_HOST_AMD64_) || defined(_HOST_ARM_))
+      #if defined(_HOST_X86_)
+        #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_I386
+      #elif defined(_HOST_AMD64_)
+        #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_AMD64
+      #elif defined(_HOST_ARM_)
+        #define _HOST_MACHINE_TYPE IMAGE_FILE_MACHINE_ARMNT
+      #endif
+
+            // if this is windows, and if host_arch matches target arch then we can fallback to searching for CLRDEBUGINFO on failure
+            if(FAILED(hrGetResource) && (imageFileMachine == _HOST_MACHINE_TYPE))
+            {
+                hrGetResource = GetResourceRvaFromResourceSectionRvaByName(pDataTarget, moduleBaseAddress, resourceSectionRVA, 10, W("CLRDEBUGINFO"), 0,
+                     &debugResourceRVA, &debugResourceSize);
+            }
+
+      #undef _HOST_MACHINE_TYPE
+    #endif
+            // if the search failed, we don't recognize the CLR
+            if(FAILED(hrGetResource))
+                hr = CORDBG_E_NOT_CLR;
         }
 
-  #undef _HOST_MACHINE_TYPE
-#endif
-        // if the search failed, we don't recognize the CLR
-        if(FAILED(hrGetResource))
+        CLR_DEBUG_RESOURCE debugResource;
+        if(SUCCEEDED(hr) && debugResourceSize != sizeof(debugResource))
+        {
             hr = CORDBG_E_NOT_CLR;
-    }
-
-    CLR_DEBUG_RESOURCE debugResource;
-    if(SUCCEEDED(hr) && debugResourceSize != sizeof(debugResource))
-    {
-        hr = CORDBG_E_NOT_CLR;
-    }
+        }
 
-    // Get the special debug resource from the image and return the results
-    if(SUCCEEDED(hr))
-    {
-        hr = ReadFromDataTarget(pDataTarget, moduleBaseAddress + debugResourceRVA, (BYTE*)&debugResource, sizeof(debugResource));
-    }
-    if(SUCCEEDED(hr) && (debugResource.dwVersion != 0))
-    {
-        hr = CORDBG_E_NOT_CLR;
-    }
+        // Get the special debug resource from the image and return the results
+        if(SUCCEEDED(hr))
+        {
+            hr = ReadFromDataTarget(pDataTarget, moduleBaseAddress + debugResourceRVA, (BYTE*)&debugResource, sizeof(debugResource));
+        }
+        if(SUCCEEDED(hr) && (debugResource.dwVersion != 0))
+        {
+            hr = CORDBG_E_NOT_CLR;
+        }
     
-    // The signature needs to match m_skuId exactly, except for m_skuId=CLR_ID_ONECORE_CLR which is
-    // also compatible with the older CLR_ID_PHONE_CLR signature.
-    if(SUCCEEDED(hr) && 
-       (debugResource.signature != m_skuId) && 
-       !( (debugResource.signature == CLR_ID_PHONE_CLR) && (m_skuId == CLR_ID_ONECORE_CLR) ))
-    {
-        hr = CORDBG_E_NOT_CLR;
-    }
+        // The signature needs to match m_skuId exactly, except for m_skuId=CLR_ID_ONECORE_CLR which is
+        // also compatible with the older CLR_ID_PHONE_CLR signature.
+        if(SUCCEEDED(hr) && 
+           (debugResource.signature != m_skuId) && 
+           !( (debugResource.signature == CLR_ID_PHONE_CLR) && (m_skuId == CLR_ID_ONECORE_CLR) ))
+        {
+            hr = CORDBG_E_NOT_CLR;
+        }
 
-    if(SUCCEEDED(hr) &&
-       (debugResource.signature != CLR_ID_ONECORE_CLR) &&
-       useCrossPlatformNaming)
-    {
-        FormatLongDacModuleName(pDacName, dwDacNameCharCount, imageFileMachine, &fixedFileInfo);
-        swprintf_s(pDbiName, dwDbiNameCharCount, W("%s_%s.dll"), MAIN_DBI_MODULE_NAME_W, W("x86"));
-    }
-    else
-    {
-        if(m_skuId == CLR_ID_V4_DESKTOP)
-            swprintf_s(pDacName, dwDacNameCharCount, W("%s.dll"), CLR_DAC_MODULE_NAME_W);
+        if(SUCCEEDED(hr) &&
+           (debugResource.signature != CLR_ID_ONECORE_CLR) &&
+           useCrossPlatformNaming)
+        {
+            FormatLongDacModuleName(pDacName, dwDacNameCharCount, imageFileMachine, &fixedFileInfo);
+            swprintf_s(pDbiName, dwDbiNameCharCount, W("%s_%s.dll"), MAIN_DBI_MODULE_NAME_W, W("x86"));
+        }
         else
-            swprintf_s(pDacName, dwDacNameCharCount, W("%s.dll"), CORECLR_DAC_MODULE_NAME_W);
-        swprintf_s(pDbiName, dwDbiNameCharCount, W("%s.dll"), MAIN_DBI_MODULE_NAME_W);
-    }
+        {
+            if(m_skuId == CLR_ID_V4_DESKTOP)
+                swprintf_s(pDacName, dwDacNameCharCount, W("%s.dll"), CLR_DAC_MODULE_NAME_W);
+            else
+                swprintf_s(pDacName, dwDacNameCharCount, W("%s.dll"), CORECLR_DAC_MODULE_NAME_W);
+            swprintf_s(pDbiName, dwDbiNameCharCount, W("%s.dll"), MAIN_DBI_MODULE_NAME_W);
+        }
 
-    if(SUCCEEDED(hr))
-    {
-        *pdwDbiTimeStamp = debugResource.dwDbiTimeStamp;
-        *pdwDbiSizeOfImage = debugResource.dwDbiSizeOfImage;
-        *pdwDacTimeStamp = debugResource.dwDacTimeStamp;
-        *pdwDacSizeOfImage = debugResource.dwDacSizeOfImage;
-    }
+        if(SUCCEEDED(hr))
+        {
+            *pdwDbiTimeStamp = debugResource.dwDbiTimeStamp;
+            *pdwDbiSizeOfImage = debugResource.dwDbiSizeOfImage;
+            *pdwDacTimeStamp = debugResource.dwDacTimeStamp;
+            *pdwDacSizeOfImage = debugResource.dwDacSizeOfImage;
+        }
 
-    // any failure should be interpreted as this module not being a CLR
-    if(FAILED(hr))
-    {
-        return CORDBG_E_NOT_CLR;
+        // any failure should be interpreted as this module not being a CLR
+        if(FAILED(hr))
+        {
+            return CORDBG_E_NOT_CLR;
+        }
+        else
+        {
+            return S_OK;
+        }
     }
     else
+#endif // FEATURE_PAL
     {
-        return S_OK;
-    }
-#else
-    swprintf_s(pDacName, dwDacNameCharCount, W("%s"), MAKEDLLNAME_W(CORECLR_DAC_MODULE_NAME_W));
-    swprintf_s(pDbiName, dwDbiNameCharCount, W("%s"), MAKEDLLNAME_W(MAIN_DBI_MODULE_NAME_W));
+        swprintf_s(pDacName, dwDacNameCharCount, W("%s"), MAKEDLLNAME_W(CORECLR_DAC_MODULE_NAME_W));
+        swprintf_s(pDbiName, dwDbiNameCharCount, W("%s"), MAKEDLLNAME_W(MAIN_DBI_MODULE_NAME_W));
 
-    pVersion->wMajor = 0;
-    pVersion->wMinor = 0;
-    pVersion->wBuild = 0;
-    pVersion->wRevision = 0;
+        pVersion->wMajor = 0;
+        pVersion->wMinor = 0;
+        pVersion->wBuild = 0;
+        pVersion->wRevision = 0;
 
-    *pdwDbiTimeStamp = 0;
-    *pdwDbiSizeOfImage = 0;
-    *pdwDacTimeStamp = 0;
-    *pdwDacSizeOfImage = 0;
+        *pdwDbiTimeStamp = 0;
+        *pdwDbiSizeOfImage = 0;
+        *pdwDacTimeStamp = 0;
+        *pdwDacSizeOfImage = 0;
 
-    return S_OK;
-#endif // FEATURE_PAL
+        return S_OK;
+    }
 }
 
 // Formats the long name for DAC
index c1d91738796324196747f90e0158c203a6c5683c..7ba42bc37e459476ec0c8216de9fc2b378ed9147 100644 (file)
@@ -28,7 +28,7 @@ class CLRDebuggingImpl : public ICLRDebugging
 {
 
 public:
-    CLRDebuggingImpl(GUID skuId) : m_cRef(0), m_skuId(skuId)
+    CLRDebuggingImpl(GUID skuId, bool isWindowsTarget) : m_cRef(0), m_skuId(skuId), m_isWindowsTarget(isWindowsTarget)
     {
     }
 
@@ -84,6 +84,7 @@ private:
 
        volatile LONG m_cRef;
     GUID m_skuId;
+    bool m_isWindowsTarget;
 
 };  // class CLRDebuggingImpl
 
index f01feec475a26060dda81bb7c6ce77816e59ea3a..91b54c4dc424e9778fcdc0957a0d3d5d54571bc7 100644 (file)
@@ -219,6 +219,15 @@ namespace Microsoft.Diagnostics.Tools.Dump
             return runtime;
         }
 
+        private string GetPlatformDacFileName(string dacFileName)
+        {
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+            {
+                return dacFileName.Replace("libmscordaccore.so", "mscordaccore.dll");
+            }
+            return dacFileName;
+        }
+
         private string GetDacFile(ClrInfo clrInfo)
         {
             if (_dacFilePath == null)
@@ -228,7 +237,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
                 string dacFilePath = null;
                 if (!string.IsNullOrEmpty(analyzeContext.RuntimeModuleDirectory))
                 {
-                    dacFilePath = Path.Combine(analyzeContext.RuntimeModuleDirectory, clrInfo.DacInfo.FileName);
+                    dacFilePath = Path.Combine(analyzeContext.RuntimeModuleDirectory, GetPlatformDacFileName(clrInfo.DacInfo.FileName));
                     if (File.Exists(dacFilePath))
                     {
                         _dacFilePath = dacFilePath;
@@ -236,14 +245,14 @@ namespace Microsoft.Diagnostics.Tools.Dump
                 }
                 if (_dacFilePath == null)
                 {
-                    dacFilePath = clrInfo.LocalMatchingDac;
+                    dacFilePath = GetPlatformDacFileName(clrInfo.LocalMatchingDac);
                     if (!string.IsNullOrEmpty(dacFilePath) && File.Exists(dacFilePath))
                     {
                         _dacFilePath = dacFilePath;
                     }
                     else if (SymbolReader.IsSymbolStoreEnabled())
                     {
-                        string dacFileName = Path.GetFileName(dacFilePath ?? clrInfo.DacInfo.FileName);
+                        string dacFileName = Path.GetFileName(dacFilePath ?? GetPlatformDacFileName(clrInfo.DacInfo.FileName));
                         if (dacFileName != null)
                         {
                             SymbolStoreKey key = null;