sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

No member named '__fp' in 'struct __darwin_arm_thread_state64'

Open adhamhf opened this issue 2 years ago • 4 comments

Platform

macOS

Installed

Swift Package Manager

Version

8.13.1

Steps to Reproduce

On macOS 13.5.2 using Xcode 15 running on an M1 processor Open you Swift app Use SPM to add sentry-cocoa to my macOS project. Only add the Sentry and Sentry-Dynamic Package Package. I'm not using Swift-UI. Compile the project

Expected Result

Project successfully compiles

Actual Result

Project fails to compile... This is a dupe of https://github.com/getsentry/sentry-cocoa/issues/3210, which was closed without being resolved.

Sentry SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:56:41 No member named '__fp' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:66:41 No member named '__sp' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:76:41 No member named '__pc' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:86:41 No member named '__lr' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:126:45 No member named '__fp' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:128:45 No member named '__lr' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:130:45 No member named '__sp' in 'struct __darwin_arm_thread_state64'

SourcePackages/checkouts/sentry-cocoa/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c:132:45 No member named '__pc' in 'struct __darwin_arm_thread_state64'

Are you willing to submit a PR?

I am willing but will likely not be able to.

adhamhf avatar Oct 16 '23 01:10 adhamhf

Hello @adhamhf. You should not use Sentry and Sentry-Dynamic together. You choose "Sentry" if you want static linked, otherwise you choose "Sentry-Dynamic".

Can you test this and let us know if it fixes the problem?

brustolin avatar Oct 16 '23 08:10 brustolin

@brustolin that did not fix the problem. Turns out I have to compile for arm64e and that is the problem. This architecture is different...

https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication

It's really easy to reproduce this problem.

  1. checkout sentry-cocoa
  2. Open the Sentry.xcworspace
  3. In the Sentry target change architectures to "arm64e" only
  4. build the target
  5. compile fails.

adhamhf avatar Oct 17 '23 01:10 adhamhf

It's really easy to reproduce this problem.

That's what we need. We will investigate a fix for this! Thanks!!

brustolin avatar Oct 17 '23 08:10 brustolin

It seems like the fix is to use these wrappers: https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/mach/arm/thread_status.h#L127

adhamhf avatar Nov 10 '23 18:11 adhamhf