From: Mike McLaughlin Date: Fri, 31 May 2024 17:21:16 +0000 (-0700) Subject: Remove the symweb symbol server support (#4694) X-Git-Tag: accepted/tizen/unified/20241231.014852~40^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=481674f73f11e8096f48820ae133d98c88d64a14;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Remove the symweb symbol server support (#4694) Removes the dotnet-symbol --internal-server option. Use the --authenticated-server-path option instead. Removes the internal server/symweb options from the setsymbolserver command and ISymbolService interface. --- diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs index 4b5ad2b9b..4ed23f806 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs @@ -32,7 +32,6 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation /// Symbol server URLs /// public const string MsdlSymbolServer = "https://msdl.microsoft.com/download/symbols/"; - public const string SymwebSymbolServer = "https://symweb/"; private readonly IHost _host; private string _defaultSymbolCache; @@ -58,9 +57,13 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation /// public bool IsSymbolStoreEnabled => _symbolStore != null; + /// + /// The default symbol server URL (normally msdl) when not overridden in AddSymbolServer. + /// + public string DefaultSymbolPath { get; set; } = MsdlSymbolServer; + /// /// The default symbol cache path: - /// /// * dbgeng on Windows uses the dbgeng symbol cache path: %PROGRAMDATA%\dbg\sym /// * dotnet-dump on Windows uses the VS symbol cache path: %TEMPDIR%\SymbolCache /// * dotnet-dump/lldb on Linux/MacOS uses: $HOME/.dotnet/symbolcache @@ -204,7 +207,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation } if (symbolServerPath != null) { - if (!AddSymbolServer(msdl: false, symweb: false, symbolServerPath.Trim())) + if (!AddSymbolServer(symbolServerPath: symbolServerPath.Trim())) { return false; } @@ -226,47 +229,19 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation /// /// Add symbol server to search path. /// - /// if true, use the public Microsoft server - /// if true, use symweb internal server and protocol (file.ptr) - /// symbol server url (optional) + /// symbol server url (optional, uses if null) /// PAT for secure symbol server (optional) /// symbol server timeout in minutes (optional uses if null) /// number of retries (optional uses if null) /// if false, failure public bool AddSymbolServer( - bool msdl, - bool symweb, string symbolServerPath = null, string authToken = null, int? timeoutInMinutes = null, int? retryCount = null) { - bool internalServer = false; - // Add symbol server URL if exists - if (symbolServerPath == null) - { - if (msdl) - { - symbolServerPath = MsdlSymbolServer; - } - else if (symweb) - { - symbolServerPath = SymwebSymbolServer; - internalServer = true; - } - } - else - { - // Use the internal symbol store for symweb - internalServer = symbolServerPath.Contains("symweb"); - } - - // Return error if symbol server path is null and msdl and symweb are false. - if (symbolServerPath == null) - { - return false; - } + symbolServerPath ??= DefaultSymbolPath; // Validate symbol server path if (!Uri.TryCreate(symbolServerPath.TrimEnd('/') + '/', UriKind.Absolute, out Uri uri)) @@ -285,15 +260,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation if (!IsDuplicateSymbolStore(store, (httpSymbolStore) => uri.Equals(httpSymbolStore.Uri))) { // Create http symbol server store - HttpSymbolStore httpSymbolStore; - if (internalServer) - { - httpSymbolStore = new SymwebHttpSymbolStore(Tracer.Instance, store, uri); - } - else - { - httpSymbolStore = new HttpSymbolStore(Tracer.Instance, store, uri, personalAccessToken: authToken); - } + HttpSymbolStore httpSymbolStore = new(Tracer.Instance, store, uri, personalAccessToken: authToken); httpSymbolStore.Timeout = TimeSpan.FromMinutes(timeoutInMinutes.GetValueOrDefault(DefaultTimeout)); httpSymbolStore.RetryCount = retryCount.GetValueOrDefault(DefaultRetryCount); SetSymbolStore(httpSymbolStore); diff --git a/src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs b/src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs index 13e66f4a6..b32b19cde 100644 --- a/src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs +++ b/src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs @@ -18,24 +18,28 @@ namespace Microsoft.Diagnostics.DebugServices /// bool IsSymbolStoreEnabled { get; } + /// + /// The default symbol server URL (normally msdl) when not overridden in AddSymbolServer. + /// + string DefaultSymbolPath { get; } + /// /// The default symbol cache path: - /// /// * dbgeng on Windows uses the dbgeng symbol cache path: %PROGRAMDATA%\dbg\sym /// * dotnet-dump on Windows uses the VS symbol cache path: %TEMPDIR%\SymbolCache /// * dotnet-dump/lldb on Linux/MacOS uses: $HOME/.dotnet/symbolcache /// - string DefaultSymbolCache { get; set; } + string DefaultSymbolCache { get; } /// /// The time out in minutes passed to the HTTP symbol store when not overridden in AddSymbolServer. /// - int DefaultTimeout { get; set; } + int DefaultTimeout { get; } /// /// The retry count passed to the HTTP symbol store when not overridden in AddSymbolServer. /// - int DefaultRetryCount { get; set; } + int DefaultRetryCount { get; } /// /// Reset any HTTP symbol stores marked with a client failure @@ -52,14 +56,12 @@ namespace Microsoft.Diagnostics.DebugServices /// /// Add symbol server to search path. /// - /// if true, use the public Microsoft server - /// if true, use symweb internal server and protocol (file.ptr) - /// symbol server url (optional) + /// symbol server url (optional, uses if null) /// PAT for secure symbol server (optional) - /// symbol server timeout in minutes (optional uses if null) - /// number of retries (optional uses if null) + /// symbol server timeout in minutes (optional, uses if null) + /// number of retries (optional, uses if null) /// if false, failure - bool AddSymbolServer(bool msdl, bool symweb, string symbolServerPath = null, string authToken = null, int? timeoutInMinutes = null, int? retryCount = null); + bool AddSymbolServer(string symbolServerPath = null, string authToken = null, int? timeoutInMinutes = null, int? retryCount = null); /// /// Add cache path to symbol search path diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs index fe9ebc59e..3d165d44e 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs @@ -18,9 +18,6 @@ namespace Microsoft.Diagnostics.ExtensionCommands [Option(Name = "--ms", Aliases = new string[] { "-ms" }, Help = "Use the public Microsoft symbol server.")] public bool MicrosoftSymbolServer { get; set; } - [Option(Name = "--mi", Aliases = new string[] { "-mi" }, Help = "Use the internal symweb symbol server.")] - public bool InternalSymbolServer { get; set; } - [Option(Name = "--disable", Aliases = new string[] { "-disable" }, Help = "Clear or disable symbol download support.")] public bool Disable { get; set; } @@ -50,13 +47,9 @@ namespace Microsoft.Diagnostics.ExtensionCommands public override void Invoke() { - if (MicrosoftSymbolServer && InternalSymbolServer) - { - throw new DiagnosticsException("Cannot have both -ms and -mi options"); - } - if ((MicrosoftSymbolServer || InternalSymbolServer) && !string.IsNullOrEmpty(SymbolServerUrl)) + if (MicrosoftSymbolServer && !string.IsNullOrEmpty(SymbolServerUrl)) { - throw new DiagnosticsException("Cannot have -ms or -mi option and a symbol server path"); + throw new DiagnosticsException("Cannot have -ms option and a symbol server path"); } if (Disable) { @@ -66,13 +59,13 @@ namespace Microsoft.Diagnostics.ExtensionCommands { SymbolService.Reset(); } - if (MicrosoftSymbolServer || InternalSymbolServer || !string.IsNullOrEmpty(SymbolServerUrl)) + if (MicrosoftSymbolServer || !string.IsNullOrEmpty(SymbolServerUrl)) { if (string.IsNullOrEmpty(Cache)) { Cache = SymbolService.DefaultSymbolCache; } - SymbolService.AddSymbolServer(MicrosoftSymbolServer, InternalSymbolServer, SymbolServerUrl, AccessToken, Timeout, RetryCount); + SymbolService.AddSymbolServer(SymbolServerUrl, AccessToken, Timeout, RetryCount); } if (!string.IsNullOrEmpty(Cache)) { diff --git a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDump.cs b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDump.cs index 0f24d1927..738320ee8 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDump.cs +++ b/src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDump.cs @@ -41,7 +41,7 @@ namespace Microsoft.Diagnostics.TestHelpers _serviceContainer.AddService(_symbolService); // Automatically enable symbol server support - _symbolService.AddSymbolServer(msdl: true, symweb: false, timeoutInMinutes: 6, retryCount: 5); + _symbolService.AddSymbolServer(timeoutInMinutes: 6, retryCount: 5); _symbolService.AddCachePath(_symbolService.DefaultSymbolCache); } diff --git a/src/Microsoft.SymbolStore/SymbolStores/SymwebSymbolStore.cs b/src/Microsoft.SymbolStore/SymbolStores/SymwebSymbolStore.cs index 858ea96fd..10a7820de 100644 --- a/src/Microsoft.SymbolStore/SymbolStores/SymwebSymbolStore.cs +++ b/src/Microsoft.SymbolStore/SymbolStores/SymwebSymbolStore.cs @@ -11,6 +11,7 @@ namespace Microsoft.SymbolStore.SymbolStores /// /// The symbol store for the internal symweb symbol server that handles the "file.ptr" support. /// + [Obsolete] public sealed class SymwebHttpSymbolStore : HttpSymbolStore { /// diff --git a/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs b/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs index 94ac022fd..1c9e37bae 100644 --- a/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs +++ b/src/SOS/SOS.Hosting/SymbolServiceWrapper.cs @@ -335,56 +335,11 @@ namespace SOS.Hosting #region Symbol service delegates - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate bool IsSymbolStoreEnabledDelegate( - [In] IntPtr self); - - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate bool InitializeSymbolStoreDelegate( - [In] IntPtr self, - [In] bool msdl, - [In] bool symweb, - [In] string symbolServerPath, - [In] string authToken, - [In] int timeoutInMinutes, - [In] string symbolCachePath, - [In] string symbolDirectoryPath); - [UnmanagedFunctionPointer(CallingConvention.Winapi)] private delegate bool ParseSymbolPathDelegate( [In] IntPtr self, [In] string windowsSymbolPath); - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate void DisplaySymbolStoreDelegate( - [In] IntPtr self, - [In] WriteLine writeLine); - - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate void DisableSymbolStoreDelegate( - [In] IntPtr self); - - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate void LoadNativeSymbolsDelegate( - [In] IntPtr self, - [In] SymbolFileCallback callback, - [In] IntPtr parameter, - [In] RuntimeConfiguration config, - [In] string moduleFilePath, - [In] ulong address, - [In] uint size); - - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - private delegate void LoadNativeSymbolsFromIndexDelegate( - [In] IntPtr self, - [In] SymbolFileCallback callback, - [In] IntPtr parameter, - [In] RuntimeConfiguration config, - [In] string moduleFilePath, - [In] bool specialKeys, - [In] int moduleIndexSize, - [In] IntPtr moduleIndex); - [UnmanagedFunctionPointer(CallingConvention.Winapi)] private delegate IntPtr LoadSymbolsForModuleDelegate( [In] IntPtr self, diff --git a/src/Tools/dotnet-dump/Analyzer.cs b/src/Tools/dotnet-dump/Analyzer.cs index 55b0abc93..0fa51a64b 100644 --- a/src/Tools/dotnet-dump/Analyzer.cs +++ b/src/Tools/dotnet-dump/Analyzer.cs @@ -127,7 +127,7 @@ namespace Microsoft.Diagnostics.Tools.Dump contextService.SetCurrentTarget(target); // Automatically enable symbol server support, default cache and search for symbols in the dump directory - symbolService.AddSymbolServer(msdl: true, symweb: false, retryCount: 3); + symbolService.AddSymbolServer(retryCount: 3); symbolService.AddCachePath(symbolService.DefaultSymbolCache); symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName)); diff --git a/src/Tools/dotnet-symbol/Program.cs b/src/Tools/dotnet-symbol/Program.cs index 19a9bbebe..d7f7e0a21 100644 --- a/src/Tools/dotnet-symbol/Program.cs +++ b/src/Tools/dotnet-symbol/Program.cs @@ -25,7 +25,6 @@ namespace Microsoft.Diagnostics.Tools.Symbol { public Uri Uri; public string PersonalAccessToken; - public bool InternalSymwebServer; } private readonly List InputFilePaths = new(); @@ -64,11 +63,6 @@ namespace Microsoft.Diagnostics.Tools.Symbol program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null }); break; - case "--internal-server": - Uri.TryCreate("https://symweb/", UriKind.Absolute, out uri); - program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null, InternalSymwebServer = true }); - break; - case "--authenticated-server-path": if (++i < args.Length) { @@ -262,14 +256,7 @@ namespace Microsoft.Diagnostics.Tools.Symbol foreach (ServerInfo server in ((IEnumerable)SymbolServers).Reverse()) { - if (server.InternalSymwebServer) - { - store = new SymwebHttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken); - } - else - { - store = new HttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken); - } + store = new HttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken); if (Timeout.HasValue && store is HttpSymbolStore http) { http.Timeout = Timeout.Value; diff --git a/src/Tools/dotnet-symbol/Properties/Resources.Designer.cs b/src/Tools/dotnet-symbol/Properties/Resources.Designer.cs index ef6e9daad..ebb37423f 100644 --- a/src/Tools/dotnet-symbol/Properties/Resources.Designer.cs +++ b/src/Tools/dotnet-symbol/Properties/Resources.Designer.cs @@ -113,9 +113,10 @@ namespace Microsoft.Diagnostic.Tools.Symbol.Properties { /// ///Options: /// --microsoft-symbol-server Add 'https://msdl.microsoft.com/download/symbols' symbol server path (default). - /// --internal-server Add 'https://symweb' internal symbol server path. /// --server-path <symbol server path> Add a http server path. - /// --authenticated-server-path <pat> <server path> Add a http PAT authenticated s [rest of string was truncated]";. + /// --authenticated-server-path <pat> <server path> Add a http PAT authenticated server path. + /// --cache-directory <file cache directory> Add a cache directory. + /// --timeout <m [rest of string was truncated]";. /// internal static string UsageOptions { get { diff --git a/src/Tools/dotnet-symbol/Properties/Resources.resx b/src/Tools/dotnet-symbol/Properties/Resources.resx index cba536031..3ffa0a5f7 100644 --- a/src/Tools/dotnet-symbol/Properties/Resources.resx +++ b/src/Tools/dotnet-symbol/Properties/Resources.resx @@ -140,7 +140,6 @@ Arguments: Options: --microsoft-symbol-server Add 'https://msdl.microsoft.com/download/symbols' symbol server path (default). - --internal-server Add 'https://symweb' internal symbol server path. --server-path <symbol server path> Add a http server path. --authenticated-server-path <pat> <server path> Add a http PAT authenticated server path. --cache-directory <file cache directory> Add a cache directory. @@ -163,4 +162,4 @@ Options: Writing files to {0} - \ No newline at end of file + diff --git a/src/Tools/dotnet-symbol/README.md b/src/Tools/dotnet-symbol/README.md index 110c0c3ba..45d9ddbd8 100644 --- a/src/Tools/dotnet-symbol/README.md +++ b/src/Tools/dotnet-symbol/README.md @@ -9,7 +9,6 @@ This tool can download all the files needed for debugging (symbols, modules, SOS Options: --microsoft-symbol-server Add 'https://msdl.microsoft.com/download/symbols' symbol server path (default). - --internal-server Add 'https://symweb' internal symbol server path. --server-path Add a http server path. --authenticated-server-path Add a http PAT authenticated server path. --cache-directory Add a cache directory. @@ -45,7 +44,7 @@ This downloads just the host program needed to load a core dump on Linux or macO To download the symbol files for a specific assembly: - dotnet-symbol --symbols --cache-directory c:\temp\symcache --server-path https://symweb --output c:\temp\symout System.Threading.dll + dotnet-symbol --symbols --cache-directory c:\temp\symcache --server-path https://msdl.microsoft.com/download/symbols --output c:\temp\symout System.Threading.dll Downloads all the symbol files for the shared runtime: diff --git a/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs b/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs index a1c54f93d..d4c0ea3cd 100644 --- a/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs +++ b/src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs @@ -482,7 +482,7 @@ namespace SOS.Hosting if (_symbolService is null) { _symbolService = new SymbolService(this); - _symbolService.AddSymbolServer(msdl: true, symweb: false, timeoutInMinutes: 6, retryCount: 5); + _symbolService.AddSymbolServer(timeoutInMinutes: 6, retryCount: 5); _symbolService.AddCachePath(SymbolService.DefaultSymbolCache); } return _symbolService; diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs index e4fad3d54..fd63cea35 100644 --- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs +++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs @@ -55,8 +55,8 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests Assert.Equal(defaultPath, symbolService.FormatSymbolStores()); symbolService.DisableSymbolStore(); - Assert.True(symbolService.ParseSymbolPath($"srv*{localSymbolCache}*{SymbolService.SymwebSymbolServer}")); - string testpath1 = $"Cache: {localSymbolCache} Server: {SymbolService.SymwebSymbolServer}"; + Assert.True(symbolService.ParseSymbolPath($"srv*{localSymbolCache}*https://symweb/")); + string testpath1 = $"Cache: {localSymbolCache} Server: https://symweb/"; Assert.Equal(testpath1, symbolService.FormatSymbolStores()); symbolService.DisableSymbolStore(); diff --git a/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs b/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs index e93ab2933..ee87de31d 100644 --- a/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs +++ b/src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs @@ -97,34 +97,18 @@ namespace Microsoft.SymbolStore.Tests { using (Stream compareStream = File.OpenRead("TestBinaries/dir1/System.Threading.Thread.pdb")) { - await DownloadFile(downloadStream, compareStream, ms: true, mi: false, KeyTypeFlags.SymbolKey); + await DownloadFile(downloadStream, compareStream, flags: KeyTypeFlags.SymbolKey); } } } - [Fact] - public async Task SymwebHttpSymbolStore() - { - using (FileStream downloadStream = File.OpenRead("TestBinaries/dir2/System.Threading.Thread.dll")) - { - await DownloadFile(downloadStream, downloadStream, ms: false, mi: true, KeyTypeFlags.IdentityKey); - } - } - - private async Task DownloadFile(FileStream downloadStream, Stream compareStream, bool ms, bool mi, KeyTypeFlags flags) + private async Task DownloadFile(FileStream downloadStream, Stream compareStream, KeyTypeFlags flags) { SymbolStoreFile file = new SymbolStoreFile(downloadStream, downloadStream.Name); - SymbolStores.SymbolStore store = null; - if (ms) - { - Uri.TryCreate("https://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri); - store = new HttpSymbolStore(_tracer, store, uri); - } - if (mi) - { - Uri.TryCreate("https://symweb/", UriKind.Absolute, out Uri uri); - store = new SymwebHttpSymbolStore(_tracer, store, uri); - } + + Uri.TryCreate("https://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri); + SymbolStores.SymbolStore store = new HttpSymbolStore(_tracer, backingStore: null, uri); + var generator = new FileKeyGenerator(_tracer, file); IEnumerable keys = generator.GetKeys(flags);