mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-06 21:27:23 +00:00
Add debug variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9188 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
|
$DEBUG = 0;
|
||||||
|
|
||||||
sub parse_objdump_file {
|
sub parse_objdump_file {
|
||||||
my ($filename) = @_;
|
my ($filename) = @_;
|
||||||
my @result;
|
my @result;
|
||||||
open (INPUT, $filename) or die "$filename: $!\n";
|
open (INPUT, $filename) or die "$filename: $!\n";
|
||||||
|
print "opened objdump output file $filename\n" if $DEBUG;
|
||||||
while (<INPUT>) {
|
while (<INPUT>) {
|
||||||
if (/\s*([0-9a-f]*):\t(([0-9a-f]{2} )+) *\t(.*)$/) {
|
if (/\s*([0-9a-f]*):\t(([0-9a-f]{2} )+) *\t(.*)$/) {
|
||||||
my ($addr, $bytes, $instr) = ($1, $2, $4);
|
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
|
$bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
|
||||||
$instr =~ s/\s*(.*\S)\s*/$1/;
|
$instr =~ s/\s*(.*\S)\s*/$1/;
|
||||||
push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
|
push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
|
||||||
|
print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close INPUT;
|
close INPUT;
|
||||||
@@ -24,6 +27,7 @@ sub parse_gdb_file {
|
|||||||
my @result;
|
my @result;
|
||||||
my $got_addr;
|
my $got_addr;
|
||||||
open (INPUT, $filename) or die "$filename: $!\n";
|
open (INPUT, $filename) or die "$filename: $!\n";
|
||||||
|
print "opened gdb output file $filename\n" if $DEBUG;
|
||||||
while (<INPUT>) {
|
while (<INPUT>) {
|
||||||
if (/^(0x[0-9a-f]*):\t([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) {
|
if (/^(0x[0-9a-f]*):\t([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) {
|
||||||
my ($addr, $bytes, $instr) = ($1, $3, $2);
|
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
|
$bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
|
||||||
$instr =~ s/\s*(.*\S)\s*/$1/;
|
$instr =~ s/\s*(.*\S)\s*/$1/;
|
||||||
push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
|
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
|
} elsif (/^(0x[0-9a-f]*):\t$/) { # deal with gdb's line breaker
|
||||||
$got_addr = $1;
|
$got_addr = $1;
|
||||||
} elsif ($got_addr && /^ ([^\t]*)\t[^:]*:\t((0x[0-9a-f]{2}\s*)+)\s*$/) {
|
} 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
|
$bytes =~ s/\s*(.*\S)\s*/$1/; # trim any remaining whitespace
|
||||||
$instr =~ s/\s*(.*\S)\s*/$1/;
|
$instr =~ s/\s*(.*\S)\s*/$1/;
|
||||||
push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
|
push (@result, {'addr' => $addr, 'bytes' => $bytes, 'instr' => $instr});
|
||||||
|
print "addr=$addr bytes='$bytes' instr='$instr'\n" if $DEBUG;
|
||||||
undef $got_addr;
|
undef $got_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user