Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Osenkov <github@osenkov.com>2021-12-18 04:53:24 +0300
committerKirill Osenkov <github@osenkov.com>2021-12-18 04:53:24 +0300
commit9ec9365db53bdc02814507bc1dd21d7914eb0301 (patch)
tree996e05cceac18b981e55a2a86373b98c9d1be71b
parent5e0195104e26d763fa25e8fc1cda75964067c7d6 (diff)
Proper support for Catchpoint location signature
When an exception happens we didn't correctly retrieve and store the location of the exception. We used to append the module name even if the method name already contained the module name (so we'd end up with Module!Module.dll!Class.Method). Also the Address is 0 most of the time for VSCode Debug Protocol, so no need to append it if it's zero. Finally, store the location signature on the Catchpoint itself, so that when the user selects "Ignore exceptions at this location" we use the exact location that the debugger gave us and add it to the ignore list. Otherwise the exception can be on a different frame (the current frame that has the source code, and not the bottom frame of the stack).
-rw-r--r--Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs11
-rw-r--r--Mono.Debugging/Mono.Debugging.Client/StackFrame.cs11
2 files changed, 21 insertions, 1 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs b/Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
index 6f42cf9..a39e0f4 100644
--- a/Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
+++ b/Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
@@ -85,6 +85,17 @@ namespace Mono.Debugging.Client
set { includeSubclasses = value; }
}
+ /// <summary>
+ /// When an exception first happens, we are given the frame of the exception.
+ /// However by the time the user chooses "Ignore this location" in the exception dialog,
+ /// the current frame might be a different frame (the one with source code),
+ /// and not necessarily the bottom frame of the stack.
+ /// Make sure we remember the original frame where the exception happened
+ /// so that when it happens next time, we use the same frame signature to compare
+ /// against.
+ /// </summary>
+ public string CurrentLocationSignature { get; set; }
+
public HashSet<string> Ignored { get; private set; } = new HashSet<string> (StringComparer.Ordinal);
public bool ShouldIgnore(string type, string locationSignature)
diff --git a/Mono.Debugging/Mono.Debugging.Client/StackFrame.cs b/Mono.Debugging/Mono.Debugging.Client/StackFrame.cs
index 1b1ba61..88c23f4 100644
--- a/Mono.Debugging/Mono.Debugging.Client/StackFrame.cs
+++ b/Mono.Debugging/Mono.Debugging.Client/StackFrame.cs
@@ -135,7 +135,16 @@ namespace Mono.Debugging.Client
/// </summary>
public string GetLocationSignature ()
{
- return $"{Path.GetFileNameWithoutExtension (this.FullModuleName)}!{this.SourceLocation.MethodName}:{this.Address}";
+ string methodName = this.SourceLocation.MethodName;
+ if (methodName != null && !methodName.Contains("!")) {
+ methodName = $"{Path.GetFileName (this.FullModuleName)}!{methodName}";
+ }
+
+ if (this.Address != 0) {
+ methodName = $"{methodName}:{Address}";
+ }
+
+ return methodName;
}
public string GetFullStackFrameText ()