12

I set a color for the GDB prompt by adding this line to ~/.gdbinit:

set prompt \033[0;32m(gdb) \033[0m

This works fine in GDB, until I open the TUI. It then discards the colors and shows the raw color codes. The same thing happens if I use CGDB.

This is 2015. Is there any way I can have both colors in GDB and also view the source code I'm debugging in a subwindow (like in TUI/CGDB) at the terminal?

Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
  • 3
    You can't in gdb with tui. See this bug https://sourceware.org/bugzilla/show_bug.cgi?id=14126. – ks1322 May 13 '15 at 16:27
  • 1
    Give up on TUI. Use GDB Dashboard: https://github.com/cyrus-and/gdb-dashboard – Ciro Santilli OurBigBook.com May 30 '17 at 14:55
  • See also [this great answer about **extending GDB to display source code and to color GDB output](https://stackoverflow.com/a/17341335/938111)**. This answer is not about GDB TUI nor CGDB. – oHo Jul 08 '17 at 09:06

1 Answers1

4

This gdb bug was fixed a while ago (2018). Also, gdb added colorizing to the CLI and to the TUI. This first showed up, I believe, in GDB 9.1.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63