llvm.org GIT mirror llvm / fb1a996
Add debug variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9188 91177308-0d34-0410-b5e6-96231b3b80d8 Brian Gaeke 17 years ago
1 changed file(s) with 6 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 #!/usr/bin/perl
11
22 use Getopt::Std;
3 $DEBUG = 0;
34
45 sub parse_objdump_file {
56 my ($filename) = @_;
67 my @result;
78 open (INPUT, $filename) or die "$filename: $!\n";
9 print "opened objdump output file $filename\n" if $DEBUG;
810 while () {
911 if (/\s*([0-9a-f]*):\t(([0-9a-f]{2} )+) *\t(.*)$/) {
1012 my ($addr, $bytes, $instr) = ($1, $2, $4);
1214 $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
1315 $instr =~ s/\s*(.*\S)\s*/$1/;
1416 push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
17 print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG;
1518 }
1619 }
1720 close INPUT;
2326 my @result;
2427 my $got_addr;
2528 open (INPUT, $filename) or die "$filename: $!\n";
29 print "opened gdb output file $filename\n" if $DEBUG;
2630 while () {
2731 if (/^(0x[0-9a-f]*):\t([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) {
2832 my ($addr, $bytes, $instr) = ($1, $3, $2);
3135 $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
3236 $instr =~ s/\s*(.*\S)\s*/$1/;
3337 push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
38 print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG;
3439 } elsif (/^(0x[0-9a-f]*):\t$/) { # deal with gdb's line breaker
3540 $got_addr = $1;
3641 } elsif ($got_addr && /^ ([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) {
4045 $bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
4146 $instr =~ s/\s*(.*\S)\s*/$1/;
4247 push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
48 print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG;
4349 undef $got_addr;
4450 }
4551 }