Sha256: 6461cc28748eb7d5fb59cf09bf7699e35a5a76faef2a58bb15d14e45199ce836

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

use backtrace::Backtrace;
use core::ffi::c_void;

// This test only works on platforms which have a working `symbol_address`
// function for frames which reports the starting address of a symbol. As a
// result it's only enabled on a few platforms.
const ENABLED: bool = cfg!(all(
    // Windows hasn't really been tested, and macOS doesn't support actually
    // finding an enclosing frame, so disable this
    target_os = "linux",
    // On ARM finding the enclosing function is simply returning the ip itself.
    not(target_arch = "arm"),
));

#[test]
#[inline(never)]
fn backtrace_new_unresolved_should_start_with_call_site_trace() {
    if !ENABLED {
        return;
    }
    let mut b = Backtrace::new_unresolved();
    b.resolve();
    println!("{b:?}");

    assert!(!b.frames().is_empty());

    let this_ip = backtrace_new_unresolved_should_start_with_call_site_trace as *mut c_void;
    println!("this_ip: {:p}", this_ip);
    let frame_ip = b.frames().first().unwrap().symbol_address();
    assert_eq!(this_ip, frame_ip);
}

#[test]
#[inline(never)]
fn backtrace_new_should_start_with_call_site_trace() {
    if !ENABLED {
        return;
    }
    let b = Backtrace::new();
    println!("{b:?}");

    assert!(!b.frames().is_empty());

    let this_ip = backtrace_new_should_start_with_call_site_trace as *mut c_void;
    let frame_ip = b.frames().first().unwrap().symbol_address();
    assert_eq!(this_ip, frame_ip);
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/backtrace-0.3.74/tests/skip_inner_frames.rs
wasmtime-28.0.0 ./ext/cargo-vendor/backtrace-0.3.74/tests/skip_inner_frames.rs
wasmtime-27.0.0 ./ext/cargo-vendor/backtrace-0.3.74/tests/skip_inner_frames.rs
wasmtime-26.0.0 ./ext/cargo-vendor/backtrace-0.3.74/tests/skip_inner_frames.rs