Skip to content

Commit

Permalink
perf(debugger): don't clone debug info twice (#7468)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Mar 22, 2024
1 parent 9d2125b commit f73d855
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions crates/debugger/src/tui/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ impl<'a> DebuggerContext<'a> {
}

fn gen_opcode_list(&mut self) {
self.opcode_list = self.opcode_list();
}

fn opcode_list(&self) -> Vec<String> {
self.debug_steps().iter().map(DebugStep::pretty_opcode).collect()
self.opcode_list.clear();
let debug_steps = &self.debugger.debug_arena[self.draw_memory.inner_call_index].steps;
self.opcode_list.extend(debug_steps.iter().map(DebugStep::pretty_opcode));
}

fn active_buffer(&self) -> &[u8] {
Expand Down
6 changes: 3 additions & 3 deletions crates/forge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl TestArgs {

if should_debug {
// There is only one test.
let Some(test) = outcome.into_tests_cloned().next() else {
let Some((_, test_result)) = outcome.tests().next() else {
return Err(eyre::eyre!("no tests were executed"));
};

Expand All @@ -236,9 +236,9 @@ impl TestArgs {

// Run the debugger.
let mut builder = Debugger::builder()
.debug_arenas(test.result.debug.as_slice())
.debug_arenas(test_result.debug.as_slice())
.sources(sources)
.breakpoints(test.result.breakpoints);
.breakpoints(test_result.breakpoints.clone());
if let Some(decoder) = &outcome.decoder {
builder = builder.decoder(decoder);
}
Expand Down

0 comments on commit f73d855

Please sign in to comment.