diff options
| author | Tom Tromey <tom@tromey.com> | 2018-09-05 13:05:46 -0600 |
|---|---|---|
| committer | Tom Tromey <tom@tromey.com> | 2018-09-07 09:13:47 -0600 |
| commit | 8aae6ca44a1bea64e2be3f2ce5a4581bb65d43ef (patch) | |
| tree | b93cad0355aa897267c1abbe30589986c0777826 /src/etc | |
| parent | 7366752a6164dd8e004f32c1a40f0e04a61bcbb2 (diff) | |
| download | rust-8aae6ca44a1bea64e2be3f2ce5a4581bb65d43ef.tar.gz rust-8aae6ca44a1bea64e2be3f2ce5a4581bb65d43ef.zip | |
Have rust-lldb look for the rust-enabled lldb
We're shipping a rust-enabled lldb, but the "lldb" executable is not installed into the "bin" directory by rustup. See the discussion in https://github.com/rust-lang-nursery/rustup.rs/pull/1492 for background on this decision. There, we agreed to have rust-lldb prefer the rust-enabled lldb if it is installed. This patch changes dist.rs to put lldb into rustlib, following what was done for the other LLVM tools in #53955, and then fixes rust-lldb to prefer that lldb, if it exists. See issue #48168
Diffstat (limited to 'src/etc')
| -rwxr-xr-x | src/etc/rust-lldb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb index 6a2849b5548..6ed8210349e 100755 --- a/src/etc/rust-lldb +++ b/src/etc/rust-lldb @@ -12,27 +12,35 @@ # Exit if anything fails set -e -LLDB_VERSION=`lldb --version 2>/dev/null | head -1 | cut -d. -f1` +# Find out where to look for the pretty printer Python module +RUSTC_SYSROOT=`rustc --print sysroot` + +# Find the host triple so we can find lldb in rustlib. +host=`rustc -vV | sed -n -e 's/^host: //p'` + +lldb=lldb +if [ -f "$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" ]; then + lldb="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" +else + LLDB_VERSION=`"$lldb" --version 2>/dev/null | head -1 | cut -d. -f1` -if [ "$LLDB_VERSION" = "lldb-350" ] -then - echo "***" + if [ "$LLDB_VERSION" = "lldb-350" ] + then + echo "***" echo \ "WARNING: This version of LLDB has known issues with Rust and cannot \ display the contents of local variables!" - echo "***" + echo "***" + fi fi -# Find out where to look for the pretty printer Python module -RUSTC_SYSROOT=`rustc --print sysroot` - # Prepare commands that will be loaded before any file on the command line has been loaded script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\"" category_definition="type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust" category_enable="type category enable Rust" # Call LLDB with the commands added to the argument list -exec lldb --one-line-before-file="$script_import" \ +exec "$lldb" --one-line-before-file="$script_import" \ --one-line-before-file="$category_definition" \ --one-line-before-file="$category_enable" \ "$@" |
