From: Stefan Huber Date: Sat, 30 Jan 2021 18:48:42 +0000 (+0100) Subject: gdb: Check if gdb-dashboard is installed X-Git-Url: http://git.sthu.org/?a=commitdiff_plain;h=dadc62ac7ca2a7243d17c982e05680893ae67649;hp=940c5d4d85492624fab8c01bfd8c98e3eadadc42;p=vimconf.git gdb: Check if gdb-dashboard is installed --- diff --git a/gdb.sh b/gdb.sh index a1bbc34..25ba352 100755 --- a/gdb.sh +++ b/gdb.sh @@ -1,9 +1,25 @@ #!/bin/sh +set -eu + +GDBBIN="gdb" GDBARGS="" +WITH_DASHBOARD=0 + +# If gdb-dashboard is installed, use it +if command -v gdb-dashboard &> /dev/null; then + GDBBIN="gdb-dashboard" + WITH_DASHBOARD=1 +fi +# Check if gdbinit ships gdb-dashboard if [ -e ~/.gdbinit ] && grep -q dashboard ~/.gdbinit; then + WITH_DASHBOARD=1 +fi + +# If we use dashboard then pass corresponding gdbinit file +if [ "${WITH_DASHBOARD}" = "1" ]; then GDBARGS="${GDBARGS} -x ~/.vim/gdbinit-dashboard" fi -exec gdb ${GDBARGS} "$@" +exec ${GDBBIN} ${GDBARGS} "$@"