Fix bash issue debugging

This commit is contained in:
Joey Yakimowich-Payne 2020-03-15 15:37:10 -06:00
commit 9aa325bfa7
2 changed files with 10 additions and 6 deletions

4
.vscode/launch.json vendored
View file

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

View file

@ -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" "$@"
exec "${NIM_GDB}" -eval-command="source $GDB_PYTHON_MODULE_PATH" "$@"