1 // normalize-stderr-test ".*/(rust|checkout)/library/" -> "RUSTLIB/"
2 // normalize-stderr-test "RUSTLIB/(.*):\d+:\d+ "-> "RUSTLIB/$1:LL:COL "
3 // normalize-stderr-test "::<.*>" -> ""
5 #[inline(never)] fn func_a() -> Box<[*mut ()]> { func_b::<u8>() }
6 #[inline(never)] fn func_b<T>() -> Box<[*mut ()]> { func_c() }
8 macro_rules! invoke_func_d {
12 #[inline(never)] fn func_c() -> Box<[*mut ()]> { invoke_func_d!() }
13 #[inline(never)] fn func_d() -> Box<[*mut ()]> { unsafe { miri_get_backtrace(0) } }
16 let mut seen_main = false;
17 let frames = func_a();
18 for frame in frames.into_iter() {
19 let miri_frame = unsafe { miri_resolve_frame(*frame, 0) };
20 let name = String::from_utf8(miri_frame.name.into()).unwrap();
21 let filename = String::from_utf8(miri_frame.filename.into()).unwrap();
24 assert_eq!(func_a as *mut (), miri_frame.fn_ptr);
27 // Print every frame to stderr.
28 let out = format!("{}:{}:{} ({})", filename, miri_frame.lineno, miri_frame.colno, name);
30 // Print the 'main' frame (and everything before it) to stdout, skipping
31 // the printing of internal (and possibly fragile) libstd frames.
34 seen_main = name == "main";
39 // This goes at the bottom of the file so that we can change it
40 // without disturbing line numbers of the functions in the backtrace.
43 fn miri_get_backtrace(flags: u64) -> Box<[*mut ()]>;
44 fn miri_resolve_frame(ptr: *mut (), flags: u64) -> MiriFrame;