From dadc62ac7ca2a7243d17c982e05680893ae67649 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Sat, 30 Jan 2021 19:48:42 +0100 Subject: [PATCH] gdb: Check if gdb-dashboard is installed --- gdb.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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} "$@" -- 2.39.5