From 3cf4501fbd98313ba8eed9f8420801abbf56f51c Mon Sep 17 00:00:00 2001 From: Sangwook Kim Date: Wed, 22 Apr 2020 18:01:00 +0900 Subject: [PATCH] [Tizen] Search symbol directories recursively (#27) The SOS command 'setsymbolserver -directory' will automatically search all subdirectories of the specified directory. --- .../SymbolService.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs index 35fe3fed1..8a454152e 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs @@ -10,6 +10,7 @@ using SOS; using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -311,9 +312,20 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation Microsoft.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; + } } } -- 2.34.1