Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is 'Simulate Background Fetch' leading to crash (libsystem_kernel.dylib`mach_msg_trap) since Xcode 8?

Tags:

ios

xcode8

I'm on macOS Sierra, Xcode 8, and get crashes whenever I try to Simulate Background Fetch on an actual iOS 10 device. This does NOT occur when using the simulator. This occurs in all projects, including those freshly created.

    libsystem_kernel.dylib`mach_msg_trap:
    0x18cfec164 <+0>: movn   x16, #0x1e
    0x18cfec168 <+4>: svc    #0x80
->  0x18cfec16c <+8>: ret   (Thread 1: signal SIGSTOP)

I don't have any other iOS devices to test with; is anyone else experiencing this?

like image 774
DCToDaylight Avatar asked Sep 21 '16 18:09

DCToDaylight


3 Answers

I'm running Xcode 8.1 with a device - it's not crashing but it's hitting a breakpoint that you can't find/edit/remove.

I go to Debug > Continue and it carries on as expected.

like image 68
Adam Maloney Avatar answered Nov 16 '22 22:11

Adam Maloney


You aren't alone - I'm encountering this as well. Really annoying. I've just filed a bug.

like image 41
Mattie Avatar answered Nov 16 '22 23:11

Mattie


As pointed out by others. it is not a crash, but an auto breakpoint triggered by system. As explained here by eskimo:

So, why does it stop in mach_msg_trap? The goal is to give you a chance to set a breakpoint in your background fetch handling code, so Xcode forces your app to stop, just like it would if you hit the pause button (Debug > Pause). It stops in mach_msg_trap because that’s where your main thread is sitting when your app is suspended in the background. In short, when you do a Debug > Simulate Background Fetch and stop in mach_msg_trap:

  1. That’s expected behaviour
  2. It’s not a sign of any problem
  3. You can safely continue execution via Debug > Continue

Personally, I see it more like a bug than a feature.

like image 6
Trần Việt Hoàng Avatar answered Nov 17 '22 00:11

Trần Việt Hoàng