Skip to content

Commit 8909b3b

Browse files
committed
Bless miri tests
The new short backtrace markers place three frames in backtraces: the marker initially invoked by downstream code (should be inlined into such downstream code); the type-erased marker at a known-address (detected by the backtrace printing code); and the type-restoring callback shim (into which the actual callback should also be inlined). This differs from the status-quo ante, where the backtrace markers placed only a single frame into backtraces. Whilst these additional frames should have negligible impact on runtime performance (not only are they called, by the language runtime, at most twice: once during start before invoking main and once upon panic, if any; but furthermore, due to the aforementioned inlining, optimized assembly should be very similar - the additional frames will mostly only arise from additional debug info), the expected outputs from some miri tests require updating to reflect these backtrace changes.
1 parent 827da1d commit 8909b3b

10 files changed

Lines changed: 95 additions & 59 deletions

File tree

src/tools/miri/tests/fail/alloc/alloc_error_handler.stderr

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ LL | crate::process::abort()
1010
= note: stack backtrace:
1111
0: std::alloc::rust_oom::{closure#0}
1212
at RUSTLIB/std/src/alloc.rs:LL:CC
13-
1: std::sys::backtrace::__rust_end_short_backtrace
13+
1: std::backtrace::__rust_end_short_backtrace::{closure#0}
1414
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
15-
2: std::alloc::rust_oom
15+
2: std::sys::backtrace::call_with_short_backtrace_marker
16+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
17+
3: std::backtrace::__rust_end_short_backtrace
18+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
19+
4: std::alloc::rust_oom
1620
at RUSTLIB/std/src/alloc.rs:LL:CC
17-
3: std::alloc::_::__rust_alloc_error_handler
21+
5: std::alloc::_::__rust_alloc_error_handler
1822
at RUSTLIB/std/src/alloc.rs:LL:CC
19-
4: std::alloc::handle_alloc_error::rt_error
23+
6: std::alloc::handle_alloc_error::rt_error
2024
at RUSTLIB/alloc/src/alloc.rs:LL:CC
21-
5: std::alloc::handle_alloc_error
25+
7: std::alloc::handle_alloc_error
2226
at RUSTLIB/alloc/src/alloc.rs:LL:CC
23-
6: main
27+
8: main
2428
at tests/fail/alloc/alloc_error_handler.rs:LL:CC
2529

2630
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

src/tools/miri/tests/fail/panic/panic_abort1.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ LL | crate::process::abort();
2020
at RUSTLIB/std/src/panicking.rs:LL:CC
2121
4: std::panicking::panic_handler::{closure#0}
2222
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
5: std::sys::backtrace::__rust_end_short_backtrace
23+
5: std::backtrace::__rust_end_short_backtrace::{closure#0}
2424
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
25-
6: std::panicking::panic_handler
25+
6: std::sys::backtrace::call_with_short_backtrace_marker
26+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
27+
7: std::backtrace::__rust_end_short_backtrace
28+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
29+
8: std::panicking::panic_handler
2630
at RUSTLIB/std/src/panicking.rs:LL:CC
27-
7: main
31+
9: main
2832
at RUSTLIB/core/src/panic.rs:LL:CC
2933

3034
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

src/tools/miri/tests/fail/panic/panic_abort2.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ LL | crate::process::abort();
2020
at RUSTLIB/std/src/panicking.rs:LL:CC
2121
4: std::panicking::panic_handler::{closure#0}
2222
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
5: std::sys::backtrace::__rust_end_short_backtrace
23+
5: std::backtrace::__rust_end_short_backtrace::{closure#0}
2424
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
25-
6: std::panicking::panic_handler
25+
6: std::sys::backtrace::call_with_short_backtrace_marker
26+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
27+
7: std::backtrace::__rust_end_short_backtrace
28+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
29+
8: std::panicking::panic_handler
2630
at RUSTLIB/std/src/panicking.rs:LL:CC
27-
7: main
31+
9: main
2832
at RUSTLIB/core/src/panic.rs:LL:CC
2933

3034
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

src/tools/miri/tests/fail/panic/panic_abort3.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ LL | crate::process::abort();
2020
at RUSTLIB/std/src/panicking.rs:LL:CC
2121
4: std::panicking::panic_handler::{closure#0}
2222
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
5: std::sys::backtrace::__rust_end_short_backtrace
23+
5: std::backtrace::__rust_end_short_backtrace::{closure#0}
2424
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
25-
6: std::panicking::panic_handler
25+
6: std::sys::backtrace::call_with_short_backtrace_marker
26+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
27+
7: std::backtrace::__rust_end_short_backtrace
28+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
29+
8: std::panicking::panic_handler
2630
at RUSTLIB/std/src/panicking.rs:LL:CC
27-
7: main
31+
9: main
2832
at RUSTLIB/core/src/panic.rs:LL:CC
2933

3034
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

src/tools/miri/tests/fail/panic/panic_abort4.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ LL | crate::process::abort();
2020
at RUSTLIB/std/src/panicking.rs:LL:CC
2121
4: std::panicking::panic_handler::{closure#0}
2222
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
5: std::sys::backtrace::__rust_end_short_backtrace
23+
5: std::backtrace::__rust_end_short_backtrace::{closure#0}
2424
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
25-
6: std::panicking::panic_handler
25+
6: std::sys::backtrace::call_with_short_backtrace_marker
26+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
27+
7: std::backtrace::__rust_end_short_backtrace
28+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
29+
8: std::panicking::panic_handler
2630
at RUSTLIB/std/src/panicking.rs:LL:CC
27-
7: main
31+
9: main
2832
at RUSTLIB/core/src/panic.rs:LL:CC
2933

3034
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

src/tools/miri/tests/fail/tail_calls/cc-mismatch.stderr

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,33 @@ LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
99
= note: stack backtrace:
1010
0: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
1111
at RUSTLIB/core/src/ops/function.rs:LL:CC
12-
1: std::sys::backtrace::__rust_begin_short_backtrace
12+
1: std::backtrace::__rust_begin_short_backtrace::{closure#0}
1313
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
14-
2: std::rt::lang_start::{closure#0}
14+
2: std::sys::backtrace::call_with_short_backtrace_marker
15+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
16+
3: std::backtrace::__rust_begin_short_backtrace
17+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
18+
4: std::rt::lang_start::{closure#0}
1519
at RUSTLIB/std/src/rt.rs:LL:CC
16-
3: std::ops::function::impls::call_once
20+
5: std::ops::function::impls::call_once
1721
at RUSTLIB/core/src/ops/function.rs:LL:CC
18-
4: std::panicking::catch_unwind::do_call
22+
6: std::panicking::catch_unwind::do_call
1923
at RUSTLIB/std/src/panicking.rs:LL:CC
20-
5: std::panicking::catch_unwind
24+
7: std::panicking::catch_unwind
2125
at RUSTLIB/std/src/panicking.rs:LL:CC
22-
6: std::panic::catch_unwind
26+
8: std::panic::catch_unwind
2327
at RUSTLIB/std/src/panic.rs:LL:CC
24-
7: std::rt::lang_start_internal::{closure#0}
28+
9: std::rt::lang_start_internal::{closure#0}
2529
at RUSTLIB/std/src/rt.rs:LL:CC
26-
8: std::panicking::catch_unwind::do_call
30+
10: std::panicking::catch_unwind::do_call
2731
at RUSTLIB/std/src/panicking.rs:LL:CC
28-
9: std::panicking::catch_unwind
32+
11: std::panicking::catch_unwind
2933
at RUSTLIB/std/src/panicking.rs:LL:CC
30-
10: std::panic::catch_unwind
34+
12: std::panic::catch_unwind
3135
at RUSTLIB/std/src/panic.rs:LL:CC
32-
11: std::rt::lang_start_internal
36+
13: std::rt::lang_start_internal
3337
at RUSTLIB/std/src/rt.rs:LL:CC
34-
12: std::rt::lang_start
38+
14: std::rt::lang_start
3539
at RUSTLIB/std/src/rt.rs:LL:CC
3640

3741
error: aborting due to 1 previous error

src/tools/miri/tests/panic/panic1.stderr

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
thread 'main' ($TID) panicked at tests/panic/panic1.rs:LL:CC:
33
panicking from libstd
44
stack backtrace:
5-
0: std::panicking::panic_handler
5+
0: std::sys::backtrace::call_with_short_backtrace_marker
6+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
7+
1: std::panicking::panic_handler
68
at RUSTLIB/std/src/panicking.rs:LL:CC
7-
1: std::rt::panic_fmt
9+
2: std::rt::panic_fmt
810
at RUSTLIB/core/src/panicking.rs:LL:CC
9-
2: main
11+
3: main
1012
at tests/panic/panic1.rs:LL:CC
11-
3: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
13+
4: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
1214
at RUSTLIB/core/src/ops/function.rs:LL:CC
1315
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

src/tools/miri/tests/pass/backtrace/backtrace-api-v1.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ tests/pass/backtrace/backtrace-api-v1.rs:LL:CC (func_b)
44
tests/pass/backtrace/backtrace-api-v1.rs:LL:CC (func_a)
55
tests/pass/backtrace/backtrace-api-v1.rs:LL:CC (main)
66
RUSTLIB/core/src/ops/function.rs:LL:CC (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
7-
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::__rust_begin_short_backtrace)
7+
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::backtrace::__rust_begin_short_backtrace::{closure#0})
8+
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::call_with_short_backtrace_marker)
9+
RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::backtrace::__rust_begin_short_backtrace)
810
RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0})
911
RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once)
1012
RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::catch_unwind::do_call)

src/tools/miri/tests/pass/backtrace/backtrace-global-alloc.stderr

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@
22
at tests/pass/backtrace/backtrace-global-alloc.rs:LL:CC
33
1: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
44
at RUSTLIB/core/src/ops/function.rs:LL:CC
5-
2: std::sys::backtrace::__rust_begin_short_backtrace
5+
2: std::backtrace::__rust_begin_short_backtrace::{closure#0}
66
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
7-
3: std::rt::lang_start::{closure#0}
7+
3: std::sys::backtrace::call_with_short_backtrace_marker
8+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
9+
4: std::backtrace::__rust_begin_short_backtrace
10+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
11+
5: std::rt::lang_start::{closure#0}
812
at RUSTLIB/std/src/rt.rs:LL:CC
9-
4: std::ops::function::impls::call_once
13+
6: std::ops::function::impls::call_once
1014
at RUSTLIB/core/src/ops/function.rs:LL:CC
11-
5: std::panicking::catch_unwind::do_call
15+
7: std::panicking::catch_unwind::do_call
1216
at RUSTLIB/std/src/panicking.rs:LL:CC
13-
6: std::panicking::catch_unwind
17+
8: std::panicking::catch_unwind
1418
at RUSTLIB/std/src/panicking.rs:LL:CC
15-
7: std::panic::catch_unwind
19+
9: std::panic::catch_unwind
1620
at RUSTLIB/std/src/panic.rs:LL:CC
17-
8: std::rt::lang_start_internal::{closure#0}
21+
10: std::rt::lang_start_internal::{closure#0}
1822
at RUSTLIB/std/src/rt.rs:LL:CC
19-
9: std::panicking::catch_unwind::do_call
23+
11: std::panicking::catch_unwind::do_call
2024
at RUSTLIB/std/src/panicking.rs:LL:CC
21-
10: std::panicking::catch_unwind
25+
12: std::panicking::catch_unwind
2226
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
11: std::panic::catch_unwind
27+
13: std::panic::catch_unwind
2428
at RUSTLIB/std/src/panic.rs:LL:CC
25-
12: std::rt::lang_start_internal
29+
14: std::rt::lang_start_internal
2630
at RUSTLIB/std/src/rt.rs:LL:CC
27-
13: std::rt::lang_start
31+
15: std::rt::lang_start
2832
at RUSTLIB/std/src/rt.rs:LL:CC

src/tools/miri/tests/pass/backtrace/backtrace-std.stderr

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,31 @@
1010
at tests/pass/backtrace/backtrace-std.rs:LL:CC
1111
5: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
1212
at RUSTLIB/core/src/ops/function.rs:LL:CC
13-
6: std::sys::backtrace::__rust_begin_short_backtrace
13+
6: std::backtrace::__rust_begin_short_backtrace::{closure#0}
1414
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
15-
7: std::rt::lang_start::{closure#0}
15+
7: std::sys::backtrace::call_with_short_backtrace_marker
16+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
17+
8: std::backtrace::__rust_begin_short_backtrace
18+
at RUSTLIB/std/src/sys/backtrace.rs:LL:CC
19+
9: std::rt::lang_start::{closure#0}
1620
at RUSTLIB/std/src/rt.rs:LL:CC
17-
8: std::ops::function::impls::call_once
21+
10: std::ops::function::impls::call_once
1822
at RUSTLIB/core/src/ops/function.rs:LL:CC
19-
9: std::panicking::catch_unwind::do_call
23+
11: std::panicking::catch_unwind::do_call
2024
at RUSTLIB/std/src/panicking.rs:LL:CC
21-
10: std::panicking::catch_unwind
25+
12: std::panicking::catch_unwind
2226
at RUSTLIB/std/src/panicking.rs:LL:CC
23-
11: std::panic::catch_unwind
27+
13: std::panic::catch_unwind
2428
at RUSTLIB/std/src/panic.rs:LL:CC
25-
12: std::rt::lang_start_internal::{closure#0}
29+
14: std::rt::lang_start_internal::{closure#0}
2630
at RUSTLIB/std/src/rt.rs:LL:CC
27-
13: std::panicking::catch_unwind::do_call
31+
15: std::panicking::catch_unwind::do_call
2832
at RUSTLIB/std/src/panicking.rs:LL:CC
29-
14: std::panicking::catch_unwind
33+
16: std::panicking::catch_unwind
3034
at RUSTLIB/std/src/panicking.rs:LL:CC
31-
15: std::panic::catch_unwind
35+
17: std::panic::catch_unwind
3236
at RUSTLIB/std/src/panic.rs:LL:CC
33-
16: std::rt::lang_start_internal
37+
18: std::rt::lang_start_internal
3438
at RUSTLIB/std/src/rt.rs:LL:CC
35-
17: std::rt::lang_start
39+
19: std::rt::lang_start
3640
at RUSTLIB/std/src/rt.rs:LL:CC

0 commit comments

Comments
 (0)