diff options
author | nosami <jasonimison@gmail.com> | 2022-04-26 16:50:00 +0300 |
---|---|---|
committer | nosami <jasonimison@gmail.com> | 2022-06-09 19:59:07 +0300 |
commit | ab8035a8feb9ac57628f3a74fcc744c65583625d (patch) | |
tree | 829aff540d42b90c42ef8b9a5383c84e6156f74d | |
parent | cdf25369c56e6006f64b63fd3ea4d817c2cf8da8 (diff) |
Add symbol server options and tweak cache path format
-rw-r--r-- | Mono.Debugging/Mono.Debugging.Client/DebuggerSessionOptions.cs | 27 | ||||
-rw-r--r-- | Mono.Debugging/Mono.Debugging.Client/SourceLink.cs | 29 |
2 files changed, 53 insertions, 3 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/DebuggerSessionOptions.cs b/Mono.Debugging/Mono.Debugging.Client/DebuggerSessionOptions.cs index b125943..6353ba6 100644 --- a/Mono.Debugging/Mono.Debugging.Client/DebuggerSessionOptions.cs +++ b/Mono.Debugging/Mono.Debugging.Client/DebuggerSessionOptions.cs @@ -1,4 +1,4 @@ -// +// // DebuggerSessionOptions.cs // // Author: @@ -25,6 +25,8 @@ // THE SOFTWARE. using System; +using System.Collections.Generic; +using System.Collections.Immutable; namespace Mono.Debugging.Client { @@ -44,5 +46,28 @@ namespace Mono.Debugging.Client public bool ProjectAssembliesOnly { get; set; } public AutomaticSourceDownload AutomaticSourceLinkDownload { get; set; } public bool DebugSubprocesses { get; set; } + public ImmutableArray<SymbolSource> SymbolSearchPaths { get; set; } = ImmutableArray<SymbolSource>.Empty; + public bool SearchMicrosoftSymbolServer { get; set; } + public bool SearchNuGetSymbolServer { get; set; } + } + + [Serializable] + public class SymbolSource + { + public SymbolSource () + { + // For deserialization + } + + public SymbolSource (string path, string name, bool isEnabled) + { + Path = path; + Name = name; + IsEnabled = isEnabled; + } + + public string Name { get; set; } + public string Path { get; set; } + public bool IsEnabled { get; set; } } } diff --git a/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs b/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs index c904992..9c78393 100644 --- a/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs +++ b/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs @@ -1,12 +1,19 @@ -using System; +using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Text; namespace Mono.Debugging.Client { [Serializable] public class SourceLink { + // Keep the / character to use as a path separator to help group related symbols + static readonly HashSet<char> invalids = new HashSet<char>(Path.GetInvalidFileNameChars ().Except (new char[] { '/' })); + public string Uri { get; } + public string RelativeFilePath { get; } public SourceLink (string uri, string relativeFilePath) @@ -17,7 +24,25 @@ namespace Mono.Debugging.Client public string GetDownloadLocation (string cachePath) { - return Path.Combine (cachePath, new Uri (Uri).GetComponents (UriComponents.Path, UriFormat.SafeUnescaped)); + var uri = new Uri (Uri); + return Path.Combine (cachePath, MakeValidFileName (uri)); + } + + static string MakeValidFileName (Uri uri) + { + // Remove scheme from uri + var text = uri.Host + uri.PathAndQuery; + var sb = new StringBuilder (text.Length); + for (int i = 0; i < text.Length; i++) { + char c = text[i]; + if (invalids.Contains (c)) { + sb.Append ('_'); + } else + sb.Append (c); + } + if (sb.Length == 0) + return "_"; + return sb.ToString (); } } } |