Skip to content

Commit

Permalink
Prefer sysroot from rustc in same directory as rust-gdb
Browse files Browse the repository at this point in the history
If there isn't a rustc in the same directory, then fall back to searching
the path.
  • Loading branch information
jsgf committed Apr 2, 2020
1 parent 0f72ce1 commit 7a824c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/etc/rust-gdb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/etc/rust-gdbgui
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,16 @@ icon to start your program running.
exit 0
fi

# 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"

# Set the environment variable `RUST_GDB` to overwrite the call to a
Expand Down

0 comments on commit 7a824c8

Please sign in to comment.