nim-gdb 727 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. # Exit if anything fails
  3. set -e
  4. which nim > /dev/null || (echo "nim not in PATH"; exit 1)
  5. which gdb > /dev/null || (echo "gdb not in PATH"; exit 1)
  6. # Find out where the pretty printer Python module is
  7. NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim))))
  8. GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py"
  9. # Run GDB with the additional arguments that load the pretty printers
  10. # Set the environment variable `NIM_GDB` to overwrite the call to a
  11. # different/specific command (defaults to `gdb`).
  12. NIM_GDB="${NIM_GDB:-gdb}"
  13. # exec replaces the new process of bash with gdb. It is always good to
  14. # have fewer processes.
  15. exec ${NIM_GDB} \
  16. -eval-command "source $GDB_PYTHON_MODULE_PATH" \
  17. "$@"