pub struct DebugMacro<R> { /* private fields */ }
Expand description
The raw contents of the .debug_macro
section.
Implementations§
Source§impl<'input, Endian> DebugMacro<EndianSlice<'input, Endian>>where
Endian: Endianity,
impl<'input, Endian> DebugMacro<EndianSlice<'input, Endian>>where
Endian: Endianity,
Sourcepub fn new(macro_section: &'input [u8], endian: Endian) -> Self
pub fn new(macro_section: &'input [u8], endian: Endian) -> Self
Construct a new DebugMacro
instance from the data in the .debug_macro
section.
It is the caller’s responsibility to read the .debug_macro
section and
present it as a &[u8]
slice. That means using some ELF loader on
Linux, a Mach-O loader on macOS, etc.
use gimli::{DebugMacro, LittleEndian};
let debug_str = DebugMacro::new(read_section_somehow(), LittleEndian);
Source§impl<R: Reader> DebugMacro<R>
impl<R: Reader> DebugMacro<R>
Sourcepub fn get_macros(
&self,
offset: DebugMacroOffset<R::Offset>,
) -> Result<MacroIter<R>>
pub fn get_macros( &self, offset: DebugMacroOffset<R::Offset>, ) -> Result<MacroIter<R>>
Look up a macro reference the .debug_macinfo
section by DebugMacroOffset.
A macinfo offset points to a list of macro information entries in the .debug_macinfo
section.
To handle this, the function returns an iterator.
use gimli::{DebugMacro, DebugMacroOffset, LittleEndian};
let debug_macro = DebugMacro::new(read_section_somehow(), LittleEndian);
let mut iter = debug_macro.get_macros(debug_macro_offset_somehow())?;
while let Some(cur_macro) = iter.next()? {
println!("Found macro info {:?}", cur_macro);
}
Source§impl<T> DebugMacro<T>
impl<T> DebugMacro<T>
Sourcepub fn borrow<'a, F, R>(&'a self, borrow: F) -> DebugMacro<R>
pub fn borrow<'a, F, R>(&'a self, borrow: F) -> DebugMacro<R>
Create a DebugMacro
section that references the data in self
.
This is useful when R
implements Reader
but T
does not.
Used by DwarfSections::borrow
.
Trait Implementations§
Source§impl<R: Clone> Clone for DebugMacro<R>
impl<R: Clone> Clone for DebugMacro<R>
Source§fn clone(&self) -> DebugMacro<R>
fn clone(&self) -> DebugMacro<R>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<R: Debug> Debug for DebugMacro<R>
impl<R: Debug> Debug for DebugMacro<R>
Source§impl<R: Default> Default for DebugMacro<R>
impl<R: Default> Default for DebugMacro<R>
Source§fn default() -> DebugMacro<R>
fn default() -> DebugMacro<R>
Returns the “default value” for a type. Read more
Source§impl<R> From<R> for DebugMacro<R>
impl<R> From<R> for DebugMacro<R>
Source§impl<R> Section<R> for DebugMacro<R>
impl<R> Section<R> for DebugMacro<R>
Source§fn section_name() -> &'static str
fn section_name() -> &'static str
Returns the ELF section name for this type.
Source§fn dwo_section_name() -> Option<&'static str>
fn dwo_section_name() -> Option<&'static str>
Returns the ELF section name (if any) for this type when used in a dwo
file.
Source§fn xcoff_section_name() -> Option<&'static str>
fn xcoff_section_name() -> Option<&'static str>
Returns the XCOFF section name (if any) for this type when used in a XCOFF
file.
Source§fn load<F, E>(f: F) -> Result<Self, E>
fn load<F, E>(f: F) -> Result<Self, E>
Try to load the section using the given loader function.
Source§fn dwp_range(&self, offset: u32, size: u32) -> Result<Self>where
R: Reader,
fn dwp_range(&self, offset: u32, size: u32) -> Result<Self>where
R: Reader,
Returns the subrange of the section that is the contribution of
a unit in a
.dwp
file.Source§fn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<(SectionId, R::Offset)>where
R: Reader,
fn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<(SectionId, R::Offset)>where
R: Reader,
Returns the
Reader
for this section.impl<R: Copy> Copy for DebugMacro<R>
Auto Trait Implementations§
impl<R> Freeze for DebugMacro<R>where
R: Freeze,
impl<R> RefUnwindSafe for DebugMacro<R>where
R: RefUnwindSafe,
impl<R> Send for DebugMacro<R>where
R: Send,
impl<R> Sync for DebugMacro<R>where
R: Sync,
impl<R> Unpin for DebugMacro<R>where
R: Unpin,
impl<R> UnwindSafe for DebugMacro<R>where
R: UnwindSafe,
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