I’m trying to debug an app for iOS (specifically iPad 3rd gen) and I’m having trouble because I can’t get breakpoints to stop the program and allow me to inspect variables, etc. Is it possible to debug iOS this way?
I am successfully seeing the Output window in XCode where it tells me about log messages and such, so it seems like I’m partway there.
Hmm… that’s a strange one. Breakpoints do work as I have been debugging the engine code that way for awhile. However, sometimes variable inspection just spins with a loading spinner. Usually when that happens I change the variable view from Auto to Local and that will fix the issue. However, if your breakpoints aren’t breaking in the first place, that isn’t going to help.
To fix that you may need to do the following from a terminal on the mac
echo “settings set target.inline-breakpoint-strategy always” >> ~/.lldbinit
Please re-open Xcode after doing that as the lldb will need to read that file. That should enable breakpoints to work in Xcode.
Great to know that it’s possible at least! So I’m guessing my procedure is going wrong somewhere - I typed the ‘echo’ command you mentioned and verified it was written to the file. Restarted Xcode but still no luck.
Here’s what I’ve been doing to try and launch a debug session on the device:
In Xcode, but with no UE4 editor running, I press the “play” button.
That launches a UE4 editor in debug mode (it says debug in the title bar next to my app name).
If I use the “Play in new editor window” it pops up the game, I trigger the button that triggers the breakpoint, and it kicks me back to Xcode as I would expect.
If I use the “Play in Mobile Preview” instead, I can’t trigger the breakpoint.
Same if I “Launch” to my iPad, no breakpoint is triggered.
I’m using Xcode 6 and OSX Yosemite, in case that makes a difference.
Maybe when I start the mobile preview and launch on the device a command line switch isn’t getting added?
The breakpoint is on the “GEngine…” line. The debug message always gets shown on screen (mobile preview, window preview and iPad). Even within the same UE4 editor debug session, switching from “Play in new window” to “Play in mobile preview” gives me the results above.
Ok most likely in the two cases where it is failing those launch a separate process which is not being debugged. Once you have performed the launch on, you can then debug the app directly from Xcode by running the particular game (so UE4Game for a content-only game, or YourGame for a code based one). Then your breakpoints should fire.
Oh perfect! I didn’t know I could launch direct from Xcode - it was set by default to use a build configuration that launched via the editor, but going direct from Xcode will help me save time overall.
If anyone else comes across this and is as spacey as me, there’s a dropdown in the top left of Xcode (for me at least) that lets you select between iOS, Mac, Editor Mac and a couple others. Change your target and make sure you select a connected device, and it works just like regular debugging.