-
Notifications
You must be signed in to change notification settings - Fork 264
Home
XcodeColors is an easy-to-use plugin for Xcode 3 & 4.
This project is designed to enable colorizing debugger console output.
-
Compile the XcodeColors target for Release (not Debug).
When you do this, the Xcode plugin is automatically copied to the proper location.
This is done via the install script, run by xcb-install.pl via an Xcode build phase. -
Quit Xcode.
-
Add the following code to ~/.gdbinit:
define xcodecolors attach Xcode p (char)[[NSBundle bundleWithPath:@"~/Library/Application Support/SIMBL/Plugins/XcodeColors.bundle"] load] detach end
But what about LLDB? Relax, it also works for LLDB.
-
Launch Xcode
-
Open the Terminal.
Run gdb (Type gdb then hit enter).
You'll get a gdb command prompt.
Run xcodecolors (Type xcodecolors then hit enter).
It should look something like this in the Terminal:~ $ gdb (gdb) xcodecolors Attaching to process ... Reading symbols for shared libraries ... .. done 0x00007fff84d242fa in mach_msg_trap () $1 = 1 '\001' (gdb) quit
This step is required only once after Xcode start.
-
You're done!
Want to see it in action?
Run the TestXcodeColors target in this project.
Wow, you're still running Xcode 3?
See this page for installation instructions:
http://deepitpro.com/en/articles/XcodeColors/info/index.shtml
-
Testing to see if XcodeColors is installed and enabled:
char *xcode_colors = getenv(XCODE_COLORS); if (xcode_colors && (strcmp(xcode_colors, "YES") == 0)) { // XcodeColors is installed and enabled! }
-
Enabling / Disabling XcodeColors
setenv(XCODE_COLORS, "YES", 0); // Enables XcodeColors (you obviously have to install it too) setenv(XCODE_COLORS, "NO", 0); // Disables XcodeColors
-
Using XcodeColors
The following is copied from the top of the XcodeColors.m file:
// How to apply color formatting to your log statements: // // To set the foreground color: // Insert the ESCAPE_SEQ into your string, followed by "fg124,12,255;" where r=124, g=12, b=255. // // To set the background color: // Insert the ESCAPE_SEQ into your string, followed by "bg12,24,36;" where r=12, g=24, b=36. // // To reset the foreground color (to default value): // Insert the ESCAPE_SEQ into your string, followed by "fg;" // // To reset the background color (to default value): // Insert the ESCAPE_SEQ into your string, followed by "bg;" // // To reset the foreground and background color (to default values) in one operation: // Insert the ESCAPE_SEQ into your string, followed by ";" #define XCODE_COLORS_ESCAPE_MAC @"\033[" #define XCODE_COLORS_ESCAPE_IOS @"\xC2\xA0[" #if TARGET_OS_IPHONE #define XCODE_COLORS_ESCAPE XCODE_COLORS_ESCAPE_IOS #else #define XCODE_COLORS_ESCAPE XCODE_COLORS_ESCAPE_MAC #endif #define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color #define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color #define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color