Struct addr2line::Loader

source ·
pub struct Loader { /* private fields */ }
Expand description

A loader for the DWARF data required for a Context.

For performance reasons, a Context normally borrows the input data. However, that means the input data must outlive the Context, which is inconvenient for long-lived Contexts. This loader uses an arena to store the input data, together with the Context itself. This ensures that the input data lives as long as the Context.

The loader performs some additional tasks:

  • Loads the symbol table from the executable file (see Self::find_symbol).
  • Loads Mach-O dSYM files that are located next to the executable file.
  • Locates and loads split DWARF files (DWO and DWP).

Implementations§

source§

impl Loader

source

pub fn new(path: impl AsRef<Path>) -> Result<Self, Box<dyn Error>>

Load the DWARF data for an executable file and create a Context.

source

pub fn new_with_sup( path: impl AsRef<Path>, sup_path: Option<impl AsRef<Path>> ) -> Result<Self, Box<dyn Error>>

Load the DWARF data for an executable file and create a Context.

Optionally also use a supplementary object file.

source

pub fn relative_address_base(&self) -> u64

Get the base address used for relative virtual addresses.

Currently this is only non-zero for PE.

source

pub fn find_location( &self, probe: u64 ) -> Result<Option<Location<'_>>, Box<dyn Error>>

Find the source file and line corresponding to the given virtual memory address.

This calls Context::find_location with the given address.

source

pub fn find_location_range( &self, probe_low: u64, probe_high: u64 ) -> Result<LocationRangeIter<'_, EndianSlice<'_, RunTimeEndian>>, Box<dyn Error>>

Return source file and lines for a range of addresses.

This calls Context::find_location_range with the given range.

source

pub fn find_frames( &self, probe: u64 ) -> Result<FrameIter<'_, EndianSlice<'_, RunTimeEndian>>, Box<dyn Error>>

Return an iterator for the function frames corresponding to the given virtual memory address.

This calls Context::find_frames with the given address.

source

pub fn find_symbol(&self, probe: u64) -> Option<&str>

Find the symbol table entry corresponding to the given virtual memory address.

Auto Trait Implementations§

§

impl !Freeze for Loader

§

impl !RefUnwindSafe for Loader

§

impl Send for Loader

§

impl !Sync for Loader

§

impl Unpin for Loader

§

impl UnwindSafe for Loader

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.