Skip to content

Commit c3ac2a5

Browse files
fixup smoke.rs more
1 parent 5371553 commit c3ac2a5

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tests/smoke.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::ffi::c_void;
33
use std::ptr;
44
use std::thread;
55

6-
fn get_actual_fn_pointer(fp: usize) -> usize {
6+
fn get_actual_fn_pointer(fp: *mut c_void) -> *mut c_void {
77
// On AIX, the function name references a function descriptor.
88
// A function descriptor consists of (See https://reviews.llvm.org/D62532)
99
// * The address of the entry point of the function.
@@ -16,17 +16,18 @@ fn get_actual_fn_pointer(fp: usize) -> usize {
1616
// https://www.ibm.com/docs/en/aix/7.2?topic=program-understanding-programming-toc
1717
if cfg!(target_os = "aix") {
1818
unsafe {
19-
let actual_fn_entry = *(fp as *const usize);
19+
let actual_fn_entry = *(fp as *const *mut c_void);
2020
actual_fn_entry
2121
}
2222
} else {
23-
fp
23+
fp as *mut c_void
2424
}
2525
}
2626

2727
#[test]
2828
// FIXME: shouldn't ignore this test on i686-msvc, unsure why it's failing
2929
#[cfg_attr(all(target_arch = "x86", target_env = "msvc"), ignore)]
30+
#[inline(never)]
3031
#[rustfmt::skip] // we care about line numbers here
3132
fn smoke_test_frames() {
3233
frame_1(line!());
@@ -43,10 +44,10 @@ fn smoke_test_frames() {
4344
// Various platforms have various bits of weirdness about their
4445
// backtraces. To find a good starting spot let's search through the
4546
// frames
46-
let target = get_actual_fn_pointer(frame_4 as usize);
47+
let target = get_actual_fn_pointer(frame_4 as *mut c_void);
4748
let offset = v
4849
.iter()
49-
.map(|frame| frame.symbol_address() as usize)
50+
.map(|frame| frame.symbol_address())
5051
.enumerate()
5152
.filter_map(|(i, sym)| {
5253
if sym >= target {
@@ -62,39 +63,39 @@ fn smoke_test_frames() {
6263

6364
assert_frame(
6465
frames.next().unwrap(),
65-
get_actual_fn_pointer(frame_4 as usize),
66+
get_actual_fn_pointer(frame_4 as *mut c_void) as usize,
6667
"frame_4",
6768
"tests/smoke.rs",
6869
start_line + 6,
6970
9,
7071
);
7172
assert_frame(
7273
frames.next().unwrap(),
73-
get_actual_fn_pointer(frame_3 as usize),
74+
get_actual_fn_pointer(frame_3 as *mut c_void) as usize,
7475
"frame_3",
7576
"tests/smoke.rs",
7677
start_line + 3,
7778
52,
7879
);
7980
assert_frame(
8081
frames.next().unwrap(),
81-
get_actual_fn_pointer(frame_2 as usize),
82+
get_actual_fn_pointer(frame_2 as *mut c_void) as usize,
8283
"frame_2",
8384
"tests/smoke.rs",
8485
start_line + 2,
8586
52,
8687
);
8788
assert_frame(
8889
frames.next().unwrap(),
89-
get_actual_fn_pointer(frame_1 as usize),
90+
get_actual_fn_pointer(frame_1 as *mut c_void) as usize,
9091
"frame_1",
9192
"tests/smoke.rs",
9293
start_line + 1,
9394
52,
9495
);
9596
assert_frame(
9697
frames.next().unwrap(),
97-
get_actual_fn_pointer(smoke_test_frames as usize),
98+
get_actual_fn_pointer(smoke_test_frames as *mut c_void) as usize,
9899
"smoke_test_frames",
99100
"",
100101
0,

0 commit comments

Comments
 (0)