Debugging on iOS/macOS

Here we describe how to debug a build using Xcode, Apple’s preferred IDE for developing for macOS and iOS.

Xcode

Create Project

To properly debug, we need to have a project, and the source code mapped. We’re not using this project to build things, only debug.

Launch the debugger

You have a few options to debug an app

  1. Either choose Debug -> Attach to process... and select the app from there

  2. Or choose the Attach to process by PID or Process name

  3. Start the app on the device

  4. In Edit Scheme add the .app folder as the executable

Debug symbols

To use lldb, the execution must be paused

Path mappings


* Verify the source mappings

(lldb) settings show target.source-map


You can check what source file a symbol was originating from using

(lldb) image lookup -va


### Breakpoints

* Open a file in the project view, and set a breakpoint

## Notes

### Check UUID of binary

In order for the debugger to accept the `.dSYM` folder, the UUID need to match the UUID of the executable being debugged. You can check the UUID like so:
```sh
$ dwarfdump -u <PathToBinary>