Skip to content

Commit

Permalink
unwind_info: Remove to_vec()
Browse files Browse the repository at this point in the history
  • Loading branch information
javierhonduco committed Aug 19, 2024
1 parent 81ccb90 commit 9b158b6
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions src/unwind_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,58 +175,6 @@ impl<'a> UnwindInfoBuilder<'a> {
})
}

pub fn to_vec(path: &str) -> anyhow::Result<Vec<CompactUnwindRow>> {
let mut result = Vec::new();
let mut last_function_end_addr: Option<u64> = None;

let builder = UnwindInfoBuilder::with_callback(path, |unwind_data| {
match unwind_data {
UnwindData::Function(_, end_addr) => {
// Add a function marker for the previous function.
if let Some(addr) = last_function_end_addr {
let marker = end_of_function_marker(addr);
let row = CompactUnwindRow {
pc: marker.pc,
cfa_offset: marker.cfa_offset,
cfa_type: marker.cfa_type,
rbp_type: marker.rbp_type,
rbp_offset: marker.rbp_offset,
};
result.push(row)
}
last_function_end_addr = Some(*end_addr);
}
UnwindData::Instruction(compact_row) => {
let row = CompactUnwindRow {
pc: compact_row.pc,
cfa_offset: compact_row.cfa_offset,
cfa_type: compact_row.cfa_type,
rbp_type: compact_row.rbp_type,
rbp_offset: compact_row.rbp_offset,
};
result.push(row);
}
}
});

builder?.process()?;

// Add marker for the last function.
if let Some(last_addr) = last_function_end_addr {
let marker = end_of_function_marker(last_addr);
let row = CompactUnwindRow {
pc: marker.pc,
cfa_offset: marker.cfa_offset,
cfa_type: marker.cfa_type,
rbp_type: marker.rbp_type,
rbp_offset: marker.rbp_offset,
};
result.push(row);
}

Ok(result)
}

pub fn process(mut self) -> Result<(), anyhow::Error> {
let object_file = object::File::parse(&self.mmap[..])?;
let eh_frame_section = object_file
Expand Down

0 comments on commit 9b158b6

Please sign in to comment.