Like many people who have overdosed on syntax highlighting and other forms of colorization, my brain is no longer able to process monochrome text displays. Which is why I have been so excited about gdb with python crammed inside. (The good sense of “crammed”, wherein one is cramming cookies in one’s mouth.) I have perverted its spirit and used it to colorize gdb backtraces! Woo!
While I was in there, I have done two useful things:
- There is magic of limited potency that normalizes the path automatically.
- It looks at all the values in the arguments (and locals too, I guess) and if they are used more than once, it considers making them “interesting”. Interesting values get named based on where we first saw them, and assigned a color. Then, whenever they appear in the backtrace, they get their special name and color to help us see the flow of values through the backtrace. For example, in the screenshot above you can see “this5″ in a nice* blue color. Each time its value appears, the “this5″ label appears (the 5 is for frame 5). I find this easier than manually scanning using my brain.
My hg repo is here: http://hg.mozilla.org/users/bugmail_asutherland.org/pythongdb-gaudy/
If you like this, or if you don’t like this but do like useful things, you are even more likely to like Jim Blandy’s archer-mozilla repo which is full of magic debugging help for spidermonkey in gdb. (nb: The python-gdb trunk right now has changed how pretty printers register, and I don’t think that repo has yet caught up.) Also, see Tom Tromey’s blog posts about the whole python-gdb thing.
* When I use “nice” in terms of colors, this is from my perspective as someone who demands many colors, has the time to add crazy colors to everything, but inexplicably does not have the time to actually pick colors that humans find appealing (or even non-nauseating). I am going to pass the buck to the people who originally conceived of 256-color xterms and thought I could be trusted with a color cube, no matter how limited.