+gitmark
[nethome.git] / bin / diffgdb
index a0c4789..b44c2c0 100755 (executable)
@@ -2,6 +2,21 @@
 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 $/; <GIT>; };
+  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,
@@ -22,18 +37,6 @@ qr{^.collect2: }o,
 #qr{^.ERROR: }o,
 #qr{^.WARNING: }o,
 qr{^.[^:]*[.]ad[sb]:[0-9]}o,
-qr{^.(?:PASS|FAIL): gdb.server/ext-run.exp: get process list\n$}o,
-qr{^.(?:PASS|FAIL): gdb.base/checkpoint.exp: info checkpoints with at least 600 checkpoints\n$}o,
-qr{^.(?:PASS|FAIL): gdb.base/checkpoint.exp: break2 with many checkpoints\n$}o,
-qr{^.(?:PASS|FAIL): gdb.base/interrupt.exp: }o,
-qr{^.(?:PASS|FAIL): gdb.base/gdb1250.exp: }o,
-qr{^.KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app \(PRMS: gdb/10116\)\n$}o,
-qr{^.PASS: gdb.threads/watchthreads2.exp: all threads incremented x\n$}o,
-qr{^.FAIL: gdb.base/sigbpt.exp: Verify that SIGSEGV occurs at the last STEPI insn \(none 0x[a-f0-9]*\)\n$}o,
-qr{^.PASS: gdb.threads/threadcrash.exp: core file: }o,
-qr{^.PASS: gdb.threads/watchthreads.exp: disable [0-9]*\n$}o,
-qr{^.FAIL: gdb.mi/mi-nsmoribund.exp: unexpected stop\n$}o,
-qr{^.PASS: gdb.mi/mi-nsmoribund.exp: resume all, program exited normally\n$}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,
@@ -45,37 +48,14 @@ 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{^.PASS: gdb.arch/i386-biarch-core.exp: core-file /home/.*/i386-biarch-core.core\n$}o,
 qr{^.\.\./as-new [0-9.]*\n$}o,
-qr{^.ld/ld-new [0-9.]*\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-break.exp: test hitting breakpoint with commands\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attach-stopped.exp: threaded: attach2, exit leaves process sleeping\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach3, exit leaves process stopped\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach4 stop by interrupt(?: \(timeout\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach4, exit leaves process sleeping\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/manythreads.exp: info threads\n$}o,
-qr{gdb version  \d\S+ -nw -nx \n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attach-stopped.exp: threaded: attach1, exit leaves process stopped\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted(?: \(timeout\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.server/server-run.exp: continue to main\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-nonstop.exp: w1,i0 stop(?: \(timeout\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.reverse/i387-env-reverse.exp: set reverse direction(?: \(timeout\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.reverse/i387-env-reverse.exp: record to end of main(?: \(timeout\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: compare intermediate binary file\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: compare binary file\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-file-transfer.exp: deleted binary file\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-simplerun.exp: continue to end(?: \(failed to resume\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.mi/mi-simplerun.exp: continue to end(?: \(unknown output after running\))?\n$}o,
-qr{^.(?:PASS|FAIL): gdb.server/file-transfer.exp: verified deleted binary file\n$}o,
-qr{^.(?:PASS|FAIL): gdb.server/file-transfer.exp: deleted binary file\n$}o,
-qr{^.(?:PASS|FAIL): gdb.threads/attachstop-mt.exp: attach1, post-gdb sanity check of the sleeping state - Red Hat BZ 197584\n$}o,
-qr{^."uplevel #0 source .*gdb/testsuite/gdb.threads/watchthreads-thr(?:eaded\.exp|.*\.\.\.)"\n$}o,
-qr{^.(?:PASS|FAIL): gdb.cp/ref-types.exp: print value of rL\n$}o,
-qr{^.FAIL: gdb.threads/watchthreads-reorder.exp: reorder[01]: (?:continue [ab]|rwatch unused1_rwatch)(?: \((?:timeout|the program exited|the program is no longer running)\))?\n$}o,
-qr{^.FAIL: gdb.base/sigbpt.exp: Verify that SIGSEGV occurs at the last STEPI insn \(none 0x[0-9a-f]+\)\n$}o,
-qr{^.(?:KFAIL|FAIL): gdb.base/sigbpt.exp: stepi bp at segv; stepi out of handler(?: \(corrupt pc\) \(PRMS: gdb/1702\))?\n$}o,
-qr{^.(?:KFAIL|FAIL): gdb.base/sigbpt.exp: stepi bp before and at segv; stepi out of handler(?: \(corrupt pc\) \(PRMS: gdb/1702\))?\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;
@@ -122,11 +102,11 @@ while (<DIFF>) {
     $lastfile=$_;
   }
   if (/^--- /) {
-    $lastfile=$_;
+    $lastfile=$_.gitmark($_);
     next;
   }
   if (/^\Q+++\E /) {
-    $lastfile.=$_;
+    $lastfile.=$_.gitmark($_);
     next;
   }
   $this->{"buffer"}.=$_;