rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
516 stars 237 forks source link

Add Apple visionOS support #613

Closed QuentinPerez closed 1 month ago

QuentinPerez commented 3 months ago

Motivation

Add the support of Apple VisionOS 121419

Solution

Add target_os = "visionos"

workingjubilee commented 3 months ago

@QuentinPerez Have you tested this? Does visionOS actually support backtraces with this patch, and a rustc/stdlib updated to use it? Surely it must be easy to record a mote of proof.

QuentinPerez commented 2 months ago

@QuentinPerez Have you tested this? Does visionOS actually support backtraces with this patch, and a rustc/stdlib updated to use it? Surely it must be easy to record a mote of proof.

Yes, I tested it, here is a example of the output with and without the patch

// Before
current_backtrace =    0:        0x1057aea88 - <unknown>
   1:        0x1057aea34 - <unknown>
   2:        0x105787cc0 - <unknown>
   3:        0x105787c38 - <unknown>
   4:        0x105753c24 - <unknown>
   5:        0x105760648 - <unknown>

// After
   backtrace[3e08695382c39b1]::backtrace::trace_unsynchronized::<<backtrace[3e08695382c39b1]::capture::Backtrace>::create::{closure#0}>
   1:        0x104b7d688 - backtrace[3e08695382c39b1]::backtrace::trace::<<backtrace[3e08695382c39b1]::capture::Backtrace>::create::{closure#0}>
   2:        0x104b9c518 - <backtrace[3e08695382c39b1]::capture::Backtrace>::create
   3:        0x104b9c490 - <backtrace[3e08695382c39b1]::capture::Backtrace>::new
   4:        0x104b2dea4 - <object[c239c684900fc29f]::ffi::Obj>::new
   5:        0x104b3a8c8 - object[c239c684900fc29f]::ffi::stream::object_fn_new::{closure#1}
QuentinPerez commented 2 months ago

can we merge it ?

madsmtm commented 2 months ago

Could you also update the target_os = "macos" in tests/accuracy/main.rs and crates/macos_frames_test/tests/main.rs? Not that they're currently run by CI, but they could be in the future (esp. on Mac Catalyst).

workingjubilee commented 1 month ago

Hmm, I am going to simply ignore the rust-lld failure.