Information Technology Reference
In-Depth Information
a huge, complex tool, and these advanced features are optional. You can be productive and efficient without
them, but it's useful to know that they're available.
Note
GDB and the Debugger support very advanced options, such as remote debugging, that are outside the scope of
this topic. The deinitive guide to the debugger's features is the Xcode Debugging Guide in the documentation.
You can find the latest version online. The URL changes regularly, so search for the name.
Note
Future versions of Xcode will default to an alternative low-level debugger called LLDB (Low Level Debugger). You
can select LLDB manually in Xcode in a project's build settings. LLDB is somewhat faster than GDB, but currently
there are few other obvious differences. Eventually LLDB will expand to allow advanced scripted debugging. Be-
cause it's still a work in progress, it isn't discussed further here.
Checking and Analyzing Code
It's more productive to get code right as you type than it is to fix it later. To help you achieve this, Xcode 4
checks code and reports issues as you edit.
Checking code as you enter it
This feature is enabled automatically. It begins working as soon as you start typing. Questionable code is under-
lined or marked with a tiny arrow, and warning or error icons appear in the gutter to the left of the code. If you
open the Issue navigator, you can see longer descriptions of each issue, as shown in Figure 15.1.
NOTE
The issues checker is identical to the code parser used during a build. It flags the same errors and generates the
same error messages, but it runs in the background and parses your code as you edit.
The issues checker is reasonably intelligent, but it can be slow. A lag of a few seconds isn't unusual, and on lar-
ger files the lag can be 10 seconds or more. It doesn't understand partial edits, so it reports errors that only exist
because you haven't finished typing a complete line of code.
The faster your Mac, the more you can rely on this feature. Unfortunately, it's less useful on slower hardware.
Because of the lag, issues can continue to be flagged after you've fixed them. In extreme cases, you can waste
time trying to fix code that's correct, as the parser plays catch-up with your most recent edit. Xcode can also
miss errors because of lag.
This is a powerful feature, but you should treat it with care. Don't assume it's infallible—it isn't.
FIGURE 15.1
 
Search WWH ::




Custom Search