X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Fcodegen-diff;h=2c3ac4c6dfa8352e1109a2743edfb7e25f084359;hb=21f375620d02706ba8e188cd1079d0f9e5a76266;hp=9b2930b47e48e1f6469cec015f3b01d038fb4955;hpb=3fb290e41f2eafdfed43613691232943112618fb;p=oota-llvm.git diff --git a/utils/codegen-diff b/utils/codegen-diff index 9b2930b47e4..2c3ac4c6dfa 100755 --- a/utils/codegen-diff +++ b/utils/codegen-diff @@ -1,11 +1,13 @@ #!/usr/bin/perl use Getopt::Std; +$DEBUG = 0; sub parse_objdump_file { my ($filename) = @_; my @result; open (INPUT, $filename) or die "$filename: $!\n"; + print "opened objdump output file $filename\n" if $DEBUG; while () { if (/\s*([0-9a-f]*):\t(([0-9a-f]{2} )+) *\t(.*)$/) { my ($addr, $bytes, $instr) = ($1, $2, $4); @@ -13,6 +15,7 @@ sub parse_objdump_file { $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace $instr =~ s/\s*(.*\S)\s*/$1/; push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); + print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; } } close INPUT; @@ -24,6 +27,7 @@ sub parse_gdb_file { my @result; my $got_addr; open (INPUT, $filename) or die "$filename: $!\n"; + print "opened gdb output file $filename\n" if $DEBUG; while () { if (/^(0x[0-9a-f]*):\t([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) { my ($addr, $bytes, $instr) = ($1, $3, $2); @@ -32,6 +36,7 @@ sub parse_gdb_file { $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace $instr =~ s/\s*(.*\S)\s*/$1/; push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); + print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; } elsif (/^(0x[0-9a-f]*):\t$/) { # deal with gdb's line breaker $got_addr = $1; } elsif ($got_addr && /^ ([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) { @@ -41,6 +46,7 @@ sub parse_gdb_file { $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace $instr =~ s/\s*(.*\S)\s*/$1/; push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr}); + print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG; undef $got_addr; } }