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
This commit is contained in:
Piotr Osiewicz 2025-07-01 18:58:55 +02:00 committed by GitHub
parent 0068de0386
commit eb74df632b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -420,6 +420,15 @@ impl RunningMode {
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })
.unwrap_or_default(); .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 let supports_exception_filters = capabilities
.supports_exception_filter_options .supports_exception_filter_options
.unwrap_or_default(); .unwrap_or_default();
@ -461,9 +470,12 @@ impl RunningMode {
} }
})?; })?;
this.send_exception_breakpoints(exception_filters, supports_exception_filters) if should_send_exception_breakpoints {
.await this.send_exception_breakpoints(exception_filters, supports_exception_filters)
.ok(); .await
.ok();
}
let ret = if configuration_done_supported { let ret = if configuration_done_supported {
this.request(ConfigurationDone {}) this.request(ConfigurationDone {})
} else { } else {