]> git.lizzy.rs Git - rust.git/blob - src/etc/rust-lldb
Rollup merge of #61146 - czipperz:SliceConcatExt-connect-default-to-join, r=sfackler
[rust.git] / src / etc / rust-lldb
1 #!/bin/sh
2
3 # Exit if anything fails
4 set -e
5
6 # Find out where to look for the pretty printer Python module
7 RUSTC_SYSROOT=`rustc --print sysroot`
8
9 # Find the host triple so we can find lldb in rustlib.
10 host=`rustc -vV | sed -n -e 's/^host: //p'`
11
12 lldb=lldb
13 if [ -f "$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" ]; then
14     lldb="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
15 else
16     LLDB_VERSION=`"$lldb" --version 2>/dev/null | head -1 | cut -d. -f1`
17
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 "***"
25     fi
26 fi
27
28 # Prepare commands that will be loaded before any file on the command line has been loaded
29 script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\""
30 category_definition="type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust"
31 category_enable="type category enable Rust"
32
33 # Call LLDB with the commands added to the argument list
34 exec "$lldb" --one-line-before-file "$script_import" \
35     --one-line-before-file "$category_definition" \
36     --one-line-before-file "$category_enable" \
37     "$@"