pub struct FilterUnitSection<'a, R: Reader<Offset = usize>> { /* private fields */ }Expand description
The state for identifying which DIEs in a .debug_info section
need to be converted.
This is used to prune unneeded DIEs, and reserve IDs so that DIE references can be converted.
The user should call FilterUnitSection::read_unit and
FilterUnit::read_entry to traverse all DIEs in the section. Once there are
no more units, this state can be passed to Dwarf::convert_with_filter or
ConvertUnit::convert_split_with_filter.
§Example
Create a filter for the DIEs in a DWARF section.
let read_dwarf = gimli::read::Dwarf::load(loader)?;
let mut filter = gimli::write::FilterUnitSection::new(&read_dwarf)?;
while let Some(mut unit) = filter.read_unit()? {
let mut entry = unit.null_entry();
while unit.read_entry(&mut entry)? {
if need_entry(&entry)? {
unit.require_entry(entry.offset);
}
}
}
// `filter` can now be used to filter the DIEs during a conversion.Implementations§
Source§impl<'a, R: Reader<Offset = usize>> FilterUnitSection<'a, R>
impl<'a, R: Reader<Offset = usize>> FilterUnitSection<'a, R>
Sourcepub fn new(dwarf: &'a Dwarf<R>) -> ConvertResult<Self>
pub fn new(dwarf: &'a Dwarf<R>) -> ConvertResult<Self>
Start parsing a .debug_info section.
§Example
let read_dwarf = gimli::read::Dwarf::load(loader)?;
let mut filter = gimli::write::FilterUnitSection::new(&read_dwarf)?;Sourcepub fn new_split(
dwarf: &'a Dwarf<R>,
skeleton_unit: UnitRef<'a, R>,
) -> ConvertResult<Self>
pub fn new_split( dwarf: &'a Dwarf<R>, skeleton_unit: UnitRef<'a, R>, ) -> ConvertResult<Self>
Start parsing the .debug_info section for a split DWARF unit.
§Example
let dwp = gimli::read::DwarfPackage::load(loader, Default::default())?;
let dwo_id = skeleton_unit.dwo_id.unwrap();
let split_dwarf = dwp.find_cu(dwo_id, skeleton_unit.dwarf)?.unwrap();
let mut filter = gimli::write::FilterUnitSection::new_split(&split_dwarf, skeleton_unit)?;Sourcepub fn read_unit(&mut self) -> ConvertResult<Option<FilterUnit<'_, R>>>
pub fn read_unit(&mut self) -> ConvertResult<Option<FilterUnit<'_, R>>>
Read the next unit header and prepare to parse its DIEs.
Trait Implementations§
Auto Trait Implementations§
impl<'a, R> Freeze for FilterUnitSection<'a, R>where
R: Freeze,
impl<'a, R> RefUnwindSafe for FilterUnitSection<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for FilterUnitSection<'a, R>
impl<'a, R> Sync for FilterUnitSection<'a, R>
impl<'a, R> Unpin for FilterUnitSection<'a, R>where
R: Unpin,
impl<'a, R> UnsafeUnpin for FilterUnitSection<'a, R>where
R: UnsafeUnpin,
impl<'a, R> UnwindSafe for FilterUnitSection<'a, R>where
R: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more