views:

1704

answers:

7
+13  Q: 

Prettify my gdb

Is there a way to highlight and color gdb output during interactive debugging?

Please don't reply I should use ddd, nemiver, emacs, vim, or any other front-end, I just prefer gdb as it is, but would like to see its output with some terminal colors.

Thank you

+5  A: 

gdb has no colors, you need to either:

  • write your own readline-based front-end,
  • or hack the code directly into gdb.

That would be a real nice hack, too.

ddaa
+10  A: 

It's not colours, but I assume you're aware of gdb's text gui? I wasn't for a long time and it makes a vast difference to how usable gdb is.

For those not in the know, launch gdb with -tui

therefromhere
ho! nice, I didn't know that
elmarco
Wow! Thanks! I've been looking for a long time for a nice graphical shell around gdb, and I have tried xxgdb, kgdb and ddd, but none of them worked very good for me, so I've stuck with the plain old command line interface. But this is absolutely perfect!
Thomas Padron-McCarthy
+9  A: 

I know you did not want a frontend. But how about cgdb it is very close to gdb, it is textmode but has a source window above with syntax highlight on the code.

Johan
A: 

cgdb is great tool. It is what I am exactly looking for. thanks Johan for your hints. /Kai

Put a comment in Johan post instead
Jérôme
I don't think Kai can comment until he gets more points...
Johan
A: 

you can get whatever colors you want;

# gdb
(gdb) shell echo -en '\E[47;34m'"\033[1m"
...
anything is now blue foreground and white background
...
(gdb) shell tput sgr0
... back to normal
RandomNickName42
A: 

I was googling around and found DebugVI which is similar to cgdb, but runs vi instead of a custom viewer. dbvi

Fidget
+2  A: 

It is possible to greatly enhance the appears of gdb through the use of colors, this is done via any of the following method:

  1. Colorized prompt via the "set prompt" command
  2. Colorized commands via hooks
  3. Colorized syntax highlighting of the "list" command.

All examples are aviable at the following page:

http://www.michaelkelleher.info/?p=1

and

http://www.michaelkelleher.info/?p=51

Mike