Debugging ATIRE in Xcode 4


Jump to: navigation, search

The instructions talks about how to use Xcode 4 to debug external binaries.

Since there is no easy way to creat a project in Xcode based on existing files, we have to create a empty project first. Let's say your source directory is under your home directory "~/atire".

  1. Now create a empty project in Xcode using "Other -> Empty" options in the popup window.
  2. Specify the product name as "atire".
  3. A file chooser windows pops up and choose any directory other than you home directory. (The problem here is that Xcode tries to create a directory called "atire" and this directory already exists under the home directory.)
  4. In the file choose window, make sure the option is ticked for "Create local git repository for this project" if your working copy is managed by git. Otherwise ignore this option.
  5. Click the "Create" buttion to create the project.

We need to copy the created project directory "atire.xcodeproj" to the working code directory "~/atire".

  1. First quit Xcode.
  2. Copy the generated project directory "atire.xcodeproj" into "~/atire".
  3. start Xcode to locate the project again in "~/atire".

Create a new schema in order to run the binary compiled externally. The example shows how to run the "atire" binary. Same procedures applies to other binaries.

  1. From menu choose "Product -> New Schema...".
  2. Type "atire" in the name text box.
  3. On the left panel, click "Run" and configure the "info" section. In the "executable", choose "Other" to locate the "atire" binary on disk. and change to use either "GDB" or "LLDB". (Don't forget to compile the binaries with the debugging options enabled.)
  4. Parameters can be specified in the "Arguments" section.
  5. The working directory can be specified in the "options" section.
  6. click "OK" to finish configuring the new schema.


In order to add breakpoints and trace line by line into the source files, we have to tell where these files are.

  1. From menu, choose "File -> Add Files to Atire..." to add all the files.

Now, we are ready to debug.

  1. Open a file and put a breakpoint on the line where you want the debugger to stop.
  2. From the menu, choose "Product -> Debug -> Activate breakpoints".
  3. Click the run button located on the top left.
  4. enjoy Xcode.