summary refs log tree commit diff stats
path: root/bin
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2018-07-16 19:30:05 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-16 19:30:05 +0200
commit97d37aeb0bb1ed2997eddb3b7f8ef53cd04f10ef (patch)
tree889820d6b9e044d8d762543c50088893596453ea /bin
parent217a2cf0982302b9d89d2c06fc96eaf72f0518fe (diff)
downloadNim-97d37aeb0bb1ed2997eddb3b7f8ef53cd04f10ef.tar.gz
Gdb pretty printers (#8263)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nim-gdb18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/nim-gdb b/bin/nim-gdb
new file mode 100755
index 000000000..e7b41094d
--- /dev/null
+++ b/bin/nim-gdb
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+# Exit if anything fails
+set -e
+
+# Find out where the pretty printer Python module is
+NIM_SYSROOT=$(dirname $(dirname $(readlink -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}"
+# exec replaces the new process of bash with gdb. It is always good to
+# have fewer processes.
+exec ${NIM_GDB} \
+  -eval-command "source $GDB_PYTHON_MODULE_PATH" \
+  "$@"