We use a perl script (attached and below) to filter output before diffing.

Mark

#!/usr/bin/env perl
my $machine_type;
chomp($machine_type = `uname -m`);
while (<>) {
    s/: +[0-9]+ Aborted +/: Aborted: /;
    s/\(core dumped\) *//;
    s/==\d+==/==PID==/;

    if ($machine_type eq "x86_64") {
        # Valgrind AMD64/Linux locations
        s/0x7f([0-9a-f]{7,10})/<STACK_ADDR>/ig;  # stack
        s/0x4[01]([0-9a-f]{7})/<STATIC_ADDR>/ig; # r/w data
        s/0x4[cd]([0-9a-f]{5})/<HEAP_ADDR>/ig;   # heap  ArrayTest because
so much allocated?
        s/0x5[1a]([0-9a-f]{5})/<HEAP_ADDR>/ig;   # heap
        s/0x4[01]([0-9a-f]{4})/<STATIC_ADDR>/ig; # r/o data
        s/0x6[01]([0-9a-f]{4})/<STATIC_ADDR>/ig; # r/w data
    } else {
        # we just assume ...
        # Valgrind X86/Linux locations
        s/0xb[ef]([0-9a-f]{6})/<STACK_ADDR>/ig;  # stack
        s/0x6[123]([0-9a-f]{6})/<STATIC_ADDR>/ig;# r/w data
        s/0x4[0-8]([0-9a-f]{5})/<HEAP_ADDR>/ig;  # heap
        s/0x8[01]([0-9a-f]{5})/<STATIC_ADDR>/ig; # r/o and r/w data
    }    

# old/unused address substitutions
#        s/0xf[ef]([0-9a-f]{6})/<STACK_ADDR>/ig;  # Valgrind 32-on-64/Linux
location
#        s/0x6[0-3]([0-9a-f]{5})/<HEAP_ADDR>/ig;  # Valgrind 32-on-64/Linux
location
#        s/0x5[01]([0-9a-f]{4})/<STATIC_ADDR>/ig; # Valgrind AMD64/Linux
data


    s/[0-9]:[0-9]{2}:[0-9]{2}/<TIME>/g;      
    s/(.+)Time:(.*)seconds(.*)/<TIME>/g;  
    s/(.+)Rendering line(.*)/<TIME>/g;        # Time (povray prints time
taken to execute)

    s/Invalid read of.*/<MEMCHECK ERROR>/g;                # povray has
multiple memcheck errors
    s/Address .* bytes after a block .*/<MEMCHECK_ERROR>/g; # replace the
information with generic
                                                           # sizes and
addresses. Don't remove completely though
                                                           # as we'd still
like them to be around to catch errors
                                                           # in other tests

    s/Total Alloc.*/<Allocation statistics>/g;
    s/Peak memory.*/<Allocation statistics>/g;

    s/kvasir-[\d.]+,/kvasir-VERSION/;
    s[Using Valgrind-3.9.0.SVN and LibVEX; rerun with \-h for copyright
info]
      [Using Valgrind and LibVEX; rerun with \-h for copyright info];
    s/\(vg_replace_malloc.c:(\d+)\)/(vg_replace_malloc.c:XXX)/;
    print;
}



-----Original Message-----
From: Nick Savoiu [mailto:sav...@yahoo.com] 
Sent: Friday, December 20, 2013 10:17 AM
To: valgrind-users@lists.sourceforge.net
Subject: [Valgrind-users] Making valgrind output diff-friendly



Hi all,

Valgrind's typical output


==19182== Invalid write of size 4 

==19182==    at 0x804838F: f (example.c:6) 

==19182==    by 0x80483AB: main (example.c:11) 

==19182==  Address 0x1BA45050 is 0 bytes after a block of size 40 alloc'd 

==19182==    at 0x1B8FF5CD: malloc (vg_replace_malloc.c:130) 

==19182==    by 0x8048385: f (example.c:5) 

==19182==    by 0x80483AB: main (example.c:11)

is not very diff-friendly. Is there a way to suppress process id and address
printing? Perhaps something like

==?????== Invalid write of size 4
==?????==    at 0x???????: f (example.c:6) ==?????==    by 0x???????: main
(example.c:11) ==?????==  Address 0x??????? is 0 bytes after a block of size
40 alloc'd ==?????==    at 0x???????: malloc (vg_replace_malloc.c:130)
==?????==    by 0x???????: f (example.c:5) ==?????==    by 0x???????: main
(example.c:11)


or
==== Invalid write of size 4
====    at : f (example.c:6)
====    by : main (example.c:11)
====  Address  is 0 bytes after a block of size 40 alloc'd ====    at :
malloc (vg_replace_malloc.c:130) ====    by : f (example.c:5) ====    by :
main (example.c:11)


Or is there a better way?

Thanks,
Nick

----------------------------------------------------------------------------
--
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Attachment: clean-output.pl
Description: Binary data

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to