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

Add batch changes to breakpoints #657

Merged
merged 2 commits into from
Jan 16, 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.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
#### Changed

- [#653](https://github.com/FuelLabs/fuel-vm/pull/653): `ECAL` opcode handler can now hold internal state.
- [#657](https://github.com/FuelLabs/fuel-vm/pull/657): Add debugger methods to remove or replace all breakpoints at once.

#### Breaking

Expand Down
13 changes: 13 additions & 0 deletions fuel-vm/src/interpreter/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,24 @@ where
self.debugger.set_single_stepping(single_stepping)
}

/// Clear all set breakpoints.
pub fn clear_breakpoints(&mut self) {
self.debugger.clear_breakpoints();
}

/// Set a new breakpoint for the provided location.
pub fn set_breakpoint(&mut self, breakpoint: Breakpoint) {
self.debugger.set_breakpoint(breakpoint)
}

/// Overwrite all breakpoints with a new set of breakpoints.
pub fn overwrite_breakpoints(&mut self, breakpoints: &[Breakpoint]) {
self.debugger.clear_breakpoints();
for bp in breakpoints {
self.debugger.set_breakpoint(*bp);
}
}

/// Remove a previously set breakpoint.
pub fn remove_breakpoint(&mut self, breakpoint: &Breakpoint) {
self.debugger.remove_breakpoint(breakpoint)
Expand Down
5 changes: 5 additions & 0 deletions fuel-vm/src/state/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ impl Debugger {
self.single_stepping = single_stepping;
}

/// Set a new breakpoint in the provided location.
pub fn clear_breakpoints(&mut self) {
self.breakpoints.clear();
}

/// Set a new breakpoint in the provided location.
pub fn set_breakpoint(&mut self, breakpoint: Breakpoint) {
self.is_active = true;
Expand Down
Loading