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
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<'_, impl Reader + '_>, Box<dyn Error>>
pub fn find_location_range( &self, probe_low: u64, probe_high: u64, ) -> Result<LocationRangeIter<'_, impl Reader + '_>, 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<'_, impl Reader + '_>, Box<dyn Error>>
pub fn find_frames( &self, probe: u64, ) -> Result<FrameIter<'_, impl Reader + '_>, 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. Return the symbol name.
Sourcepub fn find_symbol_info(&self, probe: u64) -> Option<Symbol<'_>>
pub fn find_symbol_info(&self, probe: u64) -> Option<Symbol<'_>>
Find the symbol table entry corresponding to the given virtual memory address.
Sourcepub fn get_section_range(&self, section_name: &[u8]) -> Option<Range>
pub fn get_section_range(&self, section_name: &[u8]) -> Option<Range>
Get the address of a section