iOS Build Environment Help Center

Step-by-step debugging and CPU/memory profiling

append delete Pierre-Marie Baty

One question that comes around from time to time is how to perform step-by-step debugging and CPU/memory profiling on an app built with this iOS Build Environment.

Currently, there is no user-friendly way to do this with the build environment.

*It doesn't mean there won't ever be any*

The initial goal of this build environment was just to build apps. I had considered that as the overwhelming majority of apps published today used full-featured engines, these engines themselves already provided means to debug the game code at their level. It is nonetheless true that for a minority of cases, this need still exists.

Typically, debugging/profiling tasks require debug privileges (which are for what concerns us super-user privileges) at the operating system level. There are two ways of reaching this level of privileges: 1. Use what Apple provides, i.e. study and use the iOS APIs that Xcode itself uses for that (usually through USB tethering, and a communication library like imobiledevice, to start the app under supervision of the iOS remote debug server on the device), or 2. Jailbreak the device so as to have a way to obtain these privileges when starting the app.

So far, debugging can already be done directly on the device if the device is jailbroken. It's the bare minimum: stepping through the code is done through the command line of a SSH session. It will be greatly improved if (and when I get time to) implement a way to launch the app using the same iOS remote debug server starting method that Xcode uses. That way it will become possible to iterate through the code and peek at variables from your favourite IDE, such as Visual Studio, thanks to a remote debugging plugin yet to be written (some companies already developed something like that and use it internally).

So far, profiling can't be done directly on the device, but that's just because I haven't researched any way to do it yet. If I (and when I get time to) implement a way to do it too, it will likely be the same way that Xcode does it. I'm guessing a lot of USB sniffing will be involved to find out and document how it works, so as to write equivalent and portable tools to do the same thing (i.e. collect delayed or live iOS app profiling information) from any arbitrary OS such as Windows.

In a nutshell, so far, nothing like that exists _publicly_, but the way is clear.

If somebody has a serious need for such features, and has some resources to allocate to it, consider sponsoring the task :-)

Thank you for reading.

Reply RSS

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty