Rollup merge of #109527 - lnicola:rust-gdb-substitute-path, r=cuviper
Set up standard library path substitution in rust-gdb and gdbgui Fixes #62945 --- Only lightly tested (in release mode, where the paths are a bit of a mess) because my `gdb` appears to crash with `internal-error: inside_main_func: Assertion 'block != nullptr' failed.` and I don't have `gdbgui`. Please review carefully my shell syntax. There's also `rust-lldb`, but I don't know the equivalent for it.
This commit is contained in:
commit
c617ddf4f3
@ -13,6 +13,8 @@ fi
|
|||||||
# Find out where the pretty printer Python module is
|
# 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"
|
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
|
||||||
|
# Get the commit hash for path remapping
|
||||||
|
RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \(\w*\)/\1/p')"
|
||||||
|
|
||||||
# Run GDB with the additional arguments that load the pretty printers
|
# Run GDB with the additional arguments that load the pretty printers
|
||||||
# Set the environment variable `RUST_GDB` to overwrite the call to a
|
# Set the environment variable `RUST_GDB` to overwrite the call to a
|
||||||
@ -21,4 +23,6 @@ RUST_GDB="${RUST_GDB:-gdb}"
|
|||||||
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
|
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \
|
||||||
--directory="$GDB_PYTHON_MODULE_DIRECTORY" \
|
--directory="$GDB_PYTHON_MODULE_DIRECTORY" \
|
||||||
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
|
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
|
||||||
|
-iex "set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
@ -42,6 +42,8 @@ fi
|
|||||||
# Find out where the pretty printer Python module is
|
# 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"
|
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
|
||||||
|
# Get the commit hash for path remapping
|
||||||
|
RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \(\w*\)/\1/p')"
|
||||||
|
|
||||||
# Set the environment variable `RUST_GDB` to overwrite the call to a
|
# Set the environment variable `RUST_GDB` to overwrite the call to a
|
||||||
# different/specific command (defaults to `gdb`).
|
# different/specific command (defaults to `gdb`).
|
||||||
@ -53,7 +55,9 @@ RUST_GDBGUI="${RUST_GDBGUI:-gdbgui}"
|
|||||||
|
|
||||||
# These arguments get passed through to GDB and make it load the
|
# These arguments get passed through to GDB and make it load the
|
||||||
# Rust pretty printers.
|
# Rust pretty printers.
|
||||||
GDB_ARGS="--directory=\"$GDB_PYTHON_MODULE_DIRECTORY\" -iex \"add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY\""
|
GDB_ARGS="--directory=\"$GDB_PYTHON_MODULE_DIRECTORY\"" \
|
||||||
|
"-iex \"add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY\"" \
|
||||||
|
"-iex \"set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT/lib/rustlib/src/rust\""
|
||||||
|
|
||||||
# Finally we execute gdbgui.
|
# Finally we execute gdbgui.
|
||||||
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" \
|
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" \
|
||||||
|
Loading…
Reference in New Issue
Block a user