]> git.lizzy.rs Git - rust.git/blob - src/etc/rust-gdb
Sync rust-lang/portable-simd@03f6fbb21e6050da2a05b3ce8f480c020b384916
[rust.git] / src / etc / rust-gdb
1 #!/bin/sh
2 # Exit if anything fails
3 set -e
4
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
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"
16
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" \
24   "$@"