Skip to content

Commit 21d5b8b

Browse files
committed
Auto merge of #62671 - lzutao:tidy-lldb, r=alexcrichton
Check for lldb existences
2 parents 2c3b05d + d649ff3 commit 21d5b8b

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/etc/rust-lldb

+19-14
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,30 @@
33
# Exit if anything fails
44
set -e
55

6-
# Find out where to look for the pretty printer Python module
7-
RUSTC_SYSROOT=`rustc --print sysroot`
8-
96
# Find the host triple so we can find lldb in rustlib.
10-
host=`rustc -vV | sed -n -e 's/^host: //p'`
7+
host=$(rustc -vV | sed -n -e 's/^host: //p')
8+
9+
# Find out where to look for the pretty printer Python module
10+
RUSTC_SYSROOT=$(rustc --print sysroot)
11+
RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
1112

1213
lldb=lldb
13-
if [ -f "$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" ]; then
14-
lldb="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
14+
if [ -f "$RUST_LLDB" ]; then
15+
lldb="$RUST_LLDB"
1516
else
16-
LLDB_VERSION=`"$lldb" --version 2>/dev/null | head -1 | cut -d. -f1`
17+
if ! command -v "$lldb" > /dev/null; then
18+
echo "$lldb not found! Please install it." >&2
19+
exit 1
20+
else
21+
LLDB_VERSION=$("$lldb" --version | cut -d ' ' -f3)
1722

18-
if [ "$LLDB_VERSION" = "lldb-350" ]
19-
then
20-
echo "***"
21-
echo \
22-
"WARNING: This version of LLDB has known issues with Rust and cannot \
23-
display the contents of local variables!"
24-
echo "***"
23+
if [ "$LLDB_VERSION" = "3.5.0" ]; then
24+
cat << EOF >&2
25+
***
26+
WARNING: This version of LLDB has known issues with Rust and cannot display the contents of local variables!
27+
***
28+
EOF
29+
fi
2530
fi
2631
fi
2732

0 commit comments

Comments
 (0)