Announcing LLDB for VSCode


#1

Hey rustaceans!

I’ve just published the first version of LLDB plugin for VSCode.
Those of you who are already using VSCode for Rust coding, may find it a useful addition to RustyCode. It works on Linux, OSX and Windows (if you manage to build LLDB there).

Let me know how it does for you!


#2

“Step over” does always “Step in” for me. This also happens with plain lldb, so it’s not a problem with the plugin, but maybe you know why this is the case? Maybe bad debug information?

Also, what’s the difference to this plugin?


#3

I think this is related to issues described in PR 33097. LLDB built from the current master branch does not have this problem. Hopefully it will not take too long for the fix to percolate into LLDB shipped with XCode.

Tightness of integration.
Mine uses LLDB’s native Python API, whereas the other plugin uses GDB-MI interface. There are some things in LLDB, particularly around variable inspection, that just aren’t exposed via GDB-MI. Also, LLDB’s implementation of GDB-MI seems to be buggy in places.
All in all, I think that mine provides a better user experience. But you are welcome to disagree :smile:.


#4

Hi, thanks for the plugin!

I got one question: can I use this plugin with rust-lldb?


#5

Not directly. Unfortunately, VSCode debug adapters cannot access user/workspace settings, so changing name of the debugger executable would require some editing of the plugin source.

You can insert the three relevant lines as initCommands in the launch configuration though.


#6

Oh wow, I thought rust-lldb is special build of lldb.

$ file `which rust-lldb`
/Users/pepyakin/.cargo/bin/rust-lldb: Mach-O 64-bit executable x86_64

I added initCommands

"initCommands": [
  "command script import \"/Users/pepyakin/.multirust/toolchains/nightly-2016-06-10-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py\"",
  "type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust",
  "type category enable Rust"
],

However, when lldb stop at breakpoint, command, like > print *self or “Step into” doesn’t do anything. If I press “Stop” all entered commands will be printed with result “Cancelled”

> print *self
cancelled

Also, locals in sidepanel doesn’t show up (there is just a eternal activity indicator), and if I wait enough, VSCode will terminate debugging session.


#7

Does rust-lldb itself work with that binary? What does lldb --version output?


#8

Just launched it again and it just worked. Both binaries report lldb-340.4.119.1


#9

Very cool plugin. Make sure you’ve got the ‘six’ python module installed or you may get a failure to launch without any details:

For me on a new Ubuntu 16.04 image:

    pip install six```

#10

Update: lldb 360.1.25 shipped with Xcode 8 beta has this bug fixed.


#11

Thank you for this extension. Great work!

For people who run into the same issue: printing/viewing variables didn’t work for me on OS X, despite setting initCommands. Updating to Xcode 8 beta solved the problem.


#12

Variables seem to work better with XCode 8 but stepping still jumps around like crazy. It seems that line numbers are somehow messed up.


#13

All the time or just in macros? Macro expansions are known to have bad line debug info.


#14

Will this be fixed in Rust?


#15

Looks like LLDB is finally usable on Windows (only *-windows-gnu toolchain for now), so y’all may want to give it a try. Get it here: http://llvm.org/builds.


#16

Thanks, those initCommands did the job for me!


#17

Does anyone else get this error immediately after launching or trying to attach?

error: module importing failed: No module named adapter
File “temp.py”, line 1, in error: module importing failed: No module named adapter

I’m on macOS 10.12.4, XCode 8.3.2, and using rust 1.19.0-nightly (f1140a331 2017-05-08)


#18

Do you have brew or macports python installed?


#19

I have brew installed.


#20

Can you please try launching lldb via this script:

  #!/bin/sh
  export PATH=/usr/bin:$PATH
  exec lldb "$@"