]> git.lizzy.rs Git - rust.git/blobdiff - src/etc/rust-gdb
Rollup merge of #102893 - TaKO8Ki:fix-102878, r=davidtwco
[rust.git] / src / etc / rust-gdb
index 23ba93da8e52932671db9638f2a1d6f196ac5d18..b950cea79edfeaef99761ae1ab76d5cee09cf974 100755 (executable)
@@ -2,8 +2,16 @@
 # Exit if anything fails
 set -e
 
+# Prefer rustc in the same directory as this script
+DIR="$(dirname "$0")"
+if [ -x "$DIR/rustc" ]; then
+  RUSTC="$DIR/rustc"
+else
+  RUSTC="rustc"
+fi
+
 # Find out where the pretty printer Python module is
-RUSTC_SYSROOT=`rustc --print=sysroot`
+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