pub struct Symbolizer { /* private fields */ }
Expand description

Symbolicate stack frames.

A Symbolizer manages loading symbols and looking up symbols in them including caching so that symbols for a given module are only loaded once.

Call Symbolizer::new to instantiate a Symbolizer. A Symbolizer requires a SymbolSupplier to locate symbols. If you have symbols on disk in the customary directory layout, a SimpleSymbolSupplier will work.

Use get_symbol_at_address or fill_symbol to do symbol lookup.

Implementations§

source§

impl Symbolizer

source

pub fn new<T: SymbolSupplier + Send + Sync + 'static>(supplier: T) -> Symbolizer

Create a Symbolizer that uses supplier to locate symbols.

source

pub async fn get_symbol_at_address( &self, debug_file: &str, debug_id: DebugId, address: u64 ) -> Option<String>

Helper method for non-minidump-using callers.

Pass debug_file and debug_id describing a specific module, and address, a module-relative address, and get back a symbol in that module that covers that address, or None.

See the module-level documentation for an example.

source

pub async fn fill_symbol( &self, module: &(dyn Module + Sync), frame: &mut (dyn FrameSymbolizer + Send) ) -> Result<(), FillSymbolError>

Fill symbol information in frame using the instruction address from frame, and the module information from module. If you’re not using a minidump module, you can use SimpleModule and SimpleFrame.

An Error indicates that no symbols could be found for the relevant module.

§Examples
use std::str::FromStr;
use debugid::DebugId;
use breakpad_symbols::{SimpleSymbolSupplier,Symbolizer,SimpleFrame,SimpleModule};

#[tokio::main]
async fn main() {
    use std::path::PathBuf;
    let paths = vec!(PathBuf::from("../testdata/symbols/"));
    let supplier = SimpleSymbolSupplier::new(paths);
    let symbolizer = Symbolizer::new(supplier);
    let debug_id = DebugId::from_str("5A9832E5287241C1838ED98914E9B7FF1").unwrap();
    let m = SimpleModule::new("test_app.pdb", debug_id);
    let mut f = SimpleFrame::with_instruction(0x1010);
    let _ = symbolizer.fill_symbol(&m, &mut f).await;
    assert_eq!(f.function.unwrap(), "vswprintf");
    assert_eq!(f.source_file.unwrap(),
        r"c:\program files\microsoft visual studio 8\vc\include\swprintf.inl");
    assert_eq!(f.source_line.unwrap(), 51);
}
source

pub fn stats(&self) -> HashMap<String, SymbolStats>

Collect various statistics on the symbols.

Keys are the file name of the module (code_file’s file name).

source

pub fn pending_stats(&self) -> PendingSymbolStats

Get live symbol stats for interactive updates.

source

pub async fn walk_frame( &self, module: &(dyn Module + Sync), walker: &mut (dyn FrameWalker + Send) ) -> Option<()>

Tries to use CFI to walk the stack frame of the FrameWalker using the symbols of the given Module. Output will be written using the FrameWalker’s set_caller_* APIs.

source

pub async fn get_file_path( &self, module: &(dyn Module + Sync), file_kind: FileKind ) -> Result<PathBuf, FileError>

Gets the path to a file for a given module (or an Error).

This returns a CachedOperation which is guaranteed to already be resolved (lifetime stuff).

Auto Trait Implementations§

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more