Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running app on iOS device in Xcode results in EXC_BAD_ACCESS in Go code #273

Closed
oskarth opened this issue Aug 25, 2017 · 3 comments
Closed

Comments

@oskarth
Copy link
Contributor

oskarth commented Aug 25, 2017

Running status-react app on real iOS device in Xcode results in the following error: go-stack/stack.findSigpanic.func1 Thead 5: EXC_BAD_ACCESS. Since this is Go code it is presumably related to status-go.

Normally there's a workaround where you can stop the build/running in Xcode and restart the app on device itself. This seems to stop us from using Xcode's debugging facilities (breakpoints, inspecting threads etc) when app crashes straight away.

This seems related to ethereum/go-ethereum#14369.

Xcode error log:

StatusIm`github.com/status-im/status-go/vendor/github.com/go-stack/stack.findSigpanic.func1:
    0x1006c0a60 <+0>:   ldr    x1, [x28, #0x10]
    0x1006c0a64 <+4>:   mov    x2, sp
    0x1006c0a68 <+8>:   cmp    x2, x1
    0x1006c0a6c <+12>:  b.ls   0x1006c0ae0               ; <+128>
    0x1006c0a70 <+16>:  str    x30, [sp, #-0x20]!
    0x1006c0a74 <+20>:  mov    x0, #0x0
    0x1006c0a78 <+24>:  str    x0, [sp, #0x38]
    0x1006c0a7c <+28>:  ldr    x0, [sp, #0x30]
    0x1006c0a80 <+32>:  str    x0, [sp, #0x18]
    0x1006c0a84 <+36>:  ldr    x0, [sp, #0x18]
    0x1006c0a88 <+40>:  cbnz   x0, 0x1006c0a90           ; <+48>
    0x1006c0a8c <+44>:  str    xzr, [x0]
    0x1006c0a90 <+48>:  mov    x0, #0x8
    0x1006c0a94 <+52>:  str    w0, [sp, #0x8]
    0x1006c0a98 <+56>:  adrp   x17, 3825
    0x1006c0a9c <+60>:  add    x17, x17, #0x268          ; =0x268 
    0x1006c0aa0 <+64>:  str    x17, [sp, #0x10]
    0x1006c0aa4 <+68>:  bl     0x1000eb810               ; runtime.deferproc
    0x1006c0aa8 <+72>:  sxtw   x0, w0
    0x1006c0aac <+76>:  cmp    x0, xzr
    0x1006c0ab0 <+80>:  b.eq   0x1006c0ac4               ; <+100>
    0x1006c0ab4 <+84>:  nop    
    0x1006c0ab8 <+88>:  bl     0x1000eca30               ; runtime.deferreturn
    0x1006c0abc <+92>:  ldr    x30, [sp], #0x20
    0x1006c0ac0 <+96>:  ret    
    0x1006c0ac4 <+100>: ldr    x0, [sp, #0x28]
->  0x1006c0ac8 <+104>: ldr    x1, [x0]
    0x1006c0acc <+108>: str    x1, [sp, #0x38]
    0x1006c0ad0 <+112>: nop    
    0x1006c0ad4 <+116>: bl     0x1000eca30               ; runtime.deferreturn
    0x1006c0ad8 <+120>: ldr    x30, [sp], #0x20
    0x1006c0adc <+124>: ret    
    0x1006c0ae0 <+128>: mov    x3, x30
    0x1006c0ae4 <+132>: bl     0x100123350               ; runtime.morestack_noctxt
    0x1006c0ae8 <+136>: b      0x1006c0a60               ; <+0>
    0x1006c0aec <+140>: .long  0x00000000                ; unknown opcode

Device: iPhone 6s, 10.3.3
Xcode: 8.3.3
status-react: latest develop

@oskarth
Copy link
Contributor Author

oskarth commented Aug 25, 2017

Possibly related to status-im/status-mobile#1687

@oskarth
Copy link
Contributor Author

oskarth commented Sep 1, 2017

To trigger this error on the command line, you can do:

xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration Release -destination "platform=iOS,id=${real_device_udid}" -derivedDataPath 'build'
ios-deploy -i "${real_device_udid}" --debug  --bundle build/Build/Products/Debug-iphoneos/StatusIm.app

This drop you into LLDB. After some time has passed you get:

(lldb) error: libarclite_iphoneos.a(arclite.o) failed to load objfile for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
Process 370 stopped
* thread #5, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000001007e8660 StatusIm`github.com/status-im/status-go/vendor/github.com/go-stack/stack.findSigpanic.func1 + 104
StatusIm`github.com/status-im/status-go/vendor/github.com/go-stack/stack.findSigpanic.func1:
->  0x1007e8660 <+104>: ldr    x1, [x0]
    0x1007e8664 <+108>: str    x1, [sp, #0x38]
    0x1007e8668 <+112>: nop
    0x1007e866c <+116>: bl     0x1002145c8               ; runtime.deferreturn
(lldb)

@oskarth
Copy link
Contributor Author

oskarth commented Sep 2, 2017

One reason this would be very useful for status-im/status-mobile#1687: The debugger disables Watchdog timeouts, which seems to be the proximate cause for 0x8badf00d.

https://developer.apple.com/library/content/technotes/tn2431/_index.html#//apple_ref/doc/uid/DTS40017497-CH1-COMMON_CAUSES_OF_CUSTOMER_FACING_ISSUES-DEBUGGER_EFFECTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants