From c3ac2a520ed4a7290dd58f88b60fc80c4e77678f Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 27 Jul 2024 15:47:39 -0700 Subject: [PATCH] fixup smoke.rs more --- tests/smoke.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/smoke.rs b/tests/smoke.rs index 975f4c28..cbb93347 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -3,7 +3,7 @@ use core::ffi::c_void; use std::ptr; use std::thread; -fn get_actual_fn_pointer(fp: usize) -> usize { +fn get_actual_fn_pointer(fp: *mut c_void) -> *mut c_void { // On AIX, the function name references a function descriptor. // A function descriptor consists of (See https://reviews.llvm.org/D62532) // * The address of the entry point of the function. @@ -16,17 +16,18 @@ fn get_actual_fn_pointer(fp: usize) -> usize { // https://www.ibm.com/docs/en/aix/7.2?topic=program-understanding-programming-toc if cfg!(target_os = "aix") { unsafe { - let actual_fn_entry = *(fp as *const usize); + let actual_fn_entry = *(fp as *const *mut c_void); actual_fn_entry } } else { - fp + fp as *mut c_void } } #[test] // FIXME: shouldn't ignore this test on i686-msvc, unsure why it's failing #[cfg_attr(all(target_arch = "x86", target_env = "msvc"), ignore)] +#[inline(never)] #[rustfmt::skip] // we care about line numbers here fn smoke_test_frames() { frame_1(line!()); @@ -43,10 +44,10 @@ fn smoke_test_frames() { // Various platforms have various bits of weirdness about their // backtraces. To find a good starting spot let's search through the // frames - let target = get_actual_fn_pointer(frame_4 as usize); + let target = get_actual_fn_pointer(frame_4 as *mut c_void); let offset = v .iter() - .map(|frame| frame.symbol_address() as usize) + .map(|frame| frame.symbol_address()) .enumerate() .filter_map(|(i, sym)| { if sym >= target { @@ -62,7 +63,7 @@ fn smoke_test_frames() { assert_frame( frames.next().unwrap(), - get_actual_fn_pointer(frame_4 as usize), + get_actual_fn_pointer(frame_4 as *mut c_void) as usize, "frame_4", "tests/smoke.rs", start_line + 6, @@ -70,7 +71,7 @@ fn smoke_test_frames() { ); assert_frame( frames.next().unwrap(), - get_actual_fn_pointer(frame_3 as usize), + get_actual_fn_pointer(frame_3 as *mut c_void) as usize, "frame_3", "tests/smoke.rs", start_line + 3, @@ -78,7 +79,7 @@ fn smoke_test_frames() { ); assert_frame( frames.next().unwrap(), - get_actual_fn_pointer(frame_2 as usize), + get_actual_fn_pointer(frame_2 as *mut c_void) as usize, "frame_2", "tests/smoke.rs", start_line + 2, @@ -86,7 +87,7 @@ fn smoke_test_frames() { ); assert_frame( frames.next().unwrap(), - get_actual_fn_pointer(frame_1 as usize), + get_actual_fn_pointer(frame_1 as *mut c_void) as usize, "frame_1", "tests/smoke.rs", start_line + 1, @@ -94,7 +95,7 @@ fn smoke_test_frames() { ); assert_frame( frames.next().unwrap(), - get_actual_fn_pointer(smoke_test_frames as usize), + get_actual_fn_pointer(smoke_test_frames as *mut c_void) as usize, "smoke_test_frames", "", 0,