3 # Exit if anything fails
6 # Find the host triple so we can find lldb in rustlib.
7 host=$(rustc -vV | sed -n -e 's/^host: //p')
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"
14 if [ -f "$RUST_LLDB" ]; then
17 if ! command -v "$lldb" > /dev/null; then
18 echo "$lldb not found! Please install it." >&2
21 LLDB_VERSION=$("$lldb" --version | cut -d ' ' -f3)
23 if [ "$LLDB_VERSION" = "3.5.0" ]; then
26 WARNING: This version of LLDB has known issues with Rust and cannot display the contents of local variables!
33 script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
34 commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands"
36 # Call LLDB with the commands added to the argument list
37 exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@"