Skip to content

Commit 38a8aa1

Browse files
authored
Rollup merge of rust-lang#41372 - nbigaouette:master, r=alexcrichton
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`.
2 parents 509f5de + 61b7ebe commit 38a8aa1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/etc/rust-gdb

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ RUSTC_SYSROOT=`rustc --print=sysroot`
1717
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
1818

1919
# Run GDB with the additional arguments that load the pretty printers
20-
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \
20+
# Set the environment variable `RUST_GDB` to overwrite the call to a
21+
# different/specific command (defaults to `gdb`).
22+
RUST_GDB="${RUST_GDB:-gdb}"
23+
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" ${RUST_GDB} \
2124
-d "$GDB_PYTHON_MODULE_DIRECTORY" \
2225
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
2326
"$@"

0 commit comments

Comments
 (0)