Commit graph

58 commits

Author SHA1 Message Date
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
Eduard-Mihai Burtescu
ef043a7c43 Rollup merge of #39961 - redox-os:redox, r=alexcrichton
Fix compilation on Redox

This updates the Redox sys module to fix compilation.

The functions peek and peek_from are added to TcpStream and UdpSocket as stubs. The sys::backtrace module is now included correctly
2017-02-25 14:13:24 +02:00
Yamakaky
d50e4cc064
Improve backtrace formating while panicking.
- `RUST_BACKTRACE=full` prints all the informations (old behaviour)
- `RUST_BACKTRACE=(0|no)` disables the backtrace.
- `RUST_BACKTRACE=<everything else>` (including `1`) shows a simplified
  backtrace, without the function addresses and with cleaned filenames
  and symbols. Also removes some unneded frames at the beginning and the
  end.

Fixes #37783.

PR is #38165.
2017-02-15 14:24:37 -05:00
Clar Charr
963843b1b3 Conversions between CStr/OsStr/Path and boxes. 2017-02-14 14:18:43 -05:00
Jeremy Soller
cbafac5ba1 Fix compilation on Redox 2017-02-08 20:01:57 -07:00
Jack O'Connor
2a345bbcc1 make Child::try_wait return io::Result<Option<ExitStatus>>
This is much nicer for callers who want to short-circuit real I/O errors
with `?`, because they can write this

    if let Some(status) = foo.try_wait()? {
        ...
    } else {
        ...
    }

instead of this

    match foo.try_wait() {
        Ok(status) => {
            ...
        }
        Err(err) if err.kind() == io::ErrorKind::WouldBlock => {
            ...
        }
        Err(err) => return Err(err),
    }

The original design of `try_wait` was patterned after the `Read` and
`Write` traits, which support both blocking and non-blocking
implementations in a single API. But since `try_wait` is never blocking,
it makes sense to optimize for the non-blocking case.

Tracking issue: https://github.com/rust-lang/rust/issues/38903
2017-02-06 23:04:47 -05:00
Jeremy Soller
b13d9ce222 Add dev and ino to MetadataExt 2017-01-30 20:19:00 -07:00
Guillaume Gomez
fd8988eb0b Rollup merge of #39212 - redox-os:master, r=brson
Use libc errno in Redox submodule

This fixes https://github.com/redox-os/redox/issues/830, and is necessary when using libc in Redox
2017-01-25 17:08:16 +01:00
Utkarsh Kukreti
9d912b683a libstd: replace all try! with ? in documentation examples
See #38644.
2017-01-22 21:07:38 +05:30
Jeremy Soller
fe791d7886 Use libc errno 2017-01-20 18:45:14 -07:00
Jeremy Soller
b10e06166e Add try_wait to Redox process 2017-01-13 15:41:50 -07:00
Jeremy Soller
57950faeb6 Add socket timeout and ttl support 2016-12-30 10:38:53 -07:00
Jeremy Soller
88df0e3918 Fix arguments on Redox 2016-12-27 10:55:41 -07:00
Jeremy Soller
9f9489b976 Cloexec when creating directories 2016-12-23 12:21:29 -07:00
Jeremy Soller
a0a600f0c6 Add Debug to OpenOptions and DirBuilder 2016-12-23 09:42:38 -07:00
bors
99913c5ead Auto merge of #38401 - redox-os:redox_cross, r=brson
Redox Cross Compilation

I will admit - there are things here that I wish I did not have to do. This completes the ability to create a cross compiler from the rust repository for `x86_64-unknown-redox`. I will document this PR with inline comments explaining some things.

[View this gist to see how a cross compiler is built](https://gist.github.com/jackpot51/6680ad973986e84d69c79854249f2b7e)

Prior discussion of a smaller change is here: https://github.com/rust-lang/rust/pull/38366
2016-12-23 09:09:26 +00:00
Jeremy Soller
1eb6c44b1c Remove start functions, use newlib instead of openlibm + ralloc 2016-12-22 16:13:14 -07:00
Jeremy Soller
7d3ae87453 Add RawFd traits for net 2016-12-21 20:19:32 -07:00
Jeremy Soller
bf50acbc09 Fix tidy 2016-12-20 21:29:42 -07:00
Jeremy Soller
fd4bc88880 Fix building without backtrace 2016-12-20 17:52:47 -07:00
Jeremy Soller
65eecf8bb3 Readd statvfs 2016-12-20 16:12:36 -07:00
Jeremy Soller
e55596fa20 Move rt into sys::rt, fix tidy 2016-12-20 15:26:58 -07:00
Jeremy Soller
57bc1a982e Add arm syscalls 2016-12-20 11:17:09 -07:00
Aaron Turon
9a5cef4de5 Address fallout 2016-12-16 19:42:17 -08:00
Jeremy Soller
773a0a2edb Add start functions, switch allocation crate to ralloc 2016-12-15 16:33:23 -07:00
Jeremy Soller
3e7543a16e WIP: Cross-compilation for Redox target 2016-12-15 16:31:01 -07:00
Jeremy Soller
daaa231876 Fix tidy checks 2016-12-12 15:57:19 -07:00
Jeremy Soller
c61baa0fc7 Fix accidental removal of import 2016-12-12 14:30:41 -07:00
Jeremy Soller
056ebccee3 Rollback prefix 2016-12-12 14:21:44 -07:00
Jeremy Soller
729442206c Cleanup env 2016-11-30 21:50:17 -07:00
Jeremy Soller
e68393397a Commit to fix make tidy 2016-11-28 21:07:26 -07:00
Jeremy Soller
6378c77716 Remove file path from std::fs::File 2016-11-28 20:21:19 -07:00
Jeremy Soller
1d0bba8224 Move stdout/err flush into sys 2016-11-28 18:25:47 -07:00
Jeremy Soller
2ec21327f2 Switch to using Prefix::Verbatim 2016-11-28 18:19:17 -07:00
Jeremy Soller
746222fd9d Switch to using syscall crate directly - without import 2016-11-28 18:07:19 -07:00
Jeremy Soller
d73d32f58d Fix canonicalize 2016-11-25 19:53:21 -07:00
Jeremy Soller
3a1bb2ba26 Use O_DIRECTORY 2016-11-25 18:23:19 -07:00
Jeremy Soller
6733074c84 Allow setting nonblock on sockets 2016-11-23 14:22:39 -07:00
Jeremy Soller
4a0bc71bb7 Add File set_permissions 2016-11-23 08:24:49 -07:00
Jeremy Soller
2556400a5d Replace setuid, setgid with setreuid, setregid 2016-11-17 14:15:58 -07:00
Jeremy Soller
f01add1a3b Add signal support, better exec error handling 2016-11-17 10:22:07 -07:00
Jeremy Soller
267bc54fbd Use chmod instead of fcntl to change file perms 2016-11-15 17:07:55 -07:00
Jeremy Soller
2e5c821619 Add set_perm 2016-11-15 16:12:30 -07:00
Jeremy Soller
73f24d47de Simple implementation of read2 2016-11-14 20:56:06 -07:00
Jeremy Soller
de68aced95 Add current_exe support 2016-11-14 19:08:48 -07:00
Jeremy Soller
18bf0540bf Fix redox prefix handling 2016-11-14 15:02:18 -07:00
Jeremy Soller
a0b5dfef2a Add fcntl 2016-11-14 12:15:11 -07:00
Jeremy Soller
79a8c272fb Fix readdir 2016-11-10 19:58:19 -07:00
Jeremy Soller
a90850995f Fixes for stdio and processes on Redox 2016-11-10 19:33:59 -07:00
Jeremy Soller
ced32a08f3 Fix exec 2016-11-09 20:52:30 -07:00