Today, some random notes on Xcode (Apple’s IDE for Mac OS and iPhone OS): A few odds and ends I’ve noticed since starting to work with it a couple of weeks ago. (I like Xcode, but it does seem to have a quirk or two.)
Environment
These comments apply to Xcode 3.1.2, on Mac OS X 10.5.6, targeting the iPhone Simulator 2.2.1, using SVN for source control. YMMV even if you’re in exactly the same environment, of course.
Debugger
Xcode’s debugger has its own window, which isn’t displayed by default when executing code. To bring it up, you can use the menus (Run->Debugger) or the keyboard (Shift-Command-Y).
Single-Step Assembly
If you want to single-step through ASM code, you have two options:
- Open the GDB console (from the debugger window’s toolbar) and use the “stepi” command
- Set the debugger to display disassembly only (Run->Debugger Display->Disassembly Only); thereafter, you can use the “Step Over” command to single-step by assembly instruction instead of source code line
Registers
According to the Xcode documentation, a “Register” category should appear in the debugger window when disassembly is displayed. It doesn’t. If you want to see registers, you’ll need to open the GDB console, and use either the “info registers” command (to see them all) or the “p” command (e.g. “p/x $eax”) to inspect them one at a time.
Save
Frequently, the “Save” commands stop working for me. I will edit a file, and Xcode will indicate that the file has been changed, but the “File->Save” and “File->Save As…” menu options will be grayed out, and the Command-S keyboard combination will have no effect. I have no explanation for this, but it isn’t as serious as it sounds; building, for instance, will bring up an autosave prompt, and the problem will (temporarily, at least) disappear after the build.