Open DK26 opened 3 years ago
Simply testing the example code as provided I find,
thread '<unnamed>' panicked at 'malice is panicking', src/main.rs:14:5
stack backtrace:
0: std::panicking::begin_panic
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:497
1: test_crate::malice
at ./src/main.rs:14
2: test_crate::bob
at ./src/main.rs:10
3: test_crate::alice::{{closure}}
at ./src/main.rs:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'malice is panicking', src/main.rs:14:5
stack backtrace:
0: std::panicking::begin_panic
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:497
1: test_crate::malice
at ./src/main.rs:14
2: test_crate::bob
at ./src/main.rs:10
3: test_crate::main
at ./src/main.rs:21
4: core::ops::function::FnOnce::call_once
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/ops/function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
, under,
rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0
, so this might be restricted to O-windows
or is that already known?
Bisected to nightly-2020-08-09
found 13 bors merge commits in the specified range
commit[0] 2020-08-07UTC: Auto merge of #75255 - davidtwco:polymorphisation-symbol-mangling-v0-upvar-closures, r=lcnr
commit[1] 2020-08-07UTC: Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
commit[2] 2020-08-08UTC: Auto merge of #75048 - eggyal:force-no-tco-start-backtrace-frame, r=Mark-Simulacrum
commit[3] 2020-08-08UTC: Auto merge of #74877 - lcnr:min_const_generics, r=oli-obk
commit[4] 2020-08-08UTC: Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor
commit[5] 2020-08-08UTC: Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkov
commit[6] 2020-08-08UTC: Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrum
commit[7] 2020-08-08UTC: Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
commit[8] 2020-08-08UTC: Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodt
commit[9] 2020-08-08UTC: Auto merge of #74533 - nikic:issue-74425, r=eddyb
commit[10] 2020-08-08UTC: Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr
commit[11] 2020-08-08UTC: Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay
commit[12] 2020-08-08UTC: Auto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt
ERROR: no commits between 09f4c9f5082f78b0adcee83d3ab4337e000cd28e and
ceedf1d5febd65b012b8bcd513d70a0a6a091210 within last 167 days
(if I've done correctly), bisected with script:
$ RUST_SRC_REPO=~/rust cargo-bisect-rustc --preserve --start=2020-06-01 --end=2020-10-08 --script=./test.sh
$ cat ./test.sh
#!/bin/sh
RUST_BACKTRACE=1 cargo run 2>&1 | grep __libc_start_main
Assigning priority as discussed as part of the Prioritization Working Group procedure and removing I-prioritize
.
@rustbot label -I-prioritize +P-medium
I think #75048 was the likely culprit.
Is the backtrace correctly described with RUST_BACKTRACE=full
?
Is the backtrace correctly described with
RUST_BACKTRACE=full
?
@eggyal In my local test with RUST_BACKTRACE=full
seems to print the full stacktrace as expected.
(I don't have access to the reference mentioned by the issue reporter so I cannot compare)
Has this issue been fixed?
The issue still occurs with 1.54 on Windows.
C:\Users\lukas>rustc +1.47.0 panic_unwinding.rs
C:\Users\lukas>set RUST_BACKTRACE=1
C:\Users\lukas>panic_unwinding.exe
thread '<unnamed>' panicked at 'malice is panicking!', panic_unwinding.rs:16:5
stack backtrace:
0: std::panicking::begin_panic
1: panic_unwinding::alice::{{closure}}
2: panic_unwinding::alice::{{closure}}
3: panic_unwinding::alice::{{closure}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'malice is panicking!', panic_unwinding.rs:16:5
stack backtrace:
0: std::panicking::begin_panic
1: panic_unwinding::alice::{{closure}}
2: panic_unwinding::alice::{{closure}}
3: panic_unwinding::alice::{{closure}}
4: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
C:\Users\lukas>rustc +1.54.0 panic_unwinding.rs
C:\Users\lukas>panic_unwinding.exe
thread '<unnamed>' panicked at 'malice is panicking!', panic_unwinding.rs:16:5
stack backtrace:
0: std::panicking::begin_panic
1: panic_unwinding::alice::{{closure}}
2: panic_unwinding::alice::{{closure}}
3: panic_unwinding::alice::{{closure}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'malice is panicking!', panic_unwinding.rs:16:5
stack backtrace:
0: std::panicking::begin_panic
1: panic_unwinding::alice::{{closure}}
2: panic_unwinding::alice::{{closure}}
3: panic_unwinding::alice::{{closure}}
4: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Thanks for testing it! Marking this as a Windows issue. I've tested it on both Linux and Mac, where it works fine.
It also works fine on x86_64-pc-windows-gnu
in wine
.
I can still reproduce this on 1.61.0 but with a weird caveat I haven't seen mentioned anywhere: it works correctly through cargo but not rustc directly?
```
>cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target\debug\windows-panic-trace.exe`
thread '
```
> rustc .\src\main.rs
> .\main.exe
thread '
Also RUST_BACKTRACE=full does not seem to resolve the problem
it works correctly through cargo but not rustc directly?
> rustc .\src\main.rs
If you don't specify -C debuginfo
, it defaults to 0
(no debug info). cargo's default dev profile uses debuginfo=2
(full debug info). That's the likely difference.
Yup, that did the trick
> rustc -C debuginfo=2 .\src\main.rs
> .\main.exe
thread '<unnamed>' panicked at 'malice is panicking!', .\src\main.rs:16:5
stack backtrace:
0: std::panicking::begin_panic<str>
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\std\src\panicking.rs:616
1: main::malice
at .\src\main.rs:16
2: main::bob
at .\src\main.rs:12
3: main::alice::closure$0
at .\src\main.rs:7
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'malice is panicking!', .\src\main.rs:16:5
stack backtrace:
0: std::panicking::begin_panic<str>
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\std\src\panicking.rs:616
1: main::malice
at .\src\main.rs:16
2: main::bob
at .\src\main.rs:12
3: main::main
at .\src\main.rs:23
4: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
So to confirm, this is considered fixed? Or do we still need to handle the debuginfo=0
situation better?
This still happens unless -C debuginfo
is set to 1 or higher (which cargo's dev profile will do by default).
@wesleywiser suggests that:
We should perhaps consider adjusting the default compiler behavior to include basic debuginfo unless the user specifically asks for none
@ChrisDenton Do you mean for the release profile? I don't think we should be adding any debuginfo to release builds unless the user requests that.
I don't personally have a strong opinion here tbh but I think that was what @wesleywiser was saying. I could be mistaken though.
Ok, just to clarify the issue here. When using debuginfo=0
no new debuginfo is created but the prebuilt std does include debuginfo so a pdb file is created anyway.
Something about this seems to confuse the backtrace. Our backtrace-rs defers to dbghelp.dll so this is probably either a bug in the compiler or in dbghelp.dll. It could also be a problem with the way backtrace-rs uses dbghelp.dll.
Here's a demo of the issue. The debuginfo=0
seems to get messed up when not in std functions.
> cat panic.rs
fn main() {
panic!("Oh no!");
}
Add the T-compiler tag in case they want to look at this.
As I'm learning the language from a book ("The Complete Rust Programming Reference Guide" p. 229-230), and was executing the
panic!
macro in a multi-thread environment, I've noticed the unwinding from the book is different from the one I've got where the one I've got is not informative or helpful, and seems wrong where the one in book seems to be OK.Code
I tried this code:
I expected the backtrace to include the function names as they were called, all the way from the entry point of the threads.
Instead, all functions were named the same: (env:
RUST_BACKTRACE=1
)Version it worked on
I don't know from when is the regression. The book is using an old version of Rust: 1.32.0
Version with regression
I use the most current version: Rust 1.47.0
rustc --version --verbose
: