Retired Document
Important: This document, which describes Xcode 3, has been superseded in Xcode 4 by the chapter Debugging and Analyzing Your Code from the Xcode Overview.
Debugging in the Console
Xcode’s graphical interface for GDB, the GNU debugger, lets you perform most necessary debugging tasks. You may, however, encounter situations—such as working with watchpoints in GDB—that require you to interact directly with the debugger on the command line. Using the console window, you can:
View the commands that Xcode sends to GDB or the Java command-line debugger
Send commands directly to GDB or the Java command-line debugger (limited support)
View the debugger output for those commands
See debugging messages printed to
stderr
by your program or by system frameworksDebug a command-line program that requires input from
stdin
If you are debugging a command-line program that requires input from stdin
, you must use the console to communicate with your program when it is running in the debugger. This window is only available when your program is running under the debugger.
Working in the Console
To open the Console window, choose Run > Console.
To enter commands, click in the console window and type at the gdb
or JavaBug
prompt. To get help with GDB and Java debugging commands, enter help
at the console. To learn more about command-line debugging with GDB, see Debugging with GDB.
Changing Text Formatting
To make the Console text easily readable, Xcode lets you choose the text colors and fonts used in the console window. You can use different fonts and colors for the text you type in the console, the text the debugger writes to the console, and the debug console’s prompt. To change the colors used for text in the console window, use the Fonts and Colors group in Xcode > Preferences > Debugging. See Debugging Preferences for more information.
Note that Xcode uses an executable environment to determine how to launch your program. To specify command-line arguments and environment variables to use when launching your program from Xcode, edit the executable environment; you cannot alter this environment from the gdb
command-line in the console window. See Configuring Executable Environments to learn more about configuring an executable environment.
Copyright © 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-03-08