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");
57 if( defined($gdb) && -x
$gdb )
59 my ( $fh, $fp ) = tempfile
();
62 my ($sysroot) = glob("$Bin/../staging_dir/target-${arch}_${libc}/root-*/");
64 print $fh "set sysroot $sysroot\n" if $sysroot;
65 print $fh "target remote $ARGV[0]\n";
67 my $file = -f
"$sysroot/$ARGV[1]" ?
"$sysroot/$ARGV[1]" : $ARGV[1];
68 system($gdb, '-x', $fp, $file);
75 print("No gdb found! Make sure that CONFIG_GDB is set!\n");
81 print("No staging_dir found! You need to compile at least once!\n");
This page took 0.054502 seconds and 5 git commands to generate.