diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/etc/rust-lldb | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/etc/rust-lldb')
-rwxr-xr-x | src/etc/rust-lldb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb new file mode 100755 index 000000000..bce72f1ba --- /dev/null +++ b/src/etc/rust-lldb @@ -0,0 +1,37 @@ +#!/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=lldb +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" + +# Call LLDB with the commands added to the argument list +exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@" |