Created
November 9, 2016 14:50
-
-
Save packmad/7cc04a957bd5d0bbc5f9bb65ef1126fb to your computer and use it in GitHub Desktop.
Wrapper which ensures equal stack offsets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while getopts "dte:h?" opt ; do | |
case "$opt" in | |
h|\?) | |
printf "usage: %s -e KEY=VALUE prog [args...]\n" $(basename $0) | |
exit 0 | |
;; | |
t) | |
tty=1 | |
gdb=1 | |
;; | |
d) | |
gdb=1 | |
;; | |
e) | |
env=$OPTARG | |
;; | |
esac | |
done | |
shift $(expr $OPTIND - 1) | |
prog=$(readlink -f $1) | |
shift | |
if [ -n "$gdb" ] ; then | |
if [ -n "$tty" ]; then | |
touch /tmp/gdb-debug-pty | |
exec env - $env TERM=screen PWD=$PWD gdb -tty /tmp/gdb-debug-pty --args $prog "$@" | |
else | |
exec env - $env TERM=screen PWD=$PWD gdb --args $prog "$@" | |
fi | |
else | |
exec env - $env TERM=screen PWD=$PWD $prog "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment