Have rust-lldb look for the rust-enabled lldb
We're shipping a rust-enabled lldb, but the "lldb" executable is not installed into the "bin" directory by rustup. See the discussion in https://github.com/rust-lang-nursery/rustup.rs/pull/1492 for background on this decision. There, we agreed to have rust-lldb prefer the rust-enabled lldb if it is installed. This patch changes dist.rs to put lldb into rustlib, following what was done for the other LLVM tools in #53955, and then fixes rust-lldb to prefer that lldb, if it exists. See issue #48168
This commit is contained in:
parent
7366752a61
commit
8aae6ca44a
@ -2056,7 +2056,8 @@ impl Step for Lldb {
|
|||||||
drop(fs::remove_dir_all(&image));
|
drop(fs::remove_dir_all(&image));
|
||||||
|
|
||||||
// Prepare the image directory
|
// Prepare the image directory
|
||||||
let dst = image.join("bin");
|
let root = image.join("lib/rustlib").join(&*target);
|
||||||
|
let dst = root.join("bin");
|
||||||
t!(fs::create_dir_all(&dst));
|
t!(fs::create_dir_all(&dst));
|
||||||
for program in &["lldb", "lldb-argdumper", "lldb-mi", "lldb-server"] {
|
for program in &["lldb", "lldb-argdumper", "lldb-mi", "lldb-server"] {
|
||||||
let exe = bindir.join(exe(program, &target));
|
let exe = bindir.join(exe(program, &target));
|
||||||
@ -2065,7 +2066,7 @@ impl Step for Lldb {
|
|||||||
|
|
||||||
// The libraries.
|
// The libraries.
|
||||||
let libdir = builder.llvm_out(target).join("lib");
|
let libdir = builder.llvm_out(target).join("lib");
|
||||||
let dst = image.join("lib");
|
let dst = root.join("lib");
|
||||||
t!(fs::create_dir_all(&dst));
|
t!(fs::create_dir_all(&dst));
|
||||||
for entry in t!(fs::read_dir(&libdir)) {
|
for entry in t!(fs::read_dir(&libdir)) {
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
@ -2093,7 +2094,7 @@ impl Step for Lldb {
|
|||||||
let entry = t!(entry);
|
let entry = t!(entry);
|
||||||
if let Ok(name) = entry.file_name().into_string() {
|
if let Ok(name) = entry.file_name().into_string() {
|
||||||
if name.starts_with("python") {
|
if name.starts_with("python") {
|
||||||
let dst = image.join(libdir_name)
|
let dst = root.join(libdir_name)
|
||||||
.join(entry.file_name());
|
.join(entry.file_name());
|
||||||
t!(fs::create_dir_all(&dst));
|
t!(fs::create_dir_all(&dst));
|
||||||
builder.cp_r(&entry.path(), &dst);
|
builder.cp_r(&entry.path(), &dst);
|
||||||
|
@ -12,7 +12,17 @@
|
|||||||
# Exit if anything fails
|
# Exit if anything fails
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
LLDB_VERSION=`lldb --version 2>/dev/null | head -1 | cut -d. -f1`
|
# Find out where to look for the pretty printer Python module
|
||||||
|
RUSTC_SYSROOT=`rustc --print sysroot`
|
||||||
|
|
||||||
|
# Find the host triple so we can find lldb in rustlib.
|
||||||
|
host=`rustc -vV | sed -n -e 's/^host: //p'`
|
||||||
|
|
||||||
|
lldb=lldb
|
||||||
|
if [ -f "$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb" ]; then
|
||||||
|
lldb="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
|
||||||
|
else
|
||||||
|
LLDB_VERSION=`"$lldb" --version 2>/dev/null | head -1 | cut -d. -f1`
|
||||||
|
|
||||||
if [ "$LLDB_VERSION" = "lldb-350" ]
|
if [ "$LLDB_VERSION" = "lldb-350" ]
|
||||||
then
|
then
|
||||||
@ -22,9 +32,7 @@ then
|
|||||||
display the contents of local variables!"
|
display the contents of local variables!"
|
||||||
echo "***"
|
echo "***"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
# Find out where to look for the pretty printer Python module
|
|
||||||
RUSTC_SYSROOT=`rustc --print sysroot`
|
|
||||||
|
|
||||||
# Prepare commands that will be loaded before any file on the command line has been loaded
|
# Prepare commands that will be loaded before any file on the command line has been loaded
|
||||||
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\""
|
script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\""
|
||||||
@ -32,7 +40,7 @@ category_definition="type summary add --no-value --python-function lldb_rust_for
|
|||||||
category_enable="type category enable Rust"
|
category_enable="type category enable Rust"
|
||||||
|
|
||||||
# Call LLDB with the commands added to the argument list
|
# Call LLDB with the commands added to the argument list
|
||||||
exec lldb --one-line-before-file="$script_import" \
|
exec "$lldb" --one-line-before-file="$script_import" \
|
||||||
--one-line-before-file="$category_definition" \
|
--one-line-before-file="$category_definition" \
|
||||||
--one-line-before-file="$category_enable" \
|
--one-line-before-file="$category_enable" \
|
||||||
"$@"
|
"$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user