File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 13
13
# Find out where the pretty printer Python module is
14
14
RUSTC_SYSROOT=" $( " $RUSTC " --print=sysroot) "
15
15
GDB_PYTHON_MODULE_DIRECTORY=" $RUSTC_SYSROOT /lib/rustlib/etc"
16
+ # Get the commit hash for path remapping
17
+ RUSTC_COMMIT_HASH=" $( " $RUSTC " -vV | sed -n ' s/commit-hash: \(\w*\)/\1/p' ) "
16
18
17
19
# Run GDB with the additional arguments that load the pretty printers
18
20
# Set the environment variable `RUST_GDB` to overwrite the call to a
@@ -21,4 +23,6 @@ RUST_GDB="${RUST_GDB:-gdb}"
21
23
PYTHONPATH=" $PYTHONPATH :$GDB_PYTHON_MODULE_DIRECTORY " exec ${RUST_GDB} \
22
24
--directory=" $GDB_PYTHON_MODULE_DIRECTORY " \
23
25
-iex " add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY " \
26
+ -iex " set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT /lib/rustlib/src/rust" \
24
27
" $@ "
28
+
Original file line number Diff line number Diff line change 42
42
# Find out where the pretty printer Python module is
43
43
RUSTC_SYSROOT=" $( " $RUSTC " --print=sysroot) "
44
44
GDB_PYTHON_MODULE_DIRECTORY=" $RUSTC_SYSROOT /lib/rustlib/etc"
45
+ # Get the commit hash for path remapping
46
+ RUSTC_COMMIT_HASH=" $( " $RUSTC " -vV | sed -n ' s/commit-hash: \(\w*\)/\1/p' ) "
45
47
46
48
# Set the environment variable `RUST_GDB` to overwrite the call to a
47
49
# different/specific command (defaults to `gdb`).
@@ -53,7 +55,9 @@ RUST_GDBGUI="${RUST_GDBGUI:-gdbgui}"
53
55
54
56
# These arguments get passed through to GDB and make it load the
55
57
# Rust pretty printers.
56
- GDB_ARGS=" --directory=\" $GDB_PYTHON_MODULE_DIRECTORY \" -iex \" add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY \" "
58
+ GDB_ARGS=" --directory=\" $GDB_PYTHON_MODULE_DIRECTORY \" " \
59
+ " -iex \" add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY \" " \
60
+ " -iex \" set substitute-path /rustc/$RUSTC_COMMIT_HASH $RUSTC_SYSROOT /lib/rustlib/src/rust\" "
57
61
58
62
# Finally we execute gdbgui.
59
63
PYTHONPATH=" $PYTHONPATH :$GDB_PYTHON_MODULE_DIRECTORY " \
You can’t perform that action at this time.
0 commit comments