diff options
Diffstat (limited to 'bin/nim-gdb')
-rwxr-xr-x | bin/nim-gdb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/nim-gdb b/bin/nim-gdb index 9d6f462bb..d4d60e432 100755 --- a/bin/nim-gdb +++ b/bin/nim-gdb @@ -5,10 +5,16 @@ set -e which nim > /dev/null || (echo "nim not in PATH"; exit 1) which gdb > /dev/null || (echo "gdb not in PATH"; exit 1) +which readlink > /dev/null || (echo "readlink not in PATH."; exit 1) + +if [[ $(uname -s) == Darwin || $(uname -s) == *BSD ]]; then + NIM_SYSROOT=$(dirname $(dirname $(readlink -f $(which nim)))) +else + NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim)))) +fi # Find out where the pretty printer Python module is -NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim)))) -GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" +GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/debug/nim-gdb.py" # Run GDB with the additional arguments that load the pretty printers # Set the environment variable `NIM_GDB` to overwrite the call to a @@ -16,6 +22,4 @@ GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" NIM_GDB="${NIM_GDB:-gdb}" # exec replaces the new process of bash with gdb. It is always good to # have fewer processes. -exec ${NIM_GDB} \ - -eval-command "source $GDB_PYTHON_MODULE_PATH" \ - "$@" +exec "${NIM_GDB}" -eval-command="source $GDB_PYTHON_MODULE_PATH" "$@" |