diff --git a/.vscode/launch.json b/.vscode/launch.json index 0ddca2b..efee8ec 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -41,23 +41,5 @@ "gdbpath": "${workspaceFolder}/nim-gdb", "valuesFormatting": "parseText" }, - { - "name": "Nim Debug SDL2 Mac", - "type": "gdb", - "request": "launch", - "target": "${workspaceFolder}/build/demosdl2/demo_sdl2_debug", - "cwd": "${workspaceRoot}", - "gdbpath": "${workspaceFolder}/nim-gdb-mac", - "valuesFormatting": "parseText" - }, - { - "name": "Nim Debug GLFW Mac", - "type": "gdb", - "request": "launch", - "target": "${workspaceFolder}/build/demo/demo_glfw_debug", - "cwd": "${workspaceRoot}", - "gdbpath": "${workspaceFolder}/nim-gdb-mac", - "valuesFormatting": "parseText" - }, ] } \ No newline at end of file diff --git a/nim-gdb b/nim-gdb index 7d77479..1dfd3b8 100755 --- a/nim-gdb +++ b/nim-gdb @@ -5,9 +5,14 @@ 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 || which greadlink > /dev/null || (echo "readlink not in PATH. Please install coreutils from brew if on Mac."; exit 1) + +nreadlink () { + (which readlink > /dev/null && readlink "$@") || (which greadlink > /dev/null && greadlink "$@") || echo "Readlink could not be found" +} # Find out where the pretty printer Python module is -NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim)))) +NIM_SYSROOT=$(dirname $(dirname $(nreadlink -e $(which nim)))) GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" # Run GDB with the additional arguments that load the pretty printers diff --git a/nim-gdb-mac b/nim-gdb-mac deleted file mode 100755 index 5d33d98..0000000 --- a/nim-gdb-mac +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# Exit if anything fails -set -e - -which nim > /dev/null || (echo "nim not in PATH"; exit 1) -which gdb > /dev/null || (echo "gdb not in PATH"; exit 1) - -# Find out where the pretty printer Python module is -NIM_SYSROOT=$(dirname $(dirname $(greadlink -e $(which nim)))) -GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/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 -# different/specific command (defaults to `gdb`). -NIM_GDB="${NIM_GDB:-gdb}" -echo "source $GDB_PYTHON_MODULE_PATH" > gdbcommands.txt -# exec replaces the new process of bash with gdb. It is always good to -# have fewer processes. -exec ${NIM_GDB} --command="gdbcommands.txt" "$@" \ No newline at end of file