rust/library/std/src
Yuki Okushi 84e18828d4
Rollup merge of #87602 - wesleywiser:partially_fix_short_backtraces_windows_optimized, r=dtolnay
[backtraces]: look for the `begin` symbol only after seeing `end`

On `x86_64-pc-windows-msvc`, we often get backtraces which look like
    this:

    ```
    10:     0x7ff77e0e9be5 - std::panicking::rust_panic_with_hook
    11:     0x7ff77e0e11b4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5769736bdb11136c
    12:     0x7ff77e0e116f - std::sys_common::backtrace::__rust_end_short_backtrace::h61c7ecb1b55338ae
    13:     0x7ff77e0f89dd - std::panicking::begin_panic::h8e60ef9f82a41805
    14:     0x7ff77e0e108c - d
    15:     0x7ff77e0e1069 - c
    16:     0x7ff77e0e1059 - b
    17:     0x7ff77e0e1049 - a
    18:     0x7ff77e0e1039 - core::ptr::drop_in_place<std::rt::lang_start<()>::{{closure}}>::h1bfcd14d5e15ba81
    19:     0x7ff77e0e1186 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5769736bdb11136c
    20:     0x7ff77e0e100c - std::rt::lang_start::{{closure}}::ha054184bbf9921e3
    ```

Notice that `__rust_begin_short_backtrace` appears on frame 11 before
    `__rust_end_short_backtrace` on frame 12. This is because in typical
    release binaries without debug symbols, dbghelp.dll, which we use to walk
    and symbolize the stack, does not know where CGU internal functions
    start or end and so the closure invoked by `__rust_end_short_backtrace`
    is incorrectly described as `__rust_begin_short_backtrace` because it
    happens to be near that symbol.

While that can obviously change, this has been happening quite
    consistently since #75048. Since this is a very small change to the std
    and the change makes sense by itself, I think this is worth doing.

This doesn't completely resolve the situation for release binaries on
    Windows, since without debug symbols, the stack printed can still show
    incorrect symbol names (this is why the test uses `#[no_mangle]`) but it
    does slightly improve the situation in that you see the same backtrace
    you would see with `RUST_BACKTRACE=full` or in a debugger (without the
    uninteresting bits at the top and bottom).

Fixes part of #87481
2021-07-30 16:27:01 +09:00
..
backtrace Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
collections Rollup merge of #87330 - inquisitivecrystal:extend-reserve, r=JohnTitor 2021-07-28 18:28:14 +09:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f32 More lerp tests, altering lerp docs 2021-06-13 14:00:15 -04:00
f64 More lerp tests, altering lerp docs 2021-06-13 14:00:15 -04:00
ffi Remove "length" doc aliases 2021-06-30 20:28:51 +01:00
fs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
io Auto merge of #87445 - amalik18:issue-83584-fix, r=kennytm 2021-07-30 04:34:13 +00:00
lazy Upgrade wasm32 image to Ubuntu 20.04 2021-02-06 13:05:56 +01:00
net Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path Refactor parse_prefix on Windows 2020-11-07 16:15:48 +01:00
prelude Move asm! and global_asm! to core::arch 2021-07-18 18:30:58 -04:00
process Test that env_clear works on Windows 2021-06-24 09:32:24 +01:00
sync Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
sys Rollup merge of #87594 - devnexen:netbsd_fs_getfiledescriptor_path, r=joshtriplett 2021-07-30 16:27:00 +09:00
sys_common [backtraces]: look for the begin symbol only after seeing end 2021-07-29 13:51:27 -04:00
thread Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
time Duration::zero() -> Duration::ZERO 2020-10-21 20:44:03 -07:00
alloc.rs Rename rterr to rtprintpanic 2021-05-19 15:52:09 +02:00
ascii.rs Convert many files to intra-doc links 2020-09-02 17:37:40 -04:00
backtrace.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
env.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
error.rs Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett 2021-06-15 17:40:03 +09:00
f32.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
f64.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
fs.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
keyword_docs.rs Fix a few misspellings. 2021-06-25 13:18:56 -07:00
lazy.rs Use DebugStruct::finish_non_exhaustive() in std. 2021-03-27 13:29:23 +01:00
lib.rs Auto merge of #86998 - m-ou-se:const-panic-fmt-as-str, r=oli-obk 2021-07-29 07:12:07 +00:00
macros.rs expand: Support helper attributes for built-in derive macros 2021-07-13 21:59:22 +03:00
num.rs postpone stabilizaton by one release 2021-06-22 10:20:56 +01:00
panic.rs Auto merge of #87445 - amalik18:issue-83584-fix, r=kennytm 2021-07-30 04:34:13 +00:00
panicking.rs Make const panic!("..") work in Rust 2021. 2021-07-28 16:10:41 +02:00
path.rs Auto merge of #85747 - maxwase:path-symlinks-methods, r=m-ou-se 2021-06-18 17:13:19 +00:00
primitive_docs.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
process.rs s/die/terminate/ in abort documentation. 2021-07-05 12:43:45 +02:00
rt.rs Change entry point to 🛡️ against 💥 💥-payloads 2021-06-19 11:46:56 +03:00
time.rs Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00