Skip to content

Commit

Permalink
unwind_info: Add tracing span unwind info generation
Browse files Browse the repository at this point in the history
And remove stale comments
  • Loading branch information
javierhonduco committed Aug 19, 2024
1 parent 81ccb90 commit 367d979
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/unwind_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ impl<'a> UnwindInfoBuilder<'a> {
}

pub fn process(mut self) -> Result<(), anyhow::Error> {
let _span = span!(Level::DEBUG, "processing unwind info").entered();

let object_file = object::File::parse(&self.mmap[..])?;
let eh_frame_section = object_file
.section_by_name(".eh_frame")
Expand Down Expand Up @@ -281,9 +283,10 @@ impl<'a> UnwindInfoBuilder<'a> {
}
}

let span = span!(Level::DEBUG, "sort pc and fdes").entered();
pc_and_fde_offset.sort_by_key(|(pc, _)| *pc);
span.exit();
{
let _span = span!(Level::DEBUG, "sort pc and fdes").entered();
pc_and_fde_offset.sort_by_key(|(pc, _)| *pc);
}

let mut ctx = Box::new(UnwindContext::new());
for (_, fde_offset) in pc_and_fde_offset {
Expand Down Expand Up @@ -366,16 +369,12 @@ impl<'a> UnwindInfoBuilder<'a> {
{
compact_row.rbp_type = RbpType::UndefinedReturnAddress as u8;
}

// print!(", ra {:?}", row.register(fde.cie().return_address_register()));
}
_ => continue,
}

(self.callback)(&UnwindData::Instruction(compact_row));
}
// start_addresses.push(fde.initial_address() as u32);
// end_addresses.push((fde.initial_address() + fde.len()) as u32);
}
Ok(())
}
Expand Down

0 comments on commit 367d979

Please sign in to comment.