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
View the debugger output for those commands
See debugging messages printed to stderr
by your program or by system frameworks
Debug 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.
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 in Tools Compilers & Debuggers Documentation.
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” in Xcode Workspace Guide 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” in Xcode Project Management Guide to learn more about configuring an executable environment.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)