Bug 92036 - A wish for ANSI Colors in the output of valgrind
Summary: A wish for ANSI Colors in the output of valgrind
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-24 22:53 UTC by Rani Pinchuk
Modified: 2016-01-03 21:29 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rani Pinchuk 2004-10-24 22:53:05 UTC
Thanks a lot for valgrind - the most helpful tool! 

I suggest to add a switch --colors which makes valgrind to output its messages
in colors. Simlar to other tools like ls --colors etc. For many users (like me)
such addition will make the reading of the valgrind reports a lot easier.

The implementation should be extremely simple:
After defining the following:

  #define COLOR_RESET   "\x1b[0m"
  #define COLOR_RED     "\x1b[31m"
  #define COLOR_GREEN   "\x1b[32m"
  #define COLOR_YELLOW  "\x1b[33m"
  #define COLOR_BLUE    "\x1b[34m"
  #define COLOR_MAGENTA "\x1b[35m"
  #define COLOR_CYAN    "\x1b[36m"

One can write:
  printf("%shello %sworld%s", COLOR_RED, COLOR_BLUE, COLOR_RESET);

In any case, thanks for the greatest tool.

Rani
Comment 1 krazyfencer 2011-06-25 03:25:23 UTC
  This bug seems a little old, but the idea sounded good to me.  After starting to look at one of the tools (memcheck) however, I'm not sure how color coding things would help.  Would it make sense for entire sections to be various colors (such as the initialization info, the errors and the summary) to make them stand out from the standard output?  Or should different errors be color-coded based on their severity?  Most of memcheck's errors seem equally dire, so I am not sure how to go about the second option.  I'd be happy to implement it, but I need a bit of feedback as to what exactly is wanted.
Comment 2 edhurtig 2016-01-03 21:11:39 UTC
Just started using valgrind and was wondering if this feature has been given any attention elsewhere.  I find the color coding of test tools like RSpec, Rubocop, and Test Kitchen to be very useful. I wouldn't overthink the coloring, in my opinion, the largest benefit I see is coloring the "ERROR SUMMARY" lines red or green depending on whether > 0 errors were found.
Comment 3 Tom Hughes 2016-01-03 21:29:16 UTC
How many people actually send valgrind output to a console though?

I always send it to a file (which would presumably disable colouring) in order to avoid it getting mixed up with other output from the program, and then tail that file in a different window or look at it when the run has finished.