Skip to main content

Lookup

Struct Lookup 

Source
#[non_exhaustive]
pub struct Lookup<'data> { pub address: u64, pub function: AddressRange, /* private fields */ }
Expand description

Borrowed symbolication result for one address.

frames is ordered innermost first and always holds at least one frame. Without inlining that is the only frame. With inlining, frame 0 is the deepest inlined body containing the address, the last frame is the function the linker emitted, and the frames between them are the inlined calls, so printing them in order gives the call stack.

call_site_patterns is non-empty only when the looked-up address is exactly a recorded return address and call-site records were requested.

use gsym::{AddressRange, Function, Gsym, GsymBuilder};

let mut builder = GsymBuilder::new();
builder.add_function(Function::new(AddressRange::new(0x1000, 0x1010), b"f"))?;
let bytes = builder.to_bytes()?;
let gsym = Gsym::parse(&bytes)?;

let hit = gsym.lookup(0x1008)?.expect("covered address");
assert_eq!(hit.address, 0x1008);
assert_eq!(hit.function, AddressRange::new(0x1000, 0x1010));
assert_eq!(hit.frames().last().unwrap().name, b"f");

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§address: u64

Address supplied by the caller.

§function: AddressRange

Address range of the selected top-level function.

Implementations§

Source§

impl<'data> Lookup<'data>

Source

pub fn frames(&self) -> &[LookupFrame<'data>]

Returns resolved frames ordered from innermost to outermost.

Source

pub fn call_site_patterns(&self) -> &[&'data [u8]]

Returns call-site callee patterns for an exactly matching return address.

Trait Implementations§

Source§

impl<'data> Debug for Lookup<'data>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'data> Eq for Lookup<'data>

Source§

impl<'data> PartialEq for Lookup<'data>

Source§

fn eq(&self, other: &Lookup<'data>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'data> StructuralPartialEq for Lookup<'data>

Auto Trait Implementations§

§

impl<'data> Freeze for Lookup<'data>

§

impl<'data> RefUnwindSafe for Lookup<'data>

§

impl<'data> Send for Lookup<'data>

§

impl<'data> Sync for Lookup<'data>

§

impl<'data> Unpin for Lookup<'data>

§

impl<'data> UnsafeUnpin for Lookup<'data>

§

impl<'data> UnwindSafe for Lookup<'data>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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>,

Source§

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