Skip to content

Commit

Permalink
Auto merge of #61827 - golddranks:lldb_fix, r=nikomatsakis
Browse files Browse the repository at this point in the history
Fix rust-lldb wrapper scripts.

Currently the `rust-lldb` wrapper provided by Rust project is broken. The error messages it produces on launch are as follows:
```
warning: ignoring unknown option: --one-line-before-file=command script import "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py"
warning: ignoring unknown option: --one-line-before-file=type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
warning: ignoring unknown option: --one-line-before-file=type category enable Rust
(lldb) target create "target/debug/nagare"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/__init__.py", line 1481, in <module>
    class SBAddress(object):
  File "/Users/kon/.rustup/toolchains/nightly-2019-05-02-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/__init__.py", line 1647, in SBAddress
    __swig_getmethods__["module"] = GetModule
NameError: name '__swig_getmethods__' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
...etc.
```

The errors stem from two regressions: one caused by an LLVM upgrade and one caused by unintended upgrade to SWIG 4.0 (SWIG is a wrapper generator that is used to generate Python bindings for LLVM and LLDB.)

(Edit: found the exact dates) The SWIG breakage happened because of a Homebrew version upgrade on `nightly-2019-05-01-x86_64-apple-darwin` and the LLVM breakage happened on `nightly-2019-01-27-x86_64-apple-darwin` (likely to have been caused by #57675 ).

The fix is to update the LLVM parameter syntax and to "downgrade" to SWIG 3.0.x. SWIG 3.0.x is not going to be supported by Homebrew forever, but should be good for now, until LLDB upgrades to  support SWIG 4.0.0. Here's some more info about Homebrew support: Homebrew/homebrew-core#39929 & Homebrew/homebrew-core#40882 I'm going to send a bug & fix to LLDB about SWIG 4.0.0 to get the situation fixed in the future.

It would be good to also backport this to beta, since it's such a small change, and will fix an obvious regression.
  • Loading branch information
bors committed Jun 20, 2019
2 parents f0c2bdf + 2d6e1df commit f693d33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .azure-pipelines/steps/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ steps:
set -e
brew update
brew install xz
brew install swig
brew install swig@3
brew link --force swig@3
displayName: Install build dependencies (OSX)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'), eq(variables['SCRIPT'],'./x.py dist'))

Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ install:
if [[ "$SCRIPT" == "./x.py dist" ]]; then
travis_retry brew update &&
travis_retry brew install xz &&
travis_retry brew install swig;
travis_retry brew install swig@3 &&
brew link --force swig@3;
fi &&
travis_retry curl -fo /usr/local/bin/sccache https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin &&
chmod +x /usr/local/bin/sccache &&
Expand Down
6 changes: 3 additions & 3 deletions src/etc/rust-lldb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ category_definition="type summary add --no-value --python-function lldb_rust_for
category_enable="type category enable Rust"

# Call LLDB with the commands added to the argument list
exec "$lldb" --one-line-before-file="$script_import" \
--one-line-before-file="$category_definition" \
--one-line-before-file="$category_enable" \
exec "$lldb" --one-line-before-file "$script_import" \
--one-line-before-file "$category_definition" \
--one-line-before-file "$category_enable" \
"$@"

0 comments on commit f693d33

Please sign in to comment.