#!/bin/sh

PID=$1
APP=$2
TAG=$3

start-stop-daemon --start --pidfile $PID \
	--exec /usr/bin/gdb \
	-- -batch \
	-ex "handle SIGILL nostop noprint" \
	-ex "handle SIGHUP nostop" \
	-ex "run" \
	-ex "bt" \
	--args $APP -f | \
	logger -t $TAG &
