diff options
author | Michael Belyaev <usrsse2@me.com> | 2019-05-13 17:34:02 +0300 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-05-28 18:26:39 +0300 |
commit | a61148d56b526b5b4c772a911634306028729e1a (patch) | |
tree | b179bd97727546380da23e040f1b95f179a9113c /main/src/addins | |
parent | 354d275c1838e050fc0a342c492ba60b9384891c (diff) |
Add support for breakpoint conditions in VSCodeDebuggerSession
Diffstat (limited to 'main/src/addins')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs index d29b28c369..7192259b75 100644 --- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs +++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs @@ -315,6 +315,14 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol return sb.ToString(); } + bool? EvaluateCondition (int frameId, string exp) + { + var response = protocolClient.SendRequestSync (new EvaluateRequest (exp, frameId)).Result; + if (bool.TryParse (response, out var result)) + return result; + return null; + } + private static readonly Regex VsdbgExceptionNameRegex = new Regex ("Exception thrown: '(.*)' in .*"); protected void HandleEvent (object sender, EventReceivedEventArgs obj) @@ -340,6 +348,13 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol } else { args.BreakEvent = bp; if (breakpoints.TryGetValue (bp, out var binfo)) { + if (bp.ConditionExpression != null) { + if (EvaluateCondition(stackFrame.frameId, bp.ConditionExpression) == false) { + OnContinue (); + return; + } + } + if ((bp.HitAction & HitAction.PrintExpression) != HitAction.None) { string exp = EvaluateTrace (stackFrame.frameId, bp.TraceExpression); binfo.UpdateLastTraceValue (exp); |