From 82ed7830ad5d8d30751ec608ef07c8d42792c878 Mon Sep 17 00:00:00 2001 From: Nicolas Bigaouette Date: Tue, 18 Apr 2017 14:00:08 -0400 Subject: [PATCH 1/2] 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`. --- src/etc/rust-gdb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb index 520a108da914c..ef1689886cb88 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" \ "$@" From 61b7ebe7d3fbe19c7aaf7b8fa5b9661eccca6061 Mon Sep 17 00:00:00 2001 From: Nicolas Bigaouette Date: Thu, 20 Apr 2017 11:20:33 -0400 Subject: [PATCH 2/2] Rename environment variable `GDB_CMD` to `RUST_GDB` to prevent ambiguity --- src/etc/rust-gdb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb index ef1689886cb88..52601cd96f80d 100755 --- a/src/etc/rust-gdb +++ b/src/etc/rust-gdb @@ -17,10 +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 -# Set the environment variable `GDB_CMD` to overwrite the call to a +# Set the environment variable `RUST_GDB` 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} \ +RUST_GDB="${RUST_GDB:-gdb}" +PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" ${RUST_GDB} \ -d "$GDB_PYTHON_MODULE_DIRECTORY" \ -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \ "$@"