From 68321167c8d422036124ee366b9f4894072099d6 Mon Sep 17 00:00:00 2001 From: Hannes Karppila Date: Tue, 16 Jan 2024 17:58:04 -0500 Subject: [PATCH 1/2] Add batch changes to breakpoints --- fuel-vm/src/interpreter/debug.rs | 13 +++++++++++++ fuel-vm/src/state/debugger.rs | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/fuel-vm/src/interpreter/debug.rs b/fuel-vm/src/interpreter/debug.rs index 92a2cecfc9..8ae4ac9653 100644 --- a/fuel-vm/src/interpreter/debug.rs +++ b/fuel-vm/src/interpreter/debug.rs @@ -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) diff --git a/fuel-vm/src/state/debugger.rs b/fuel-vm/src/state/debugger.rs index 46419d8783..45af3c38f6 100644 --- a/fuel-vm/src/state/debugger.rs +++ b/fuel-vm/src/state/debugger.rs @@ -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; From 8d24d48b9f7e4093c2c2e0dc7893627f6fb3b178 Mon Sep 17 00:00:00 2001 From: Hannes Karppila Date: Tue, 16 Jan 2024 18:00:05 -0500 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78548b5e1b..8347ea6b34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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