1#!/bin/sh 2 3# Exit if anything fails 4set -e 5 6# Find the host triple so we can find lldb in rustlib. 7host=$(rustc -vV | sed -n -e 's/^host: //p') 8 9# Find out where to look for the pretty printer Python module 10RUSTC_SYSROOT=$(rustc --print sysroot) 11RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" 12 13lldb=lldb 14if [ -f "$RUST_LLDB" ]; then 15 lldb="$RUST_LLDB" 16else 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) 22 23 if [ "$LLDB_VERSION" = "3.5.0" ]; then 24 cat << EOF >&2 25*** 26WARNING: This version of LLDB has known issues with Rust and cannot display the contents of local variables! 27*** 28EOF 29 fi 30 fi 31fi 32 33script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\"" 34commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands" 35 36# Call LLDB with the commands added to the argument list 37exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@" 38