1
Fork 0

Fix backtrace tests for Linux

This commit is contained in:
Manish Goregaokar 2015-03-02 16:11:01 +05:30 committed by Felix S. Klock II
parent 4e23179c85
commit 185c074798
2 changed files with 5 additions and 5 deletions

View file

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

View file

@ -68,7 +68,7 @@ fn dump_filelines(filelines: &[Pos]) {
} }
#[inline(never)] #[inline(never)]
fn inner(counter: &mut u32, main_pos: Pos, outer_pos: Pos) { fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
check!(counter; main_pos, outer_pos); check!(counter; main_pos, outer_pos);
check!(counter; main_pos, outer_pos); check!(counter; main_pos, outer_pos);
let inner_pos = pos!(); aux::callback(|aux_pos| { let inner_pos = pos!(); aux::callback(|aux_pos| {
@ -80,12 +80,12 @@ fn inner(counter: &mut u32, main_pos: Pos, outer_pos: Pos) {
} }
#[inline(always)] #[inline(always)]
fn inner_inlined(counter: &mut u32, main_pos: Pos, outer_pos: Pos) { fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
check!(counter; main_pos, outer_pos); check!(counter; main_pos, outer_pos);
check!(counter; main_pos, outer_pos); check!(counter; main_pos, outer_pos);
#[inline(always)] #[inline(always)]
fn inner_further_inlined(counter: &mut u32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) { fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner_pos: Pos) {
check!(counter; main_pos, outer_pos, inner_pos); check!(counter; main_pos, outer_pos, inner_pos);
} }
inner_further_inlined(counter, main_pos, outer_pos, pos!()); 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) {
} }
#[inline(never)] #[inline(never)]
fn outer(mut counter: u32, main_pos: Pos) { fn outer(mut counter: i32, main_pos: Pos) {
inner(&mut counter, main_pos, pos!()); inner(&mut counter, main_pos, pos!());
inner_inlined(&mut counter, main_pos, pos!()); inner_inlined(&mut counter, main_pos, pos!());
} }