#!/bin/bash TARGET_IP="$1" # stop gdbserver and delete old binary on target echo "Deploy program on target" ssh root@${TARGET_IP} "sh -c '/usr/bin/killall -q gdbserver; rm -rf /root/helloworld.bin exit 0'" # deploy program to the target scp helloworld.bin root@${TARGET_IP}:/root/ # start gdbserver on target echo "Run progran with gdb on target" ssh -t root@${TARGET_IP} "sh -c 'cd /root/; gdbserver localhost:3000 helloworld.bin'"