Skip to content

Commit 185c074

Browse files
Manishearthpnkfelix
authored andcommitted
Fix backtrace tests for Linux
1 parent 4e23179 commit 185c074

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: src/libstd/sys/unix/backtrace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
176176
let mut ip = unsafe {
177177
uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void
178178
};
179-
if ip_before_insn == 0 {
179+
if !ip.is_null() && ip_before_insn == 0 {
180180
// this is a non-signaling frame, so `ip` refers to the address
181181
// after the calling instruction. account for that.
182182
ip = (ip as usize - 1) as *mut _;

Diff for: src/test/run-pass/backtrace-debuginfo.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn dump_filelines(filelines: &[Pos]) {
6868
}
6969

7070
#[inline(never)]
71-
fn inner(counter: &mut u32, main_pos: Pos, outer_pos: Pos) {
71+
fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
7272
check!(counter; main_pos, outer_pos);
7373
check!(counter; main_pos, outer_pos);
7474
let inner_pos = pos!(); aux::callback(|aux_pos| {
@@ -80,12 +80,12 @@ fn inner(counter: &mut u32, main_pos: Pos, outer_pos: Pos) {
8080
}
8181

8282
#[inline(always)]
83-
fn inner_inlined(counter: &mut u32, main_pos: Pos, outer_pos: Pos) {
83+
fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
8484
check!(counter; main_pos, outer_pos);
8585
check!(counter; main_pos, outer_pos);
8686

8787
#[inline(always)]
88-
fn inner_further_inlined(counter: &mut u32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
88+
fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
8989
check!(counter; main_pos, outer_pos, inner_pos);
9090
}
9191
inner_further_inlined(counter, main_pos, outer_pos, pos!());
@@ -103,7 +103,7 @@ fn inner_inlined(counter: &mut u32, main_pos: Pos, outer_pos: Pos) {
103103
}
104104

105105
#[inline(never)]
106-
fn outer(mut counter: u32, main_pos: Pos) {
106+
fn outer(mut counter: i32, main_pos: Pos) {
107107
inner(&mut counter, main_pos, pos!());
108108
inner_inlined(&mut counter, main_pos, pos!());
109109
}

0 commit comments

Comments
 (0)