6 ###############################################################################
10 # CFLAGS="-g -O0" ./configure
14 # G_DEBUG="gc-friendly" G_SLICE="always-malloc" valgrind --leak-check=yes \
15 # /usr/bin/pidgin --debug 2>&1 | tee pidgin_debug.log
19 # perl contrib/debug/parse_valgrind.pl pidgin_debug.log
21 ###############################################################################
25 my @all_invalid_lines;
28 # For all lines from command line files or STDIN
30 next unless my($remainder) = /^==\d+== (.*)/;
32 if ($remainder eq "HEAP SUMMARY:") {
33 @heap_lines = ($remainder);
38 } elsif ($remainder =~ /^ERROR SUMMARY:/) {
39 # keep only the last heap summary
40 @last_heap_lines = @heap_lines;
44 } elsif ($remainder =~ /^Invalid /) {
45 # collect all invalid lines
46 push(@all_invalid_lines, $remainder);
52 } elsif ($remainder =~ /^Conditional/) {
57 } elsif (@heap_lines) {
58 push(@heap_lines, $remainder);
60 } elsif (defined($invalid_lines)) {
61 push(@all_invalid_lines, $remainder);
63 } elsif (defined($other_lines)) {
64 undef $other_lines if $remainder eq "";
67 #print "UNKNOWN: $remainder\n";
71 sub check_blocks
($$$) {
72 my($label, $start, $lines) = @_;
81 # matcher for SIPE code lines
83 if /\((?:sipe-|sip-|sdpmsg|sipmsg|http-|uuid|purple-|telepathy-)/;
85 if (length($_) == 0) {
86 print join("\n", @block), "\n\n" if $flagged;
94 check_blocks
("INVALID ACCESSES", qr/^Invalid /, \
@all_invalid_lines);
95 check_blocks
("MEMORY LEAKS", qr/^\d+ bytes in \d+ blocks/, \
@last_heap_lines);