This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bitpos expansion patches summary


On Tue, 11 Sep 2012 21:04:21 +0200, Jan Kratochvil wrote:
> Also I have found several missed expansions only by hand, one needs to do full
> re-run of splint on the patched sources.  As the patched sources change line
> numbers a bit it already means some sort of rebase.

Attaching some script for remapping the old->new line numbers in a .report
file, I use it locally to play with it without any real results yet.


Jan
#! /usr/bin/perl
use strict;
use warnings;

die "$0 'git diff -U999999 old..new|' <old.report >new.report\n" if @ARGV!=1;
my %h;
{
  local *DIFF;
  open DIFF,$ARGV[0] or die $ARGV[0];
  my($from,$fromline,$to,$toline);
  local $_;
  while (<DIFF>) {
    chomp;
    next if /^diff /;
    next if /^index /;
    next if /^new file mode /;
    next if /^deleted file mode /;
    if (m{^--- a/(\S+)$}) {
      $from=$1;
      $fromline=0;
      next;
    }
    if (m{^\Q+++\E b/(\S+)$}) {
      $to=$1;
      $toline=0;
      next;
    }
    next if /^@@ -[10](?:,\d+)? [+][10](?:,\d+)? @@(?:)$/;
    if (/^ /) {
      $fromline++;
      $toline++;
    } elsif (/^-/) {
      $fromline++;
    } elsif (/^[+]/) {
      $toline++;
    } else {
      die;
    }
    $h{$from}{$fromline}=[$to,$toline];
  }
  close DIFF or die $ARGV[0];
}
{
  local $_;
  while (<STDIN>) {
    s{[(]([^():\s]+):(\d+)[)]}{
      my($basename,$line)=($1,$2);
      my $filename="gdb/$basename";
      my $r=$h{$filename}{$line};
      if ($r) {
	die "$filename->".$r->[0] if $r->[0] ne $filename;
	$line=$r->[1];
      }
      "($basename:$line)";
    }e;
    print;
  }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]