X-Git-Url: http://git.ozo.com/?p=openwrt-10.03%2F.git;a=blobdiff_plain;f=scripts%2Fremote-gdb;h=60efb9703fc8d4239da3611d6a2e5ded2d5cd6d1;hp=9701b31c152325ac5e659cb3720ac5740fc93a01;hb=391eb6e69c09d9f107b8c30a91c63dce37820043;hpb=1dc2db31a33723283805e325c9dcdde41d03bac1 diff --git a/scripts/remote-gdb b/scripts/remote-gdb index 9701b31c1..60efb9703 100755 --- a/scripts/remote-gdb +++ b/scripts/remote-gdb @@ -33,13 +33,20 @@ if( opendir SD, "$Bin/../staging_dir" ) } } - # Query arch - do { - print("Target? > "); - chomp($tid = ); - } while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches ); + if( @arches > 1 ) + { + # Query arch + do { + print("Target? > "); + chomp($tid = ); + } 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; @@ -47,18 +54,14 @@ if( opendir SD, "$Bin/../staging_dir" ) # Find 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(); - # Find library paths - my $libdirs = join ':', ( - 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/") - ); + # Find sysroot + my ($sysroot) = glob("$Bin/../staging_dir/target-${arch}_${libc}/root-*/"); - print $fh "set solib-search-path $libdirs\n"; + print $fh "set sysroot $sysroot\n" if $sysroot; print $fh "target remote $ARGV[0]\n"; system($gdb, '-x', $fp, $ARGV[1]);