Information Technology Reference
In-Depth Information
Chapter 15:Getting Started
with Code Analysis and De-
bugging
In This Chapter
Using the console
Working with breakpoints
Using the Variables View
Using breakpoint actions
Working with command-line 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 GDB (GNU
Project Debugger.) GDB adds extra low-level options such as direct hex dumps of memory, object listings, and
hundreds of other features. You can access these features by typing commands into the Console window. GDB is
Search WWH ::




Custom Search