-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrust-stylusdb.sh
More file actions
executable file
·42 lines (34 loc) · 1.22 KB
/
rust-stylusdb.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Exit if anything fails
set -e
# Find the host triple so we can find lldb in rustlib.
host=$(rustc -vV | sed -n -e 's/^host: //p')
# Find out where to look for the pretty printer Python module
RUSTC_SYSROOT=$(rustc --print sysroot)
RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
lldb=stylusdb
if [ -f "$RUST_LLDB" ]; then
lldb="$RUST_LLDB"
else
if ! command -v "$lldb" > /dev/null; then
echo "$lldb not found! Please install it." >&2
exit 1
else
LLDB_VERSION=$("$lldb" --version | cut -d ' ' -f3)
if [ "$LLDB_VERSION" = "3.5.0" ]; then
cat << EOF >&2
***
WARNING: This version of LLDB has known issues with Rust and cannot display the contents of local variables!
***
EOF
fi
fi
fi
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands"
# Create a temporary file with all commands including format-enable
temp_commands=$(mktemp)
cat "$commands_file" > "$temp_commands"
echo "format-enable" >> "$temp_commands"
# Call LLDB with the commands added to the argument list
exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$temp_commands" "$@"