Debugging Zig code in Xcode for Apple iOS

I integrated a small Zig library in the build of our iOS app. Unfortunately, I get now a crash where the test works fine. Usually, this is no big thing – just start the debugger and find out what’s going on. But in this case the iOS app is inside Xcode, and while this IDE uses lldb the version it uses does not support debugging Zig code.

How do others here solve the problem using Zig for iOS?

it might be tougher if the app is running in a simulator (just because i don’t know to what extent the process name is or isn’t available to you, for example), but the command line lldb works for debugging Zig on macOS and can attach to a running process with one of a couple command line arguments.

I debug Zig code on macOS, too. But the problem is on iOS, and yes, the app runs in the simulator (or on a real iOS device, respectively). On macOS I use vim, so I don’t have Xcode running.

it sounds like either you didn’t read my proposed solution correctly or i didn’t understand that there’s something wrong with it. we’re outside my experience, so i don’t know which it is!

If I’m following: Your post gave advice for macOS but they are asking about iOS (macOS works for them).

1 Like

oh, it sounds like the crash only occurs on-device and not in the simulator? my mistake