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