diff --git a/.vscode/launch.json b/.vscode/launch.json index cec3e68..2e8b567 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,7 +19,7 @@ "valuesFormatting": "parseText", "target": "${workspaceFolder}/build/demo/demo_glfw_debug", "cwd": "${workspaceRoot}", - "gdbpath": "${workspaceFolder}/nim-gdb", + "gdbpath": "${workspaceFolder}/nim-gdb.bash", "windows": { "target": "${workspaceFolder}\\build\\demo\\demo_glfw_debug.exe", "cwd": "${workspaceRoot}", @@ -33,7 +33,7 @@ "valuesFormatting": "parseText", "target": "${workspaceFolder}/build/demosdl2/demo_sdl2_debug", "cwd": "${workspaceRoot}", - "gdbpath": "${workspaceFolder}/nim-gdb", + "gdbpath": "${workspaceFolder}/nim-gdb.bash", "windows": { "target": "${workspaceFolder}\\build\\demosdl2\\demo_sdl2_debug.exe", "cwd": "${workspaceRoot}", diff --git a/nim-gdb b/nim-gdb.bash similarity index 59% rename from nim-gdb rename to nim-gdb.bash index 50f4771..c307a3a 100755 --- a/nim-gdb +++ b/nim-gdb.bash @@ -5,10 +5,15 @@ 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) +which readlink > /dev/null || \ + which greadline > /dev/null || \ + ([[ "$OSTYPE" != "darwin"* ]] && (echo "readlink not in PATH. Please install coreutils from homebrew."; exit 1)) || \ + (echo "readlink not in PATH."; exit 1) nreadlink () { - (which greadlink > /dev/null && greadlink "$@") || (which readlink > /dev/null && readlink "$@") || echo "Readlink could not be found" + (which greadlink > /dev/null && greadlink "$@") || \ + (which readlink > /dev/null && readlink "$@") || \ + echo "Readlink could not be found" } # Find out where the pretty printer Python module is @@ -19,7 +24,6 @@ GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" # 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 +exec "${NIM_GDB}" -eval-command="source $GDB_PYTHON_MODULE_PATH" "$@" \ No newline at end of file