Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/miri
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2f84bfc57dd0ef22269bb84dae10f71e5e23e85d
Choose a base ref
...
head repository: rust-lang/miri
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 266b75faecd11e6a0b63fb6526fac56cda22bebc
Choose a head ref
  • 19 commits
  • 15 files changed
  • 4 contributors

Commits on Sep 27, 2020

  1. Remove assume intrinsic from EvalContextExt

    It has been moved to rustc_mir.
    tesuji committed Sep 27, 2020
    Configuration menu
    Copy the full SHA
    56ea94d View commit details
    Browse the repository at this point in the history
  2. Auto merge of #1555 - lzutao:upstream-assume-const, r=RalfJung

    Remove assume intrinsic from EvalContextExt
    
    Waiting for rust-lang/rust#76973 merged.
    bors committed Sep 27, 2020
    Configuration menu
    Copy the full SHA
    aa832c1 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2020

  1. Add API for capturing backtrace

    This PR adds two new Miri-defined extern functions:
    `miri_get_backtrace` and `miri_resolve_frame`, which are documented in
    the README. Together, they allow obtaining a backtrace for the currently
    executing program.
    
    I've added a test showing how these APIs are used. I've also prepared a
    companion PR `backtrace-rs`, which will allow
    `backtrace::Backtrace::new()` to work automatically under Miri.
    
    Once these two PRs are merged, we will be able to print backtraces from
    the normal Rust panic hook (since libstd is now using backtrace-rs).
    
    A few notes:
    * Resolving the backtrace frames is *very* slow - you can actually see
      each line being printed out one at a time. Some local testing showed
      that this is not (primrary) caused by resolving a `Span` - it seems
      to be just Miri being slow.
    * For the first time, we now interact directly with a user-defined
      struct (instead of just executing the user-provided MIR that
      manipulates the struct). To allow for future changes, I've added
      a 'version' parameter (currently required to be 0). This should allow
      us to change the `MiriFrame` struct should the need ever arise.
    * I used the approach suggested by @oli-obk - a returned backtrace
      pointer consists of a base function allocation, with the 'offset'
      used to encode the `Span.lo`. This allows losslessly reconstructing
      the location information in `miri_resolve_frame`.
    * There are a few quirks on the `backtrace-rs` side:
      * `backtrace-rs` calls `getcwd()` by default to try to simplify
        the filename. This results in an isolation error by default,
        which could be annoying when printing a backtrace from libstd.
      * `backtrace-rs` tries to remove 'internal' frames (everything between
         the call to `Backtrace::new()` and the internal API call made by
         backtrace-rs) by comparing the returned frame pointer value to
         a Rust function pointer. This doesn't work due to the way we
         construct the frame pointers passed to the caller. We could
         attempt to support this kind of comparison, or just add a
        `#[cfg(miri)]` and ignore the frames ourselves.
    Aaron1011 committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    22f1eb0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ae18659 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ef43c5a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9fc384f View commit details
    Browse the repository at this point in the history
  5. Move things around

    Aaron1011 committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    b89f656 View commit details
    Browse the repository at this point in the history
  6. Explain encoding scheme

    Aaron1011 committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    f756e3a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e1bce19 View commit details
    Browse the repository at this point in the history
  8. Update README

    Aaron1011 committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    11e2dbd View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    dba7f13 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5571bcf View commit details
    Browse the repository at this point in the history
  11. fix typo

    RalfJung authored and Aaron1011 committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    b1837d0 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    7fba3c2 View commit details
    Browse the repository at this point in the history
  13. Auto merge of #1559 - Aaron1011:new-miri-backtrace, r=RalfJung

    Add API for capturing backtrace
    
    This PR adds two new Miri-defined extern functions:
    `miri_get_backtrace` and `miri_resolve_frame`, which are documented in
    the README. Together, they allow obtaining a backtrace for the currently
    executing program.
    
    I've added a test showing how these APIs are used. I've also prepared a
    companion PR `backtrace-rs`, which will allow
    `backtrace::Backtrace::new()` to work automatically under Miri.
    
    Once these two PRs are merged, we will be able to print backtraces from
    the normal Rust panic hook (since libstd is now using backtrace-rs).
    
    A few notes:
    * Resolving the backtrace frames is *very* slow - you can actually see
      each line being printed out one at a time. Some local testing showed
      that this is not (primrary) caused by resolving a `Span` - it seems
      to be just Miri being slow.
    * For the first time, we now interact directly with a user-defined
      struct (instead of just executing the user-provided MIR that
      manipulates the struct). To allow for future changes, I've added
      a 'version' parameter (currently required to be 0). This should allow
      us to change the `MiriFrame` struct should the need ever arise.
    * I used the approach suggested by `@oli-obk` - a returned backtrace
      pointer consists of a base function allocation, with the 'offset'
      used to encode the `Span.lo`. This allows losslessly reconstructing
      the location information in `miri_resolve_frame`.
    * There are a few quirks on the `backtrace-rs` side:
      * `backtrace-rs` calls `getcwd()` by default to try to simplify
        the filename. This results in an isolation error by default,
        which could be annoying when printing a backtrace from libstd.
      * `backtrace-rs` tries to remove 'internal' frames (everything between
         the call to `Backtrace::new()` and the internal API call made by
         backtrace-rs) by comparing the returned frame pointer value to
         a Rust function pointer. This doesn't work due to the way we
         construct the frame pointers passed to the caller. We could
         attempt to support this kind of comparison, or just add a
        `#[cfg(miri)]` and ignore the frames ourselves.
    bors committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    510e62c View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2020

  1. Configuration menu
    Copy the full SHA
    eaf56c5 View commit details
    Browse the repository at this point in the history
  2. Auto merge of #1565 - RalfJung:rustup, r=RalfJung

    rustup; adjust for rustc_driver changes
    bors committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    e046963 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2020

  1. Configuration menu
    Copy the full SHA
    17e16aa View commit details
    Browse the repository at this point in the history
  2. Auto merge of #1566 - RalfJung:backtrace, r=RalfJung

    normalize backtrace stderr even more
    
    The test previously failed on rustc CI with this diff:
    ```
     $DIR/backtrace-api.rs:21:59 (func_c)
     $DIR/backtrace-api.rs:20:53 (func_b)
     $DIR/backtrace-api.rs:19:50 (func_a)
     $DIR/backtrace-api.rs:25:18 (main)
    -RUSTLIB/src/rust/library/core/src/ops/function.rs:LL:COL (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
    -RUSTLIB/src/rust/library/std/src/sys_common/backtrace.rs:LL:COL (std::sys_common::backtrace::__rust_begin_short_backtrace)
    -RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start::{closure#0})
    -RUSTLIB/src/rust/library/core/src/ops/function.rs:LL:COL (std::ops::function::impls::call_once)
    -RUSTLIB/src/rust/library/std/src/panicking.rs:LL:COL (std::panicking::r#try::do_call)
    -RUSTLIB/src/rust/library/std/src/panicking.rs:LL:COL (std::panicking::r#try)
    -RUSTLIB/src/rust/library/std/src/panic.rs:LL:COL (std::panic::catch_unwind)
    -RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start_internal)
    -RUSTLIB/src/rust/library/std/src/rt.rs:LL:COL (std::rt::lang_start)
    +/checkout/library/core/src/ops/function.rs:227:5 (<fn() as std::ops::FnOnce<()>>::call_once - shim(fn()))
    +/checkout/library/std/src/sys_common/backtrace.rs:137:18 (std::sys_common::backtrace::__rust_begin_short_backtrace)
    +/checkout/library/std/src/rt.rs:66:18 (std::rt::lang_start::{closure#0})
    +/checkout/library/core/src/ops/function.rs:259:13 (std::ops::function::impls::call_once)
    +/checkout/library/std/src/panicking.rs:381:40 (std::panicking::r#try::do_call)
    +/checkout/library/std/src/panicking.rs:345:19 (std::panicking::r#try)
    +/checkout/library/std/src/panic.rs:382:14 (std::panic::catch_unwind)
    +/checkout/library/std/src/rt.rs:51:25 (std::rt::lang_start_internal)
    +/checkout/library/std/src/rt.rs:65:5 (std::rt::lang_start)
    ```
    Cc `@Aaron1011`
    bors committed Sep 30, 2020
    Configuration menu
    Copy the full SHA
    266b75f View commit details
    Browse the repository at this point in the history
Loading