Thanks to visit codestin.com
Credit goes to chromium.googlesource.com

blob: 9abed30ea6f736f420eb71fab86e18f375ebb609 [file] [log] [blame]
Michael Woerister91a0e182014-12-03 22:48:181#!/bin/sh
Michael Woerister91a0e182014-12-03 22:48:182# Exit if anything fails
3set -e
4
Jeremy Fitzhardinge7a824c82020-04-02 18:49:335# Prefer rustc in the same directory as this script
6DIR="$(dirname "$0")"
7if [ -x "$DIR/rustc" ]; then
8 RUSTC="$DIR/rustc"
9else
10 RUSTC="rustc"
11fi
12
Michael Woerister91a0e182014-12-03 22:48:1813# Find out where the pretty printer Python module is
Jeremy Fitzhardinge7a824c82020-04-02 18:49:3314RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
Michael Woerister91a0e182014-12-03 22:48:1815GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
Laurențiu Nicola8dd0ec62023-03-23 11:01:0116# Get the commit hash for path remapping
Alan Somersc6b1f312023-04-15 02:07:1317RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
Michael Woerister91a0e182014-12-03 22:48:1818
19# Run GDB with the additional arguments that load the pretty printers
Nicolas Bigaouette61b7ebe2017-04-20 15:20:3320# Set the environment variable `RUST_GDB` to overwrite the call to a
Nicolas Bigaouette82ed7832017-04-18 18:00:0821# different/specific command (defaults to `gdb`).
Nicolas Bigaouette61b7ebe2017-04-20 15:20:3322RUST_GDB="${RUST_GDB:-gdb}"
ftilded6426e8a2018-08-18 21:48:2623PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
Benjamin Lamowskif6df1742018-05-22 00:58:1924 --directory="$GDB_PYTHON_MODULE_DIRECTORY" \
Michael Woerister91a0e182014-12-03 22:48:1825 -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
Laurențiu Nicola8dd0ec62023-03-23 11:01:0126 -iex "set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust" \
Michael Woerister91a0e182014-12-03 22:48:1827 "$@"
Alan Somers2f45d192023-04-14 20:47:0528