From 53f8f88c0861fb1cefa002a10937e3e2952a90d2 Mon Sep 17 00:00:00 2001 From: Joonatan Saarhelo Date: Fri, 20 Sep 2024 12:46:43 +0100 Subject: [PATCH] fix: StateInterface::current_frame did not work with near calls (#65) StateInterface::current_frame returned the latest far call instead of the latest frame before this fix. --- crates/vm2/src/tracing.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/vm2/src/tracing.rs b/crates/vm2/src/tracing.rs index 40940f0..9a52382 100644 --- a/crates/vm2/src/tracing.rs +++ b/crates/vm2/src/tracing.rs @@ -38,9 +38,10 @@ impl StateInterface for VirtualMachine { } fn current_frame(&mut self) -> impl CallframeInterface + '_ { + let near_call = self.state.current_frame.near_calls.len().checked_sub(1); CallframeWrapper { frame: &mut self.state.current_frame, - near_call: None, + near_call, } }