Combine mac & linux gdb script

This commit is contained in:
Joey Yakimowich-Payne 2020-01-12 09:28:59 -07:00
commit cb7ed09674
3 changed files with 6 additions and 39 deletions

18
.vscode/launch.json vendored
View file

@ -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"
},
]
}

View file

@ -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

View file

@ -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" "$@"