28fe7ac039b3a83061ae4aa9235b872e6cd73e5d
[nethome.git] / bin / diffgdb
1 #! /usr/bin/perl
2 use strict;
3 use warnings;
4
5 my @ignore=(
6 qr{^.Test Run By }o,
7 qr{^.gnatbind }o,
8 qr{^.gnatlink }o,
9 qr{^.gnatlink: }o,
10 qr{^.gnatmake: }o,
11 qr{^.gcc }o,
12 qr{^./usr/bin/ld: .* architecture of input file .* is incompatible with .* output\n$}o,
13 qr{^.collect2: }o,
14 qr{^.UNSUPPORTED: }o,
15 qr{^.UNTESTED: }o,
16 qr{^.UNRESOLVED: }o,
17 qr{^.ERROR: }o,
18 qr{^.WARNING: }o,
19 qr{^.Running }o,
20 qr{^.[^:]*[.]ad[sb]:[0-9]}o,
21 qr{^.(?:PASS|FAIL): gdb.server/ext-run.exp: get process list\n$}o,
22 qr{^.(?:PASS|FAIL): gdb.base/checkpoint.exp: info checkpoints with at least 600 checkpoints\n$}o,
23 qr{^.(?:PASS|FAIL): gdb.base/checkpoint.exp: break2 with many checkpoints\n$}o,
24 qr{^.(?:PASS|FAIL): gdb.base/interrupt.exp: }o,
25 qr{^.(?:PASS|FAIL): gdb.base/gdb1250.exp: }o,
26 qr{^.KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app \(PRMS: gdb/10116\)\n$}o,
27 qr{^.PASS: gdb.threads/watchthreads2.exp: all threads incremented x\n$}o,
28 qr{^.FAIL: gdb.base/sigbpt.exp: Verify that SIGSEGV occurs at the last STEPI insn \(none 0x[a-f0-9]*\)\n$}o,
29 qr{^.PASS: gdb.threads/threadcrash.exp: core file: }o,
30 qr{^.PASS: gdb.threads/watchthreads.exp: disable [0-9]*\n$}o,
31 qr{^.FAIL: gdb.mi/mi-nsmoribund.exp: unexpected stop\n$}o,
32 qr{^.PASS: gdb.mi/mi-nsmoribund.exp: resume all, program exited normally\n$}o,
33 qr{^.gdb compile failed, }o,
34 qr{^.gdb compile failed, /usr/bin/ld: /tmp/[a-zA-Z0-9]*.o: relocation R_X86_64_32S against `a local symbol. can not be used when making a shared object; recompile with -fPIC\n$}o,
35 qr{^./tmp/[a-zA-Z0-9]*.o: could not read symbols: Bad value\n$}o,
36 qr{^.# of }o,
37 qr{^./home/}o,
38 qr{^.PASS: gdb.arch/i386-biarch-core.exp: core-file /home/.*/i386-biarch-core.core\n$}o,
39 qr{^.\.\./as-new [0-9.]*\n$}o,
40 qr{^.ld/ld-new [0-9.]*\n$}o,
41 qr{^.(?:PASS|FAIL): gdb.mi/mi-break.exp: test hitting breakpoint with commands\n$}o,
42 qr{^.(?:PASS|FAIL): gdb.threads/attach-stopped.exp: threaded: attach2, exit leaves process sleeping\n$}o,
43 qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach3, exit leaves process stopped\n$}o,
44 qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach4 stop by interrupt(?: \(timeout\))?\n$}o,
45 qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach4, exit leaves process sleeping\n$}o,
46 qr{^.(?:PASS|FAIL): gdb.threads/manythreads.exp: info threads\n$}o,
47 qr{gdb version  [0-9][^ ]* -nw -nx \n$}o,
48 qr{^.(?:PASS|FAIL): gdb.threads/attach-stopped.exp: threaded: attach1, exit leaves process stopped\n$}o,
49 qr{^.(?:PASS|FAIL): gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted(?: \(timeout\))?\n$}o,
50 qr{^.(?:PASS|FAIL): gdb.server/server-run.exp: continue to main\n$}o,
51 qr{^.(?:PASS|FAIL): gdb.mi/mi-nonstop.exp: w1,i0 stop(?: \(timeout\))?\n$}o,
52 qr{^.(?:PASS|FAIL): gdb.reverse/i387-env-reverse.exp: set reverse direction(?: \(timeout\))?\n$}o,
53 qr{^.(?:PASS|FAIL): gdb.reverse/i387-env-reverse.exp: record to end of main(?: \(timeout\))?\n$}o,
54 qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: compare intermediate binary file\n$}o,
55 qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: compare binary file\n$}o,
56 qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: deleted binary file\n$}o,
57 qr{^.(?:PASS|FAIL): gdb.mi/mi-simplerun.exp: continue to end(?: \(failed to resume\))?\n$}o,
58 qr{^.(?:PASS|FAIL): gdb.mi/mi-simplerun.exp: continue to end(?: \(unknown output after running\))?\n$}o,
59 qr{^.(?:PASS|FAIL): gdb.server/file-transfer.exp: verified deleted binary file\n$}o,
60 qr{^.(?:PASS|FAIL): gdb.server/file-transfer.exp: deleted binary file\n$}o,
61 qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach1, post-gdb sanity check of the sleeping state - Red Hat BZ 197584\n$}o,
62 qr{^."uplevel #0 source .*gdb/testsuite/gdb.threads/watchthreads-thr.*\.\.\."\n$}o,
63 );
64 my $ignore=shift @ignore;
65 $ignore=qr/$ignore|$_/o for @ignore;
66
67 if ($ARGV[0] eq "-r") {
68   $ignore=undef;
69   shift;
70 }
71
72 my $last;
73 my $lastfile;
74 local *DIFF;
75 my(@diff)=("diff","-rU-1",@ARGV);
76 open DIFF,"-|",@diff or die join(" ",@diff).": $!";
77 while (<DIFF>) {
78   next if /^diff /;
79   my($thisname)=m{^.(?:Running (?:.*/)?|[A-Z]+: )(gdb[.]\w+/\S+[.]exp)(?: \Q...\E|: .*)$};
80   $thisname||=(m{^.\t\t=== gdb (Summary) ===\n$})[0];
81   my $this;
82   if (!$thisname || ($last && $thisname eq $last->{"name"})) {
83 #if (!$thisname) { print "X: !thisname\n"; } else { print "X: \"".$last->{"name"}."\" -> \"$thisname\"\n"; }
84     $this=$last;
85   } else {
86 #print "X: new \"$thisname\"\n";
87     $last=$this={"name"=>$thisname,"+Running"=>(/^[+]/||0)};
88   }
89   next if /^@@ .* @@\n$/;
90   if ($this->{"print"}) {
91     print;
92     next;
93   }
94   if (/^--- /) {
95     $lastfile=$_;
96     next;
97   }
98   if (/^\Q+++\E /) {
99     $lastfile.=$_;
100     next;
101   }
102   $this->{"buffer"}.=$_;
103   next if /^ /;
104   next if /^[+]Running / && $thisname;
105   next if /^[+]PASS: /;
106   next if /^[+]KPASS: /;
107   next if /^-PASS: /;
108   next if /^-KPASS: /;
109   next if /^-FAIL: /;
110   next if /^-KFAIL: /;
111   next if /^-XFAIL: /;
112   next if /^.# of .*\t\d+\n$/;
113   next if $ignore && /$ignore/o;
114   next if /^[+]FAIL: / && $this->{"+Running"};
115   next if /^[+]KFAIL: / && $this->{"+Running"};
116   next if /^[+]XFAIL: / && $this->{"+Running"};
117   next if /^[+]UNTESTED: / && $this->{"+Running"};
118   next if /^[+]gdb compile failed, / && $this->{"+Running"};
119   next if /^[+].*: Error: bad register name `%.*'\n$/ && $this->{"+Running"};
120   next if /^[+].*: Error: `.*' is only supported in 64-bit mode\n$/ && $this->{"+Running"};
121
122   $this->{"print"}=1;
123   print $lastfile||""; $lastfile=undef();
124   print "\n#".$this->{"name"}."\n";
125   print $this->{"buffer"}; $this->{"buffer"}=undef();
126   next;
127 }