6 use File
::Temp
'tempfile';
9 die "Usage: $0 <host:port> <executable>\n";
13 if( opendir SD
, "$Bin/../staging_dir" )
15 my ( $tid, $arch, $libc, @arches );
17 if( $ARGV[1] =~ m!\btarget-(.+?)_([^_]+libc[^_/]+)\b!i )
19 print("Using target $1 ($2)\n");
20 ($arch, $libc) = ($1, $2);
25 print("Choose target:\n");
27 while( defined( my $e = readdir SD
) )
29 if( -d
"$Bin/../staging_dir/$e" && $e =~ /^target
-(.+?
)_
([^_
]+libc
[^_
]+)/i
)
31 push @arches, [ $1, $2 ];
32 printf(" %2d) %s (%s)\n", @arches + 0, $1, $2);
41 chomp($tid = <STDIN
>);
42 } while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches );
44 ($arch, $libc) = @
{$arches[$tid-1]};
48 ($arch, $libc) = @
{$arches[0]};
55 my ($gdb) = glob("$Bin/../staging_dir/toolchain-${arch}_*_${libc}*/bin/*-gdb");
56 if( defined($gdb) && -x
$gdb )
58 my ( $fh, $fp ) = tempfile
();
61 my ($sysroot) = glob("$Bin/../staging_dir/target-${arch}_${libc}/root-*/");
63 print $fh "set sysroot $sysroot\n" if $sysroot;
64 print $fh "target remote $ARGV[0]\n";
66 my $file = -f
"$sysroot/$ARGV[1]" ?
"$sysroot/$ARGV[1]" : $ARGV[1];
67 system($gdb, '-x', $fp, $file);
74 print("No gdb found! Make sure that CONFIG_GDB is set!\n");
80 print("No staging_dir found! You need to compile at least once!\n");
This page took 0.051072 seconds and 5 git commands to generate.