]> git.lizzy.rs Git - rust.git/commit
Add an `fn_ptr` field to `MiriFrame`
authorAaron Hill <aa1ronham@gmail.com>
Sat, 10 Oct 2020 17:07:57 +0000 (13:07 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sat, 10 Oct 2020 17:07:57 +0000 (13:07 -0400)
commitbe51e6bd07c10ff350350fe05f2888c4ce3a08a0
tree54a5680faba370c045b62a877266fe1ce3994046
parent9d4c80e787f400e0ac36685b51460e52c1f31412
Add an `fn_ptr` field to `MiriFrame`

The `backtrace-rs` crate can use this to implement
`Frame::symbol_address`, which is used to skip frames
above the call to `Backtrace::capture` on the stack.

The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for `backtrace-rs`
(which only casts a non-generic function).

I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if
a 5th field is present, we write the function pointer to it.
README.md
src/shims/backtrace.rs
tests/compile-fail/backtrace/bad-backtrace-decl.rs
tests/run-pass/backtrace-api.rs
tests/run-pass/backtrace-api.stderr
tests/run-pass/backtrace-api.stdout