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 Context
s.
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
impl Loader
sourcepub fn new(path: impl AsRef<Path>) -> Result<Self, Box<dyn Error>>
pub fn new(path: impl AsRef<Path>) -> Result<Self, Box<dyn Error>>
Load the DWARF data for an executable file and create a Context
.
sourcepub fn new_with_sup(
path: impl AsRef<Path>,
sup_path: Option<impl AsRef<Path>>
) -> Result<Self, Box<dyn Error>>
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.
sourcepub fn relative_address_base(&self) -> u64
pub fn relative_address_base(&self) -> u64
Get the base address used for relative virtual addresses.
Currently this is only non-zero for PE.
sourcepub fn find_location(
&self,
probe: u64
) -> Result<Option<Location<'_>>, Box<dyn Error>>
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.
sourcepub fn find_location_range(
&self,
probe_low: u64,
probe_high: u64
) -> Result<LocationRangeIter<'_, EndianSlice<'_, RunTimeEndian>>, Box<dyn Error>>
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.
sourcepub fn find_frames(
&self,
probe: u64
) -> Result<FrameIter<'_, EndianSlice<'_, RunTimeEndian>>, Box<dyn Error>>
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.
sourcepub fn find_symbol(&self, probe: u64) -> Option<&str>
pub fn find_symbol(&self, probe: u64) -> Option<&str>
Find the symbol table entry corresponding to the given virtual memory address.