Skip to content

Commit 7a824c8

Browse files
committed
Prefer sysroot from rustc in same directory as rust-gdb
If there isn't a rustc in the same directory, then fall back to searching the path.
1 parent 0f72ce1 commit 7a824c8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/etc/rust-gdb

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
# Exit if anything fails
33
set -e
44

5+
# Prefer rustc in the same directory as this script
6+
DIR="$(dirname "$0")"
7+
if [ -x "$DIR/rustc" ]; then
8+
RUSTC="$DIR/rustc"
9+
else
10+
RUSTC="rustc"
11+
fi
12+
513
# Find out where the pretty printer Python module is
6-
RUSTC_SYSROOT=`rustc --print=sysroot`
14+
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
715
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
816

917
# Run GDB with the additional arguments that load the pretty printers

src/etc/rust-gdbgui

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ icon to start your program running.
3131
exit 0
3232
fi
3333

34+
# Prefer rustc in the same directory as this script
35+
DIR="$(dirname "$0")"
36+
if [ -x "$DIR/rustc" ]; then
37+
RUSTC="$DIR/rustc"
38+
else
39+
RUSTC="rustc"
40+
fi
41+
3442
# Find out where the pretty printer Python module is
35-
RUSTC_SYSROOT=`rustc --print=sysroot`
43+
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
3644
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
3745

3846
# Set the environment variable `RUST_GDB` to overwrite the call to a

0 commit comments

Comments
 (0)