From eb5d7e74b5b6d282ecf363b902e1d7dc167b9514 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 18 Mar 2010 21:10:56 +0000 Subject: [scripts] remote-gdb: * use sysroot instead of solib search paths * don't query arch if there's only one choice git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20290 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- scripts/remote-gdb | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/remote-gdb b/scripts/remote-gdb index 9701b31c15..60efb9703f 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]); -- cgit v1.2.3