summaryrefslogtreecommitdiff
path: root/scripts/remote-gdb
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-18 21:10:56 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-18 21:10:56 +0000
commit029b3f62abdb91be88277f6f1bbfd6ae48cb6491 (patch)
treeef0d9bd614f451352f005df4484bbf912187b82e /scripts/remote-gdb
parent706b6b846f89345851f9bbc30c1aefc6cf65e911 (diff)
downloadmtk-20170518-029b3f62abdb91be88277f6f1bbfd6ae48cb6491.zip
mtk-20170518-029b3f62abdb91be88277f6f1bbfd6ae48cb6491.tar.gz
mtk-20170518-029b3f62abdb91be88277f6f1bbfd6ae48cb6491.tar.bz2
remote-gdb: * use sysroot instead of solib search paths * don't query arch if there's only one choice
SVN-Revision: 20290
Diffstat (limited to 'scripts/remote-gdb')
-rwxr-xr-xscripts/remote-gdb31
1 files changed, 17 insertions, 14 deletions
diff --git a/scripts/remote-gdb b/scripts/remote-gdb
index 9701b31..60efb97 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 = <STDIN>);
- } while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches );
+ if( @arches > 1 )
+ {
+ # Query arch
+ do {
+ 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;
@@ -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]);