< Previous PageNext Page > Hide TOC

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:

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.



< Previous PageNext Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.