(
&mut self,
address: u64,
pre_list: &mut Vec<String>,
post_list: &mut Vec<String>,
)
| 555 | } |
| 556 | |
| 557 | fn frame_table( |
| 558 | &mut self, |
| 559 | address: u64, |
| 560 | pre_list: &mut Vec<String>, |
| 561 | post_list: &mut Vec<String>, |
| 562 | ) { |
| 563 | if !self.objdump.frame_tables() { |
| 564 | return; |
| 565 | } |
| 566 | let (Some(frame_table_iter), Some(frame_tables)) = |
| 567 | (&mut self.frame_tables, &self.frame_table_descriptors) |
| 568 | else { |
| 569 | return; |
| 570 | }; |
| 571 | |
| 572 | while let Some((addr, pos, frames)) = |
| 573 | frame_table_iter.next_if(|(addr, _, _)| u64::from(*addr) <= address) |
| 574 | { |
| 575 | if u64::from(addr) != address { |
| 576 | continue; |
| 577 | } |
| 578 | let list = match pos { |
| 579 | // N.B.: the "post" position means that we are |
| 580 | // attached to the end of the previous instruction |
| 581 | // (its "post"); which means that from this |
| 582 | // instruction's PoV, we print before the instruction |
| 583 | // (the "pre list"). And vice versa for the "pre" |
| 584 | // position. Hence the reversal here. |
| 585 | FrameInstPos::Post => &mut *pre_list, |
| 586 | FrameInstPos::Pre => &mut *post_list, |
| 587 | }; |
| 588 | let pos = match pos { |
| 589 | FrameInstPos::Post => "after previous inst", |
| 590 | FrameInstPos::Pre => "before next inst", |
| 591 | }; |
| 592 | for (wasm_pc, frame_descriptor, stack_shape) in frames { |
| 593 | let (frame_descriptor_data, offset) = |
| 594 | frame_tables.frame_descriptor(frame_descriptor).unwrap(); |
| 595 | let frame_descriptor = FrameStateSlot::parse(frame_descriptor_data).unwrap(); |
| 596 | |
| 597 | let local_shape = Self::describe_local_shape(&frame_descriptor); |
| 598 | let stack_shape = Self::describe_stack_shape(&frame_descriptor, stack_shape); |
| 599 | let func_key = frame_descriptor.func_key(); |
| 600 | list.push(format!("debug frame state ({pos}): func key {func_key:?}, wasm PC {wasm_pc}, slot at FP-0x{offset:x}, locals {local_shape}, stack {stack_shape}")); |
| 601 | } |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | fn breakpoints(&mut self, address: u64, list: &mut Vec<String>) { |
| 606 | while let Some((wasm_pc, addr, patch)) = self.breakpoints.next_if(|(_, addr, patch)| { |
no test coverage detected