From eb74df632bf8f49060ffa2863ae28a12d228a876 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 1 Jul 2025 18:58:55 +0200 Subject: [PATCH] debugger: Do not set exception breakpoints in initialization sequence in certain conditions (#33723) As pointed out in https://github.com/probe-rs/probe-rs/issues/3333, we violate the spec by sending setExceptionBreakpoints even when the adapter does not define any exceptions. Release Notes: - N/A --- crates/project/src/debugger/session.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rs index 837bc4b81c..b76200aee6 100644 --- a/crates/project/src/debugger/session.rs +++ b/crates/project/src/debugger/session.rs @@ -420,6 +420,15 @@ impl RunningMode { .collect::>() }) .unwrap_or_default(); + // From spec (on initialization sequence): + // client sends a setExceptionBreakpoints request if one or more exceptionBreakpointFilters have been defined (or if supportsConfigurationDoneRequest is not true) + // + // Thus we should send setExceptionBreakpoints even if `exceptionFilters` variable is empty (as long as there were some options in the first place). + let should_send_exception_breakpoints = capabilities + .exception_breakpoint_filters + .as_ref() + .map_or(false, |filters| !filters.is_empty()) + || !configuration_done_supported; let supports_exception_filters = capabilities .supports_exception_filter_options .unwrap_or_default(); @@ -461,9 +470,12 @@ impl RunningMode { } })?; - this.send_exception_breakpoints(exception_filters, supports_exception_filters) - .await - .ok(); + if should_send_exception_breakpoints { + this.send_exception_breakpoints(exception_filters, supports_exception_filters) + .await + .ok(); + } + let ret = if configuration_done_supported { this.request(ConfigurationDone {}) } else {