-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make pdb-alt-path test more unwind-friendly for i686-pc-windows-msvc
- Loading branch information
1 parent
e1c3a5a
commit 0a094ba
Showing
2 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
// The various #[inline(never)] annotations and std::hint::black_box calls are | ||
// an attempt to make unwinding as non-flaky as possible on i686-pc-windows-msvc. | ||
|
||
#[inline(never)] | ||
fn generate_backtrace(x: &u32) { | ||
std::hint::black_box(x); | ||
let bt = std::backtrace::Backtrace::force_capture(); | ||
println!("{}", bt); | ||
std::hint::black_box(x); | ||
} | ||
|
||
#[inline(never)] | ||
fn fn_in_backtrace(x: &u32) { | ||
std::hint::black_box(x); | ||
generate_backtrace(x); | ||
std::hint::black_box(x); | ||
} | ||
|
||
fn main() { | ||
panic!("backtrace please"); | ||
let x = &41; | ||
std::hint::black_box(x); | ||
fn_in_backtrace(x); | ||
std::hint::black_box(x); | ||
} |