From: Sangwook Kim Date: Wed, 22 Apr 2020 09:01:00 +0000 (+0900) Subject: [Tizen] Search symbol directories recursively (#27) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055542~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=509a813fee1be3c5f4df41264f0981b28418357e;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git [Tizen] Search symbol directories recursively (#27) The SOS command 'setsymbolserver -directory' will automatically search all subdirectories of the specified directory. --- diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs index 4b5ad2b9b..d0abb2da0 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -339,9 +340,20 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation SymbolStore.SymbolStores.SymbolStore store = _symbolStore; symbolDirectoryPath = Path.GetFullPath(symbolDirectoryPath); - if (!IsDuplicateSymbolStore(store, (directorySymbolStore) => IsPathEqual(symbolDirectoryPath, directorySymbolStore.Directory))) + var probingPaths = new List { symbolDirectoryPath }; + if (Directory.Exists(symbolDirectoryPath)) + { + // Add all subdirectories. + probingPaths.AddRange(Directory.GetDirectories(symbolDirectoryPath, "*", SearchOption.AllDirectories)); + } + // Make sure the root directory is enumerated last so that it comes first in the fallback tree. + foreach (var path in Enumerable.Reverse(probingPaths)) { - SetSymbolStore(new DirectorySymbolStore(Tracer.Instance, store, symbolDirectoryPath)); + if (!IsDuplicateSymbolStore(store, (directorySymbolStore) => IsPathEqual(path, directorySymbolStore.Directory))) + { + SetSymbolStore(new DirectorySymbolStore(Tracer.Instance, store, symbolDirectoryPath)); + store = _symbolStore; + } } }