Combine mac & linux gdb script
This commit is contained in:
parent
86bd1747fc
commit
cb7ed09674
3 changed files with 6 additions and 39 deletions
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
|
|
@ -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"
|
||||
},
|
||||
]
|
||||
}
|
||||
7
nim-gdb
7
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
|
||||
|
|
|
|||
20
nim-gdb-mac
20
nim-gdb-mac
|
|
@ -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" "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue