1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 03:18:26 +02:00

[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
This commit is contained in:
jow 2010-03-18 21:10:56 +00:00
parent 56f1be7e5c
commit ffb6292494

View File

@ -33,6 +33,8 @@ if( opendir SD, "$Bin/../staging_dir" )
} }
} }
if( @arches > 1 )
{
# Query arch # Query arch
do { do {
print("Target? > "); print("Target? > ");
@ -41,24 +43,25 @@ if( opendir SD, "$Bin/../staging_dir" )
($arch, $libc) = @{$arches[$tid-1]}; ($arch, $libc) = @{$arches[$tid-1]};
} }
else
{
($arch, $libc) = @{$arches[0]};
}
}
closedir SD; closedir SD;
# 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]);