Created
June 3, 2013 20:29
-
-
Save icholy/5701120 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
gdbb () { | |
# build with debug flags | |
go build -gcflags "-N -l" -o out | |
# make sure the build didn't fail | |
if [ $? != 0 ]; then return; fi | |
# extract debugger comments | |
gdbb-extract "*.go" > .breakpoints | |
# break on main if no breakpoints were found | |
if [ ! -s .breakpoints ]; then echo "break main.main" > .breakpoints; fi | |
# launch gdb | |
gdb -x .breakpoints -ex run --args out "$@" | |
# clean up | |
rm .breakpoints out | |
} | |
# test | |
gdbbtest () { | |
# build with debug flags | |
go test -c -gcflags "-N -l" "$@" | |
# make sure the build didn't fail | |
if [ $? != 0 ]; then return; fi | |
# extract debugger comments | |
gdbb-extract "*.go" > .breakpoints | |
# if breakpoints were found, run on start | |
if [ -s .breakpoints ]; then | |
gdb -x .breakpoints -ex run *.test | |
else | |
gdb *.test | |
fi | |
# clean up | |
rm .breakpoints *.test | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment