From: Mike McLaughlin Date: Fri, 23 Apr 2021 23:05:02 +0000 (-0700) Subject: Single file fixes (#2210) X-Git-Tag: submit/tizen/20210909.063632~15^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43606ec8fe37bdfce3cf03d5cb8c8b6005185191;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Single file fixes (#2210) * Fix single-file source/line # lookup * Make index timestamp/file size hex * Fix Windows single-file; use regular DAC file name --- diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs index d6396c688..9858a75b0 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Runtime.cs @@ -133,15 +133,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation private string GetDacFileName() { - Debug.Assert(!string.IsNullOrEmpty(_clrInfo.DacInfo.PlatformSpecificFileName)); - string name = _clrInfo.DacInfo.PlatformSpecificFileName; - - // If this is the Linux runtime module name, but we are running on Windows return the cross-OS DAC name. - if (_target.OperatingSystem == OSPlatform.Linux && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - name = "mscordaccore.dll"; - } - return name; + return ClrInfoProvider.GetDacFileName(_clrInfo.Flavor, _target.OperatingSystem); } private string GetLocalDacPath(string dacFileName) diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/ModulesCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/ModulesCommand.cs index 2e260d549..3b1473673 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/ModulesCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/ModulesCommand.cs @@ -30,8 +30,8 @@ namespace Microsoft.Diagnostics.ExtensionCommands WriteLine(" IsPEImage: {0}", module.IsPEImage); WriteLine(" IsManaged: {0}", module.IsManaged); WriteLine(" IsFileLayout: {0}", module.IsFileLayout?.ToString() ?? ""); - WriteLine(" IndexFileSize: {0:X8}", module.IndexFileSize?.ToString() ?? ""); - WriteLine(" IndexTimeStamp: {0:X8}", module.IndexTimeStamp?.ToString() ?? ""); + WriteLine(" IndexFileSize: {0}", module.IndexFileSize?.ToString("X8") ?? ""); + WriteLine(" IndexTimeStamp: {0}", module.IndexTimeStamp?.ToString("X8") ?? ""); WriteLine(" Version: {0}", module.Version?.ToString() ?? ""); string versionString = module.VersionString; if (!string.IsNullOrEmpty(versionString)) { diff --git a/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs b/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs index 9dd207e5e..9d0a10d42 100644 --- a/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs +++ b/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs @@ -318,7 +318,7 @@ namespace SOS.Hosting /// Checks availability of debugging information for given assembly. /// /// - /// File path of the assembly or null if the module is in-memory or dynamic (generated by Reflection.Emit) + /// File path of the assembly or null /// /// type of in-memory PE layout, if true, file based layout otherwise, loaded layout /// @@ -1061,7 +1061,7 @@ namespace SOS.Hosting [UnmanagedFunctionPointer(CallingConvention.Winapi)] private delegate IntPtr LoadSymbolsForModuleDelegate( [In] IntPtr self, - [In] string assemblyPath, + [In, MarshalAs(UnmanagedType.LPWStr)] string assemblyPath, [In] bool isFileLayout, [In] ulong loadedPeAddress, [In] uint loadedPeSize, diff --git a/src/SOS/Strike/symbols.cpp b/src/SOS/Strike/symbols.cpp index 922ac45b7..c0633d7d3 100644 --- a/src/SOS/Strike/symbols.cpp +++ b/src/SOS/Strike/symbols.cpp @@ -516,19 +516,8 @@ HRESULT SymbolReader::LoadSymbolsForPortablePDB(__in_z WCHAR* pModuleName, ___in HRESULT Status = S_OK; IfFailRet(InitializeSymbolService()); - // The module name needs to be null for in-memory PE's. - ArrayHolder szModuleName = nullptr; - if (!isInMemory && pModuleName != nullptr) - { - szModuleName = new char[MAX_LONGPATH]; - if (WideCharToMultiByte(CP_ACP, 0, pModuleName, (int)(_wcslen(pModuleName) + 1), szModuleName, MAX_LONGPATH, NULL, NULL) == 0) - { - return E_FAIL; - } - } - m_symbolReaderHandle = GetSymbolService()->LoadSymbolsForModule( - szModuleName, isFileLayout, peAddress, (int)peSize, inMemoryPdbAddress, (int)inMemoryPdbSize); + pModuleName, isFileLayout, peAddress, (int)peSize, inMemoryPdbAddress, (int)inMemoryPdbSize); if (m_symbolReaderHandle == 0) { diff --git a/src/SOS/inc/symbolservice.h b/src/SOS/inc/symbolservice.h index b02b0e01b..9295f7db7 100644 --- a/src/SOS/inc/symbolservice.h +++ b/src/SOS/inc/symbolservice.h @@ -60,7 +60,7 @@ public: const unsigned char* moduleIndex) = 0; virtual PVOID STDMETHODCALLTYPE LoadSymbolsForModule( - const char*, + LPCWSTR, BOOL, ULONG64, int,