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

fix: Prevent debugger crashing on circuits with no opcodes #4283

Merged
merged 2 commits into from
Feb 6, 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
4 changes: 2 additions & 2 deletions tooling/debugger/src/dap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ impl<'a, R: Read, W: Write, B: BlackBoxFunctionSolver> DapSession<'a, R, W, B> {
}

pub fn run_loop(&mut self) -> Result<(), ServerError> {
self.running = true;
self.running = self.context.get_current_opcode_location().is_some();

if matches!(self.context.get_current_source_location(), None) {
if self.running && matches!(self.context.get_current_source_location(), None) {
// TODO: remove this? This is to ensure that the tool has a proper
// source location to show when first starting the debugger, but
// maybe the default behavior should be to start executing until the
Expand Down
15 changes: 7 additions & 8 deletions tooling/debugger/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@
initial_witness.clone(),
foreign_call_executor,
);
Self {
context,
blackbox_solver,
circuit,
debug_artifact,
initial_witness,
last_result: DebugCommandResult::Ok,
}
let last_result = if context.get_current_opcode_location().is_none() {
// handle circuit with no opcodes
DebugCommandResult::Done
} else {
DebugCommandResult::Ok
};
Self { context, blackbox_solver, circuit, debug_artifact, initial_witness, last_result }
}

pub fn show_current_vm_status(&self) {
Expand Down Expand Up @@ -471,7 +470,7 @@
},
)
.add(
"regset",

Check warning on line 473 in tooling/debugger/src/repl.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (regset)
command! {
"update a Brillig register with the given value",
(index: usize, value: String) => |index, value| {
Expand Down
Loading