2014-11-13 16:25:15 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Exit if anything fails
|
|
|
|
set -e
|
|
|
|
|
2018-09-05 19:05:46 +00:00
|
|
|
# Find the host triple so we can find lldb in rustlib.
|
2019-07-14 04:19:39 +00:00
|
|
|
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"
|
2018-09-05 19:05:46 +00:00
|
|
|
|
|
|
|
lldb=lldb
|
2019-07-14 04:19:39 +00:00
|
|
|
if [ -f "$RUST_LLDB" ]; then
|
|
|
|
lldb="$RUST_LLDB"
|
2018-09-05 19:05:46 +00:00
|
|
|
else
|
2019-07-14 04:19:39 +00:00
|
|
|
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)
|
2016-07-04 16:38:33 +00:00
|
|
|
|
2019-07-14 04:19:39 +00:00
|
|
|
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
|
2018-09-05 19:05:46 +00:00
|
|
|
fi
|
2016-07-04 16:38:33 +00:00
|
|
|
fi
|
|
|
|
|
2020-08-28 06:29:45 +00:00
|
|
|
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
|
|
|
|
commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands"
|
|
|
|
|
2018-08-18 21:46:52 +00:00
|
|
|
# Call LLDB with the commands added to the argument list
|
2020-08-28 06:29:45 +00:00
|
|
|
exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@"
|