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);
39 chomp($tid = <STDIN
>);
40 } while( !defined($tid) || $tid !~ /^\d+$/ || $tid < 1 || $tid > @arches );
42 ($arch, $libc) = @
{$arches[$tid-1]};
48 my ($gdb) = glob("$Bin/../build_dir/toolchain-${arch}_*_${libc}/gdb-*/gdb/gdb");
52 my ( $fh, $fp ) = tempfile
();
55 my $libdirs = join ':', (
56 glob("$Bin/../staging_dir/target-${arch}_${libc}/{usr/,}lib"),
57 glob("$Bin/../staging_dir/toolchain-${arch}_*_${libc}/lib")
60 print $fh "set solib-search-path $libdirs\n";
61 print $fh "target remote $ARGV[0]\n";
63 system($gdb, '-x', $fp, $ARGV[1]);
70 print("No gdb found! Make sure that CONFIG_GDB is set!\n");
76 print("No staging_dir found! You need to compile at least once!\n");
This page took 0.057362 seconds and 5 git commands to generate.