|
|
@ -33,13 +33,20 @@ if( opendir SD, "$Bin/../staging_dir" ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Query arch |
|
|
|
if( @arches > 1 ) |
|
|
|
do { |
|
|
|
{ |
|
|
|
print("Target? > "); |
|
|
|
# Query arch |
|
|
|
chomp($tid = <STDIN>); |
|
|
|
do { |
|
|
|
} while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches ); |
|
|
|
print("Target? > "); |
|
|
|
|
|
|
|
chomp($tid = <STDIN>); |
|
|
|
|
|
|
|
} while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches ); |
|
|
|
|
|
|
|
|
|
|
|
($arch, $libc) = @{$arches[$tid-1]}; |
|
|
|
($arch, $libc) = @{$arches[$tid-1]}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
($arch, $libc) = @{$arches[0]}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
closedir SD; |
|
|
|
closedir SD; |
|
|
@ -47,18 +54,14 @@ if( opendir SD, "$Bin/../staging_dir" ) |
|
|
|
# Find gdb |
|
|
|
# Find gdb |
|
|
|
my ($gdb) = glob("$Bin/../build_dir/toolchain-${arch}_*_${libc}/gdb-*/gdb/gdb"); |
|
|
|
my ($gdb) = glob("$Bin/../build_dir/toolchain-${arch}_*_${libc}/gdb-*/gdb/gdb"); |
|
|
|
|
|
|
|
|
|
|
|
if( -x $gdb ) |
|
|
|
if( defined($gdb) && -x $gdb ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
my ( $fh, $fp ) = tempfile(); |
|
|
|
my ( $fh, $fp ) = tempfile(); |
|
|
|
|
|
|
|
|
|
|
|
# Find library paths |
|
|
|
# Find sysroot |
|
|
|
my $libdirs = join ':', ( |
|
|
|
my ($sysroot) = glob("$Bin/../staging_dir/target-${arch}_${libc}/root-*/"); |
|
|
|
glob("$Bin/../staging_dir/target-${arch}_${libc}/root-*/{,usr/}lib/"), |
|
|
|
|
|
|
|
glob("$Bin/../staging_dir/target-${arch}_${libc}/{,usr/}lib/"), |
|
|
|
|
|
|
|
glob("$Bin/../staging_dir/toolchain-${arch}_*_${libc}/lib/") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print $fh "set solib-search-path $libdirs\n"; |
|
|
|
print $fh "set sysroot $sysroot\n" if $sysroot; |
|
|
|
print $fh "target remote $ARGV[0]\n"; |
|
|
|
print $fh "target remote $ARGV[0]\n"; |
|
|
|
|
|
|
|
|
|
|
|
system($gdb, '-x', $fp, $ARGV[1]); |
|
|
|
system($gdb, '-x', $fp, $ARGV[1]); |
|
|
|