#[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: u64Address supplied by the caller.
function: AddressRangeAddress range of the selected top-level function.
Implementations§
Source§impl<'data> Lookup<'data>
impl<'data> Lookup<'data>
Sourcepub fn frames(&self) -> &[LookupFrame<'data>]
pub fn frames(&self) -> &[LookupFrame<'data>]
Returns resolved frames ordered from innermost to outermost.
Sourcepub fn call_site_patterns(&self) -> &[&'data [u8]]
pub fn call_site_patterns(&self) -> &[&'data [u8]]
Returns call-site callee patterns for an exactly matching return address.
Trait Implementations§
impl<'data> Eq for Lookup<'data>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more