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

perf(debugger): don't clone debug info twice #7468

Merged
merged 1 commit into from
Mar 22, 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
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
Loading