pub struct Backtrace {
pub frames: Vec<*const c_void>,
}Expand description
A captured stack backtrace.
This type stores the backtrace of a captured stack at a certain point in time. The backtrace is represented as a list of instruction pointers.
let backtrace = Backtrace::capture();
println!("{backtrace}");§Symbolication
The number stored in each frame is not particularly meaningful to humans on its own.
Using a tool such as llvm-symbolizer or addr2line, it can be turned into
a function name and line number to show what functions were being run at
the time of the backtrace’s capture.
$ llvm-symbolizer -p -e ./target/armv7a-vex-v5/debug/program_name 0x380217b 0x380209b
my_function at /path/to/project/src/main.rs:30:14
main at /path/to/project/src/main.rs:21:9Fields§
§frames: Vec<*const c_void>The instruction pointers of each frame in the backtrace.
Implementations§
source§impl Backtrace
impl Backtrace
sourcepub fn capture() -> Self
pub fn capture() -> Self
Captures a backtrace at the current point of execution.
If a backtrace could not be captured, an empty backtrace is returned.
§Platform Support
Backtraces will be empty on non-armv7a targets (e.g. WebAssembly) or when
the unwind feature is disabled.
sourcepub fn try_capture() -> Result<Self, UnwindError>
pub fn try_capture() -> Result<Self, UnwindError>
Captures a backtrace at the current point of execution, returning an error if the backtrace fails to capture.
Trait Implementations§
impl Eq for Backtrace
impl StructuralPartialEq for Backtrace
Auto Trait Implementations§
impl Freeze for Backtrace
impl RefUnwindSafe for Backtrace
impl !Send for Backtrace
impl !Sync for Backtrace
impl Unpin for Backtrace
impl UnwindSafe for Backtrace
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)