pub struct Dwarf<'dw> { /* private fields */ }
Implementations
sourceimpl<'dw> Dwarf<'dw>
impl<'dw> Dwarf<'dw>
sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Dwarf<'static>>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Dwarf<'static>>
Open a Dwarf
from a path.
Examples
let exe = std::env::current_exe().unwrap();
let dw = libdw::Dwarf::open(exe).unwrap();
sourcepub fn from_fd<FD: AsRawFd>(fd: &'dw FD) -> Result<Dwarf<'dw>>
pub fn from_fd<FD: AsRawFd>(fd: &'dw FD) -> Result<Dwarf<'dw>>
Create a Dwarf
from an open file.
Examples
let exe = std::env::current_exe().unwrap();
let f = std::fs::File::open(exe).unwrap();
let dw = libdw::Dwarf::from_fd(&f).unwrap();
sourcepub fn from_elf(elf: &'dw Elf<'_>) -> Result<Dwarf<'dw>>
pub fn from_elf(elf: &'dw Elf<'_>) -> Result<Dwarf<'dw>>
Create a Dwarf
from an existing Elf
.
Examples
let exe = std::env::current_exe().unwrap();
let elf = libelf::Elf::open(exe).unwrap();
let dw = libdw::Dwarf::from_elf(&elf).unwrap();
sourcepub unsafe fn from_raw(dwarf: *mut Dwarf) -> Dwarf<'dw>
pub unsafe fn from_raw(dwarf: *mut Dwarf) -> Dwarf<'dw>
Create a Dwarf
from a raw FFI pointer.
Safety
This function is unsafe because there is no guarantee that the given
pointer is a valid libdw
handle, nor whether the lifetime inferred
is appropriate. This does not take ownership of the underlying object,
so the caller must ensure it outlives the returned Dwarf
wrapper.
pub fn get_elf(&'dw self) -> Elf<'dw>
pub fn compile_units(&'dw self) -> CompileUnits<'dw>ⓘNotable traits for CompileUnits<'dw>impl<'dw> Iterator for CompileUnits<'dw> type Item = Result<CompileUnit<'dw>>;
pub fn type_units(&'dw self) -> TypeUnits<'dw>ⓘNotable traits for TypeUnits<'dw>impl<'dw> Iterator for TypeUnits<'dw> type Item = Result<TypeUnit<'dw>>;
pub fn as_ptr(&self) -> *mut Dwarf
Trait Implementations
Auto Trait Implementations
impl<'dw> !RefUnwindSafe for Dwarf<'dw>
impl<'dw> !Send for Dwarf<'dw>
impl<'dw> !Sync for Dwarf<'dw>
impl<'dw> Unpin for Dwarf<'dw>
impl<'dw> !UnwindSafe for Dwarf<'dw>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more