Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dap-server: Don't stop when unwinding an exception fails #2198

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/fixed-debugger-exception-unwind-abort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't stop DAP debugger server when an error unwinding an exception occurs.
55 changes: 30 additions & 25 deletions probe-rs/src/debug/debug_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,31 +896,36 @@ impl DebugInfo {
.unwrap();
ra.value = Some(RegisterValue::U32(value));

// Now, how do we handle this.
if let Some(details) =
exception_handler.exception_details(memory, &unwind_registers)?
{
unwind_registers = details.calling_frame_registers;
let address = frame_pc;

let exception_frame = StackFrame {
id: get_object_reference(),
function_name: details.description.clone(),
source_location: None,
registers: unwind_registers.clone(),
pc: match unwind_registers.get_address_size_bytes() {
4 => RegisterValue::U32(address as u32),
8 => RegisterValue::U64(address),
_ => RegisterValue::from(address),
},
frame_base: None,
is_inlined: false,
static_variables: None,
local_variables: None,
canonical_frame_address: None,
};

stack_frames.push(exception_frame);
match exception_handler.exception_details(memory, &unwind_registers) {
Ok(Some(details)) => {
unwind_registers = details.calling_frame_registers;
let address = frame_pc;

let exception_frame = StackFrame {
id: get_object_reference(),
function_name: details.description.clone(),
source_location: None,
registers: unwind_registers.clone(),
pc: match unwind_registers.get_address_size_bytes() {
4 => RegisterValue::U32(address as u32),
8 => RegisterValue::U64(address),
_ => RegisterValue::from(address),
},
frame_base: None,
is_inlined: false,
static_variables: None,
local_variables: None,
canonical_frame_address: None,
};

stack_frames.push(exception_frame);
}
// We are not in an exception handler, so we can continue unwinding.
Ok(None) => {}
Err(e) => {
tracing::error!("Error while checking for exception context: {}", e);
break 'unwind;
}
}
}
}
Expand Down
Loading