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-([^_/]+)_([^_/]+)\b! )
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
-([^_
]+)_
([^_
]+)/ )
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/../build_dir/toolchain-${arch}_*_${libc}/gdb-*/gdb/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 system($gdb, '-x', $fp, $ARGV[1]);
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.065962 seconds and 5 git commands to generate.