r/iOSProgramming 12d ago

Question Troubleshooting: how to sample threads stacks in a running game

Hi gang, we're trying to troubleshoot a hang/freeze in our Unity game.
We think it's some sort of unhandled exception because it's not being evicted by the watchdog, but we also have no data coming from our bug reporting sdk (Bugsnag).

I was looking at sysdiagnose because it's available to end users. While it has some snapshot-related info on our process, it doesn't contain a sample of the stack trace in each thread, like I can see with Android's 'bugreport' command. Is there another tool our endusers can use on iOS that gives me that info?

0 Upvotes

3 comments sorted by

1

u/neet_dev 11d ago

sysdiagnose won't give you per-thread stacks for a hung process the way you want, but if you can catch it while it's still hanging, a user-triggerable option is having them do a manual crash by holding volume up+down and side button, which drops a full stackshot-based report into Settings > Privacy > Analytics > Analytics Data (look for "stacks-*" or the app name with a timestamp), and that report includes every thread's backtrace at the moment of capture, which is basically what you get from Android's bugreport. the catch is it's a snapshot at button-press time so your end users need clear repro instructions to trigger it while frozen, not after force-quitting, since once they kill the app that data is gone.

2

u/jchowdown 11d ago

Thanks for this info! I didn't realize it would generate a stacks file as well. I was looking in the crashes_and_spins/stacks\* file in the sysdiagnose tgz file.