| 1 |
#!@pathperl@ |
| 2 |
$prefix = "@prefix@"; |
| 3 |
$datadir = "@datadir@"; |
| 4 |
$debugger = "avr-gdb"; |
| 5 |
|
| 6 |
@argcmds = ( "-b", "--cd", "--command", "--core", "--pid", "--directory", |
| 7 |
"--exec", "--interpreter", "--se", "--symbols", "--tty", |
| 8 |
"-s", "-e", "-se", "-x", "-d" ); |
| 9 |
|
| 10 |
for ($i = 0; $i <= $#ARGV; $i++) { |
| 11 |
$arg = $ARGV[$i]; |
| 12 |
|
| 13 |
if ($arg =~ /^-/ && |
| 14 |
(grep $_ eq $arg, @argcmds || grep /^-$arg$/, @argcmds)) { |
| 15 |
$i++; |
| 16 |
} |
| 17 |
elsif ($arg eq "--debugger" && $i < $#ARGV) { |
| 18 |
$debugger = $ARGV[$i + 1]; |
| 19 |
splice @ARGV, $i, 2; |
| 20 |
$i--; |
| 21 |
} |
| 22 |
elsif ($arg eq "--capture" || $arg eq "--ignore-intr") { |
| 23 |
$ENV{AVARICE_ARGS} = "$ENV{AVARICE_ARGS} $arg"; |
| 24 |
splice @ARGV, $i, 1; |
| 25 |
# Don't load an executable |
| 26 |
$capture = 1 if $arg eq "--capture"; |
| 27 |
$i--; |
| 28 |
} |
| 29 |
elsif ($arg eq "--external") { |
| 30 |
$avarice_running = 1; |
| 31 |
splice @ARGV, $i, 1; |
| 32 |
$i--; |
| 33 |
} |
| 34 |
elsif (!($arg =~ /^-/)) { |
| 35 |
$exe = $arg; |
| 36 |
break; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
$exe = "" if $capture; |
| 41 |
|
| 42 |
system "start-avarice $exe" unless $avarice_running; |
| 43 |
unshift @ARGV, ($debugger, "-x", "$datadir/avarice/gdb-avarice-script" ); |
| 44 |
exec @ARGV; |