2019-11-04 21:21:42 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# The setsid command is needed so that Ctrl+C in GDB doesn't kill avarice
|
|
|
|
: ${SETSID:=setsid}
|
|
|
|
|
2021-04-22 08:45:57 +02:00
|
|
|
if avr-gdb -v &> /dev/null; then
|
2020-03-11 10:51:40 +01:00
|
|
|
GDB=avr-gdb
|
2021-04-22 08:45:57 +02:00
|
|
|
elif gdb-multiarch -v &> /dev/null; then
|
2021-01-19 23:59:05 +01:00
|
|
|
GDB=gdb-multiarch
|
2020-03-11 10:51:40 +01:00
|
|
|
else
|
|
|
|
echo "Couldn't find multiarch GDB or AVR GDB. Check \$PATH."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-11-04 21:21:42 +01:00
|
|
|
sleep 2
|
|
|
|
${SETSID} -w avarice $1 &
|
2020-03-11 10:51:40 +01:00
|
|
|
sleep 3 && $GDB -ex "target remote localhost:$3" $4
|
2019-11-04 21:21:42 +01:00
|
|
|
|
|
|
|
# avarice exits with 1 if the connection is released, therefore we always exit with 0
|
|
|
|
exit 0
|