Debugger: Fix breakpoint serialization (#27825)

This PR fixes two bugs that cause unexpected behavior with breakpoints.

The first bug made it impossible to delete the last breakpoint in a file
in the workspace's database. This caused deleted breakpoints to remain
in the database and added to new projects.

The second bug was an edge case in the breakpoint context menu where
disabling/enabling a breakpoint would sometimes set a new breakpoint on
top of the old breakpoint.


Release Notes:

- N/A
This commit is contained in:
Anthony Eid
2025-04-01 05:40:05 +00:00
committed by GitHub
parent d0276e6666
commit 8075c2458f
4 changed files with 124 additions and 18 deletions
@@ -566,7 +566,20 @@ impl BreakpointStore {
new_breakpoints.insert(path, breakpoints_for_file);
}
this.update(cx, |this, cx| {
log::info!("Finish deserializing breakpoints & initializing breakpoint store");
for (path, count) in new_breakpoints.iter().map(|(path, bp_in_file)| {
(path.to_string_lossy(), bp_in_file.breakpoints.len())
}) {
let breakpoint_str = if count > 1 {
"breakpoints"
} else {
"breakpoint"
};
log::info!("Deserialized {count} {breakpoint_str} at path: {path}");
}
this.breakpoints = new_breakpoints;
cx.notify();
})?;