Chapter 16: Getting Started with Code Analysis and Debugging

The Xcode toolchain includes a powerful suite of code analysis, code correction, and debugging tools. Some run outside the main Xcode editor and are introduced in the following chapters. This chapter discusses features that are built into Xcode itself: the code analyzer, tips and issues, the debugging area, and a selection of other options in the Project navigator that are dedicated to debugging.

With these features, you can perform the following tasks:

  • Check your code for issues as you type
  • View tips that can help you correct issues
  • Analyze code to reveal more complex issues
  • Log messages to a window called the console while your application is running—typically to provide live diagnostic information
  • View the console output from previous runs
  • Pause execution at any point in the code with one or more breakpoints
  • Add conditional breakpoints that pause the code when a specified condition is true
  • Step through the code line by line or method by method
  • View object properties and list their contents at a breakpoint
  • Monitor the state of active threads
  • Trigger external events at breakpoints, including sounds or scripts

The Xcode debugging tool is a windowed frontend to an open-source command-line debugger called LLDB. LLDB adds extra low-level options such as direct hex dumps of memory, object listings, in-line compilation ...

Get Xcode 5 Developer Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.