X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fdiffgdb;h=b44c2c09d7ed3ab19bb584aaebf24939a090a9eb;hp=260cbce3c530980f230931a5530cd63047fea0cf;hb=603a7c02633bf8e9f67fdf972806803b3f533de5;hpb=ec2b1859b4f56c1daa2ac02d7a31d1cc8c3dad38 diff --git a/bin/diffgdb b/bin/diffgdb index 260cbce..b44c2c0 100755 --- a/bin/diffgdb +++ b/bin/diffgdb @@ -1,46 +1,129 @@ -#! /bin/sh -exec diff \ - -I '^Test Run By ' \ - -I '^gnatbind ' \ - -I '^gnatlink ' \ - -I '^gnatlink: ' \ - -I '^gnatmake: ' \ - -I '^gcc ' \ - -I '^/usr/bin/ld: .* architecture of input file .* is incompatible with .* output$' \ - -I '^collect2: ' \ - -I '^UNSUPPORTED: ' \ - -I '^UNTESTED: ' \ - -I '^UNRESOLVED: ' \ - -I '^ERROR: ' \ - -I '^WARNING: ' \ - -I '^Running ' \ - -I '^[^:]*[.]ad[sb]:[0-9]' \ - -I '^\(PASS\|FAIL\): gdb.server/ext-run.exp: get process list$' \ - -I '^\(PASS\|FAIL\): gdb.base/checkpoint.exp: info checkpoints with at least 600 checkpoints$' \ - -I '^\(PASS\|FAIL\): gdb.base/checkpoint.exp: break2 with many checkpoints$' \ - -I '^\(PASS\|FAIL\): gdb.base/interrupt.exp: ' \ - -I '^\(PASS\|FAIL\): gdb.base/gdb1250.exp: ' \ - -I '^KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app (PRMS: gdb/10116)$' \ - -I '^PASS: gdb.threads/watchthreads2.exp: all threads incremented x$' \ - -I '^FAIL: gdb.base/sigbpt.exp: Verify that SIGSEGV occurs at the last STEPI insn (none 0x[a-f0-9]*)$' \ - -I '^PASS: gdb.threads/threadcrash.exp: core file: ' \ - -I '^PASS: gdb.threads/watchthreads.exp: disable [0-9]*$' \ - -I '^FAIL: gdb.mi/mi-nsmoribund.exp: unexpected stop$' \ - -I '^PASS: gdb.mi/mi-nsmoribund.exp: resume all, program exited normally$' \ - -I '^gdb compile failed, ' \ - -I '^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$' \ - -I '^/tmp/[a-zA-Z0-9]*.o: could not read symbols: Bad value$' \ - -I '^# of ' \ - -I '^/home/' \ - -I '^PASS: gdb.arch/i386-biarch-core.exp: core-file /home/.*/i386-biarch-core.core$' \ - -I '^\.\./as-new [0-9.]*$' \ - -I '^ld/ld-new [0-9.]*$' \ - -I '^\(PASS\|FAIL\): gdb.mi/mi-break.exp: test hitting breakpoint with commands$' \ - -I '^\(PASS\|FAIL\): gdb.threads/attach-stopped.exp: threaded: attach2, exit leaves process sleeping$' \ - -I '^\(PASS\|FAIL\): gdb.threads/attachstop-mt.exp: attach3, exit leaves process stopped$' \ - -I '^\(PASS\|FAIL\): gdb.threads/attachstop-mt.exp: attach4 stop by interrupt\(\| (timeout)\)$' \ - -I '^\(PASS\|FAIL\): gdb.threads/attachstop-mt.exp: attach4, exit leaves process sleeping$' \ - -I '^\(PASS\|FAIL\): gdb.threads/manythreads.exp: info threads$' \ - -I 'gdb version [0-9][^ ]* -nw -nx $' \ - -I '^\(PASS\|FAIL\): gdb.threads/attach-stopped.exp: threaded: attach1, exit leaves process stopped$' \ --ru "$@" | grep -v '^diff ' +#! /usr/bin/perl +use strict; +use warnings; + +sub gitmark($) { + my($s)=@_; + return "" if $s!~m{^(... )([^/]*/+[^/]*)/}; + my($pfx,$dir)=($1,$2); + local *GIT; + $dir.="/build/gdbgit"; + return "" if !-d $dir; + open GIT,"cd '$dir';git log --format=%H HEAD^..HEAD|" or return ""; + my $git=do { local $/; ; }; + close GIT; + chomp $git; + return "${pfx}GIT commit $git\n" if $git=~/^[0-9a-f]{40}$/; + return ""; +} + +my @ignore=( +qr{^.PASS: }o, +qr{^.KPASS: }o, +qr{^-FAIL: }o, +qr{^-KFAIL: }o, +qr{^-XFAIL: }o, +qr{^.Test Run By }o, +qr{^.gnatbind }o, +qr{^.gnatlink }o, +qr{^.gnatlink: }o, +qr{^.gnatmake: }o, +qr{^.gcc }o, +qr{^./usr/bin/ld: .* architecture of input file .* is incompatible with .* output\n$}o, +qr{^.collect2: }o, +#qr{^.UNSUPPORTED: }o, +#qr{^.UNTESTED: }o, +#qr{^.UNRESOLVED: }o, +#qr{^.ERROR: }o, +#qr{^.WARNING: }o, +qr{^.[^:]*[.]ad[sb]:[0-9]}o, +qr{^.gdb compile failed, }o, +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, +qr{^./tmp/[a-zA-Z0-9]*.o: could not read symbols: Bad value\n$}o, +qr{^./tmp/[a-zA-Z0-9]*.s:\d+: Error: unrecognized symbol type "gnu_indirect_function"\n$}o, +qr{^./tmp/[a-zA-Z0-9]*.o: In function `\S+':\n$}o, +qr{^./tmp/[a-zA-Z0-9]*.o:.*: undefined reference to `.*'\n$}o, +qr{^./tmp/[a-zA-Z0-9]*.s:\d+: Error: syntax error; found `.' but expected `,'\n$}o, +qr{^./tmp/[a-zA-Z0-9]*.s:\d+: Error: junk at end of line: `.(?:plt|local)'\n$}o, +qr{^./usr/bin/ld: /tmp/[a-zA-Z0-9]*.o\(\.text\+0x[0-9a-f]+\): unresolvable R_PPC64_REL24 relocation against symbol `\S+'\n$}o, +qr{^.# of }o, +qr{^./home/}o, +qr{^.\.\./as-new [0-9.]*\n$}o, +qr{^.(?:/unsafe)?ld/ld-new [0-9.]*\n$}o, +qr{\bgdb version \d\S+ -nw -nx\b}o, +qr{^.FAIL: \S+\.exp: valgrind check \d+\n$}o, +qr{^.KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app \(PRMS: gdb/10116\)\n$}o, +qr{^.FAIL: gdb.base/info-os.exp: .*\n$}o, +qr{^.FAIL: gdb.threads/multiple-step-overs.exp: .*\n$}o, +qr{^.FAIL: gdb.base/random-signal.exp: stop with control-c \Q(timeout)\E\n$}o, +); +my $ignore=shift @ignore; +$ignore=qr/$ignore|$_/ for @ignore; + +my $opt_new; +while (1) { + if ($ARGV[0] eq "-r") { + $ignore=undef; + shift; + next; + } + if ($ARGV[0] eq "-N") { + $opt_new=1; + shift; + next; + } + last; +} + +my $last; +my $lastfile; +local *DIFF; +my(@diff)=("diff","-rU-1",@ARGV); +open DIFF,"-|",@diff or die join(" ",@diff).": $!"; +while () { + next if /^diff /; + my($thisname)=m{^.(?:Running (?:.*/)?|[A-Z]+: )(gdb[.]\w+/\S+[.]exp)(?: \Q...\E|: .*)$}; + $thisname||=(m{^.\t\t=== gdb (Summary) ===\n$})[0]; + $thisname||=(m{^(Only in) })[0]; + my $this; + if (!$thisname || ($last && $thisname eq $last->{"name"})) { +#if (!$thisname) { print "X: !thisname\n"; } else { print "X: \"".$last->{"name"}."\" -> \"$thisname\"\n"; } + $this=$last; + } else { +#print "X: new \"$thisname\"\n"; + $last=$this={"name"=>$thisname,"+Running"=>(/^[+]/||0)}; + } + next if /^@@ .* @@\n$/; + if ($this->{"print"}) { + print; + next; + } + if (/^Only in /) { + $lastfile=$_; + } + if (/^--- /) { + $lastfile=$_.gitmark($_); + next; + } + if (/^\Q+++\E /) { + $lastfile.=$_.gitmark($_); + next; + } + $this->{"buffer"}.=$_; + next if /^ /; + next if /^[+]Running / && $thisname && !$opt_new; + next if $ignore && /$ignore/o; + next if /^[+]FAIL: / && $this->{"+Running"}; + next if /^[+]KFAIL: / && $this->{"+Running"}; + next if /^[+]XFAIL: / && $this->{"+Running"}; + next if /^[+]UNTESTED: / && $this->{"+Running"}; + next if /^[+]gdb compile failed, / && $this->{"+Running"}; + next if /^[+].*: Error: bad register name `%.*'\n$/ && $this->{"+Running"}; + next if /^[+].*: Error: `.*' is only supported in 64-bit mode\n$/ && $this->{"+Running"}; + + $this->{"print"}=1; + print $lastfile||""; $lastfile=undef(); + print "\n#".($this->{"name"}||"???")."\n"; + print $this->{"buffer"}; $this->{"buffer"}=undef(); + next; +}