2 # Exit if anything fails
5 # Prefer rustc in the same directory as this script
7 if [ -x "$DIR/rustc" ]; then
13 # Find out where the pretty printer Python module is
14 RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
15 GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
17 # Run GDB with the additional arguments that load the pretty printers
18 # Set the environment variable `RUST_GDB` to overwrite the call to a
19 # different/specific command (defaults to `gdb`).
20 RUST_GDB="${RUST_GDB:-gdb}"
21 PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
22 --directory="$GDB_PYTHON_MODULE_DIRECTORY" \
23 -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \