about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
authorNicolas Bigaouette <nbigaouette@gmail.com>2017-04-18 14:00:08 -0400
committerNicolas Bigaouette <nbigaouette@gmail.com>2017-04-18 14:00:08 -0400
commit82ed7830ad5d8d30751ec608ef07c8d42792c878 (patch)
tree109010dd8a264029f03ebca65c90bfe1088af9fa /src/etc
parentc398efc53f09f6e1a8cba4ec2259ffb9d89f0542 (diff)
Use an (over-writable) environment variable for the `gdb` command
Instead of hard-coding the command to run, using the environment
variable `GDB_CMD` (that defaults to `gdb`) allows using a different
debugger than the default `gdb` executable.

This gives the possibility to use `cgdb` as the debugger, which provides
a nicer user interface. Note that one has to use `GDB_CMD="cgdb --"` to
use cgdb (note the trailing `--`) to let cgdb pass the proper arguments
to `gdb`.
Diffstat (limited to 'src/etc')
-rwxr-xr-xsrc/etc/rust-gdb5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
index 520a108da91..ef1689886cb 100755
--- a/src/etc/rust-gdb
+++ b/src/etc/rust-gdb
@@ -17,7 +17,10 @@ RUSTC_SYSROOT=`rustc --print=sysroot`
 GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
 
 # Run GDB with the additional arguments that load the pretty printers
-PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \
+# Set the environment variable `GDB_CMD` to overwrite the call to a
+# different/specific command (defaults to `gdb`).
+GDB_CMD="${GDB_CMD:-gdb}"
+PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" ${GDB_CMD} \
   -d "$GDB_PYTHON_MODULE_DIRECTORY" \
   -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
   "$@"