backtrace-rs
backtrace-rs copied to clipboard
Gimli doesn't support iOS
I'm not really sure if libbacktrace supports this and if so how well. This is at least a placeholder to audit what happens tody with libbacktrace and switch gimli over to that.
TL;DR: I don't think libbacktrace works on iOS currently, but adding iOS support to this crate shouldn't be a huge undertaking.
AFAICT libbacktrace relies on _Unwind_Backtrace
for unwinding, which doesn't exist on iOS so I don't think libbacktrace works on iOS. Helpfully, the iOS ABIs for both AArch64 as well as ARMv7 mandate the use of a frame pointer, so unwinding is straightforward in practice. Apple's libc implementation of backtrace
is pretty simple:
- Call
pthread_self
to get the current thread - Call
pthread_get_stackaddr_np
andpthread_get_stacksize_np
on the current thread to get the stack bounds - Invoke
__builtin_frame_address
to get the current frame pointer - Dereference the frame pointer in a loop to unwind the stack
I'd expect all of the existing Mach-O support in this crate to work fine for symbolication, but in practice backtraces from programs running on iOS devices won't have access to symbol files so it's immaterial. The standard practice for dealing with stack traces from iOS devices is to symbolicate them after the fact. It seems like this could be handled in tooling such as dinghy
, although there's already an existing issue there about backtraces not working on iOS.
Fixed by #378 ?
The current state on iOS: #378 restores all functionality that libbacktrace had, but it doesn't show line-numbers or source files. I don't know if that's expected or not? But I don't remember ever seeing line-numbers in backtraces with Rust on iOS, so it's not a regression.
Ok makes sense, thanks for the info! In light of that I think I'll leave this open until we can get line numbers and filenames working on iOS
Hi, is there any updates? Can we have backtraces on ios? Thanks!
Do .ipa packages include the .dSYM file? If not getting filenames and line numbers is impossible for the app itself and will need synbolication after the fact. As far as I understand #378 already fixed symbol names on iOS.
In production environment, there are no symbol names - otherwise it will be easier to reverse-engineering. However, as long as collect information on ios and can symbolize it afterwards, it is completely ok. (So can we do that?)