rust/src/libstd/sys/redox
bors 4be034e622 Auto merge of #38165 - Yamakaky:better-backtrace, r=petrochenkov
Improve backtrace formating while panicking.

Fixes #37783.

Done:

- Fix alignment of file paths for better readability
- `RUST_BACKTRACE=full` prints all the informations (current behaviour)
- `RUST_BACKTRACE=(short|yes)` is the default and does:
  - Skip irrelevant frames at the beginning and the end
  - Remove function address
  - Remove the current directory from the absolute paths
  - Remove `::hfabe6541873` at the end of the symbols
- `RUST_BACKTRACE=(0|no)` disables the backtrace.
- `RUST_BACKTRACE=<everything else>` is equivalent to `short` for
  backward compatibility.
- doc
- More uniform printing across platforms.

Removed, TODO in a new PR:

- Remove path prefix for libraries and libstd

Example of short backtrace:
```rust
fn fail() {
    panic!();
}

fn main() {
    let closure = || fail();
    closure();
}
```
Short:
```
thread 'main' panicked at 'explicit panic', t.rs:2
Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: t::fail
            at ./t.rs:2
   1: t::main::{{closure}}
            at ./t.rs:6
   2: t::main
            at ./t.rs:7
```
Full:
```
thread 'main' panicked at 'This function never returns!', t.rs:2
stack backtrace:
   0:     0x558ddf666478 - std::sys:👿:backtrace::tracing:👿:unwind_backtrace::hec84c9dd8389cc5d
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x558ddf65d90e - std::sys_common::backtrace::_print::hfa25f8b31f4b4353
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:71
   2:     0x558ddf65cb5e - std::sys_common::backtrace::print::h9b711e11ac3ba805
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:60
   3:     0x558ddf66796e - std::panicking::default_hook::{{closure}}::h736d216e74748044
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:355
   4:     0x558ddf66743c - std::panicking::default_hook::h16baff397e46ea10
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:371
   5:     0x558ddf6682bc - std::panicking::rust_panic_with_hook::h6d5a9bb4eca42c80
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:559
   6:     0x558ddf64ea93 - std::panicking::begin_panic::h17dc549df2f10b99
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:521
   7:     0x558ddf64ec42 - t::diverges::he6bc43fc925905f5
                               at /tmp/p/t.rs:2
   8:     0x558ddf64ec5a - t::main::h0ffc20356b8a69c0
                               at /tmp/p/t.rs:6
   9:     0x558ddf6687f5 - core::ops::FnOnce::call_once::hce41f19c0db56f93
  10:     0x558ddf667cde - std::panicking::try::do_call::hd4c8c97efb4291df
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:464
  11:     0x558ddf698d77 - __rust_try
  12:     0x558ddf698c57 - __rust_maybe_catch_panic
                               at /home/yamakaky/dev/rust/rust/src/libpanic_unwind/lib.rs:98
  13:     0x558ddf667adb - std::panicking::try::h2c56ed2a59ec1d12
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:440
  14:     0x558ddf66cc9a - std::panic::catch_unwind::h390834e0251cc9af
                               at /home/yamakaky/dev/rust/rust/src/libstd/panic.rs:361
  15:     0x558ddf6809ee - std::rt::lang_start::hb73087428e233982
                               at /home/yamakaky/dev/rust/rust/src/libstd/rt.rs:57
  16:     0x558ddf64ec92 - main
  17:     0x7fecb869e290 - __libc_start_main
  18:     0x558ddf64e8b9 - _start
  19:                0x0 - <unknown>
```
2017-02-27 17:21:37 +00:00
..
ext Add dev and ino to MetadataExt 2017-01-30 20:19:00 -07:00
net Fix compilation on Redox 2017-02-08 20:01:57 -07:00
syscall Add socket timeout and ttl support 2016-12-30 10:38:53 -07:00
args.rs Fix arguments on Redox 2016-12-27 10:55:41 -07:00
backtrace.rs Improve backtrace formating while panicking. 2017-02-15 14:24:37 -05:00
condvar.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
env.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
fast_thread_local.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
fd.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
fs.rs Cloexec when creating directories 2016-12-23 12:21:29 -07:00
memchr.rs Add redox system 2016-10-27 20:57:49 -06:00
mod.rs Fix compilation on Redox 2017-02-08 20:01:57 -07:00
mutex.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
os.rs Use libc errno 2017-01-20 18:45:14 -07:00
os_str.rs Conversions between CStr/OsStr/Path and boxes. 2017-02-14 14:18:43 -05:00
path.rs Fix tidy checks 2016-12-12 15:57:19 -07:00
pipe.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
process.rs make Child::try_wait return io::Result<Option<ExitStatus>> 2017-02-06 23:04:47 -05:00
rand.rs WIP: Cross-compilation for Redox target 2016-12-15 16:31:01 -07:00
rwlock.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
stack_overflow.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
stdio.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
thread.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
thread_local.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00
time.rs Commit to fix make tidy 2016-11-28 21:07:26 -07:00