New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement debugger #535

Closed
matklad opened this Issue Jul 18, 2016 · 105 comments

Comments

Projects
None yet
@matklad
Member

matklad commented Jul 18, 2016

The work has started: https://github.com/intellij-rust/intellij-rust/tree/fc2cfb8e0fc76984495a34ae6a83cbb37188c699/debugger

State of the art

The debugger is officially available in CLion since 2018.1. Note, CLion doesn't support debugging with msvc toolchains, so if you are using Windows, you need:

  • install gnu rust toolchain (rustup install stable-gnu)
  • setup gnu (Cygwin or MinGW) toolchains in CLion (Preferences > Build, Execution, Deployment > Toolchains).

To debug you just need to:

  • Run debug command via gutter icon
    2018-05-28 11 46 26
  • Or create Cargo Command run configurtion

screen shot 2018-05-28 at 11 50 04

and run debugging via debug action

2018-05-28 11 52 16

Old content

Old content

If you use CLion and the nightly Cargo, you should be able to Debug Cargo configuration:

https://zippy.gfycat.com/AcidicMediocreCoati.webm

A major missing piece is that we don't pass command line arguments to the debuggee yet (this requires some work on the Cargo side of things first).

Old content 2

Currently for technical reasons (commit message) debugger is implemented as a separate plugin.

The current build can be download from TeamCity: Download. It may work with CLion 2016.3.2 and intellij-rust 0.1.0.1611.

Note that this is super unstable, debugger can invoke any kind of undefined behavior, including, but not limited to, summoning of nasal daemons. Most importantly, rust debugger may (though in theory it should not) break C++ debugging.

Nonetheless, step into and local variables view more or less work :)

debugger

As you can see on the screenshot, at the moment you unfortunately have to create a separate Cargo debug run configuration type (as opposed to the usual Run cargo command). Also, you only can debug binaries now :(

@matklad matklad referenced this issue Jul 18, 2016

Closed

Roadmap #424

@laktak

This comment has been minimized.

Show comment
Hide comment
@laktak

laktak Jul 18, 2016

Getting a good debugger for Rust would be a great help, especially as the current options are rather limited.

laktak commented Jul 18, 2016

Getting a good debugger for Rust would be a great help, especially as the current options are rather limited.

@mfarrugi

This comment has been minimized.

Show comment
Hide comment
@mfarrugi

mfarrugi Jul 18, 2016

Contributor

How would the rust debugger be implemented? Is the CLion C/++ debugger more than a wrapper of GDB?

Contributor

mfarrugi commented Jul 18, 2016

How would the rust debugger be implemented? Is the CLion C/++ debugger more than a wrapper of GDB?

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Jul 18, 2016

Member

How would the rust debugger be implemented?

We don't know yet, but the most straightforward way seems to be to reuse CLion infrastructure for LLDB/GDB.

Member

matklad commented Jul 18, 2016

How would the rust debugger be implemented?

We don't know yet, but the most straightforward way seems to be to reuse CLion infrastructure for LLDB/GDB.

@laktak

This comment has been minimized.

Show comment
Hide comment
@laktak

laktak Jul 18, 2016

I'm currently using Sublime with SublimeGDB. While it's nice it doesn't always work (crashes, doesn't keep breakpoints, etc.). So I have to fight the debugger as well...

I don't know CLion but whatever solution you come up with, please make sure it's really stable.

laktak commented Jul 18, 2016

I'm currently using Sublime with SublimeGDB. While it's nice it doesn't always work (crashes, doesn't keep breakpoints, etc.). So I have to fight the debugger as well...

I don't know CLion but whatever solution you come up with, please make sure it's really stable.

@sherry-ummen

This comment has been minimized.

Show comment
Hide comment
@sherry-ummen

sherry-ummen Aug 3, 2016

Sorry a newbie here. How do people debug rust code then? Or they don't ?

sherry-ummen commented Aug 3, 2016

Sorry a newbie here. How do people debug rust code then? Or they don't ?

@HybridEidolon

This comment has been minimized.

Show comment
Hide comment
@HybridEidolon

HybridEidolon Aug 3, 2016

Contributor

You can use gdb or lldb directly. Recent versions of gdb support rust directly.

Contributor

HybridEidolon commented Aug 3, 2016

You can use gdb or lldb directly. Recent versions of gdb support rust directly.

@sherry-ummen

This comment has been minimized.

Show comment
Hide comment
@sherry-ummen

sherry-ummen Aug 3, 2016

Thanks. Do you have an example on how to do it? And can it be used with IntelliJ rust?

sherry-ummen commented Aug 3, 2016

Thanks. Do you have an example on how to do it? And can it be used with IntelliJ rust?

@laktak

This comment has been minimized.

Show comment
Hide comment
@laktak

laktak Aug 3, 2016

@sherry-ummen if you are using sublime you can debug in your editor with SublimeGDB. It's not perfect but the best option at the moment.

laktak commented Aug 3, 2016

@sherry-ummen if you are using sublime you can debug in your editor with SublimeGDB. It's not perfect but the best option at the moment.

@johnthagen

This comment has been minimized.

Show comment
Hide comment
@johnthagen

johnthagen Aug 24, 2016

Contributor

Just FYI, RustDT, an Eclipse based Rust IDE, appears to wrap GDB. Might at least be a useful reference.

Also, it's been linked before but just want to add a reference to the pretty print version of gdb/lldb :

In fact, every Rust installation comes with one or both of rust-gdb and rust-lldb (depending on platform support). These are wrappers over gdb and lldb with Rust pretty-printing enabled.

Edit: Another source of inspiration/reference, a browser based debugger: https://github.com/oli-obk/priroda

Contributor

johnthagen commented Aug 24, 2016

Just FYI, RustDT, an Eclipse based Rust IDE, appears to wrap GDB. Might at least be a useful reference.

Also, it's been linked before but just want to add a reference to the pretty print version of gdb/lldb :

In fact, every Rust installation comes with one or both of rust-gdb and rust-lldb (depending on platform support). These are wrappers over gdb and lldb with Rust pretty-printing enabled.

Edit: Another source of inspiration/reference, a browser based debugger: https://github.com/oli-obk/priroda

@mkaput mkaput referenced this issue Dec 5, 2016

Closed

Add debugger GUI #36

@sherry-ummen

This comment has been minimized.

Show comment
Hide comment

sherry-ummen commented Dec 8, 2016

@hgallagher1993

This comment has been minimized.

Show comment
Hide comment
@hgallagher1993

hgallagher1993 Dec 29, 2016

For anyone thinking of using sherry-ummen's link, RustyCode appears to be abandoned there's been no updates in many months. This is a fork that fixes some bugs though. I haven't used the original in months and haven't even downloaded the fork so I don't how either works at the minute.

hgallagher1993 commented Dec 29, 2016

For anyone thinking of using sherry-ummen's link, RustyCode appears to be abandoned there's been no updates in many months. This is a fork that fixes some bugs though. I haven't used the original in months and haven't even downloaded the fork so I don't how either works at the minute.

@chriskrycho

This comment has been minimized.

Show comment
Hide comment
@chriskrycho

chriskrycho Dec 29, 2016

Contributor

I can confirm the fork works fairly well, and is (at least presently) fairly actively maintained. (I understand the limitations facing everyone involved here—I look forward to when IntelliJ Rust gets debugger support, but it's also a ton of work.)

Contributor

chriskrycho commented Dec 29, 2016

I can confirm the fork works fairly well, and is (at least presently) fairly actively maintained. (I understand the limitations facing everyone involved here—I look forward to when IntelliJ Rust gets debugger support, but it's also a ton of work.)

@danielbodart

This comment has been minimized.

Show comment
Hide comment
@danielbodart

danielbodart Jan 17, 2017

I managed to get partial debug working using Remote GDB debug support in CLion and gdbserver. I can then see the stack traces but can't see the variables for what ever reason. Anyone got any suggestions?

danielbodart commented Jan 17, 2017

I managed to get partial debug working using Remote GDB debug support in CLion and gdbserver. I can then see the stack traces but can't see the variables for what ever reason. Anyone got any suggestions?

@Nimamoh

This comment has been minimized.

Show comment
Hide comment
@Nimamoh

Nimamoh Jan 20, 2017

Would love some debug capabilities for intellij-rust.

Nimamoh commented Jan 20, 2017

Would love some debug capabilities for intellij-rust.

@windoze

This comment has been minimized.

Show comment
Hide comment
@windoze

windoze Jan 20, 2017

I guess we can reuse CLion debugger module, or migrate this plugin to CLion.
I can see many plugins are available on both IDEA and CLion, so I guess these 2 products should have shared a large part of code base.

windoze commented Jan 20, 2017

I guess we can reuse CLion debugger module, or migrate this plugin to CLion.
I can see many plugins are available on both IDEA and CLion, so I guess these 2 products should have shared a large part of code base.

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Jan 20, 2017

Member

@windoze the plugin totally works with CLion, you don't need to migrate anything.

I'm planing to start the work on the debugger soon :)

Member

matklad commented Jan 20, 2017

@windoze the plugin totally works with CLion, you don't need to migrate anything.

I'm planing to start the work on the debugger soon :)

@csotiriou

This comment has been minimized.

Show comment
Hide comment
@csotiriou

csotiriou Feb 4, 2017

@matklad In CLion 2016.3.2 I installed the plugin, but the "New Project" dialog does not present the "Rust" option as it does in IntelliJ IDEA. The run config allow me to select the "Cargo Command", however.

csotiriou commented Feb 4, 2017

@matklad In CLion 2016.3.2 I installed the plugin, but the "New Project" dialog does not present the "Rust" option as it does in IntelliJ IDEA. The run config allow me to select the "Cargo Command", however.

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Feb 5, 2017

Member

@csotiriou yep, the project management in CLion is not very convenient, because at the moment CLion does not support non-CMake project, and Rust obviously does not use CMake. The option is to use "import project from source" action.

Member

matklad commented Feb 5, 2017

@csotiriou yep, the project management in CLion is not very convenient, because at the moment CLion does not support non-CMake project, and Rust obviously does not use CMake. The option is to use "import project from source" action.

@csotiriou

This comment has been minimized.

Show comment
Hide comment
@csotiriou

csotiriou Feb 5, 2017

@matklad Thank you for this answer.

I eagerly await for the debugger implementation. It's the only thing that is not straightforward to use, even when using the command line.

Thank you for this plugin.

csotiriou commented Feb 5, 2017

@matklad Thank you for this answer.

I eagerly await for the debugger implementation. It's the only thing that is not straightforward to use, even when using the command line.

Thank you for this plugin.

@danielbodart

This comment has been minimized.

Show comment
Hide comment
@danielbodart

danielbodart Feb 5, 2017

Has anyone managed to get variables to show while debugging in CLion?

danielbodart commented Feb 5, 2017

Has anyone managed to get variables to show while debugging in CLion?

matklad referenced this issue Feb 8, 2017

DBG: first scratches
The hardest thing about debugger is how to actually get to the infrastructure
from CLion. There isn't a good way to do this yet, so currently debugger is
segregated into completely separate plugin in `/debugger`. It is not build
during the usual CI, because building is tricky an works only on Linux:

```
cd debugger
./download_deps.sh
../gradlew :runIdea
```

Nevertheless, you can install this plugin in CLion and get step into and local
variables working. Needless to say, this is **very** unstable yet, so installing
debugger in theory can harm your C++ debugging experience.
@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Feb 8, 2017

Member

Has anyone managed to get variables to show while debugging in CLion?

I did :) See the top comment for the current status: #535 (comment)

Member

matklad commented Feb 8, 2017

Has anyone managed to get variables to show while debugging in CLion?

I did :) See the top comment for the current status: #535 (comment)

@johnthagen

This comment has been minimized.

Show comment
Hide comment
@johnthagen

johnthagen Feb 9, 2017

Contributor

@matklad I'm curious how the final Rust debugger will interact, if at all, with the need for a CLion license. Will it be possible to debug Rust code on PyCharm Community, IntelliJ Community, or Android Studio using just the intellij-rust plugin?

I'd completely understand if JetBrains wanted to require that this part of CLion be licensed, since it pays good developers to work on CLion and needs to raise revenue.

Contributor

johnthagen commented Feb 9, 2017

@matklad I'm curious how the final Rust debugger will interact, if at all, with the need for a CLion license. Will it be possible to debug Rust code on PyCharm Community, IntelliJ Community, or Android Studio using just the intellij-rust plugin?

I'd completely understand if JetBrains wanted to require that this part of CLion be licensed, since it pays good developers to work on CLion and needs to raise revenue.

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Feb 9, 2017

Member

@johnthagen this is something we have not figured out yet, both at the technical and the licensing side of things.

It is certain that for the nearest future the debugger will be available in CLion, AppCode and maaaybe in RubyMine just because only these IDEs include com.intellij.modules.cidr.debugger module which we use. This is of course a shame, because it leaves out IDEA, PyCharm and other IDEs, and because Rust experience in CLion is not the best due to the interaction with CMake infrastructure. But of course this is just the beginning and we intend to fix these shortcomings :)

Member

matklad commented Feb 9, 2017

@johnthagen this is something we have not figured out yet, both at the technical and the licensing side of things.

It is certain that for the nearest future the debugger will be available in CLion, AppCode and maaaybe in RubyMine just because only these IDEs include com.intellij.modules.cidr.debugger module which we use. This is of course a shame, because it leaves out IDEA, PyCharm and other IDEs, and because Rust experience in CLion is not the best due to the interaction with CMake infrastructure. But of course this is just the beginning and we intend to fix these shortcomings :)

@lilianmoraru

This comment has been minimized.

Show comment
Hide comment
@lilianmoraru

lilianmoraru Mar 11, 2017

@hgallagher1993 The VS Code fork seems to be active, it even added support for RLS and works well(personally, I don't see much of a difference between the completion that Intellij-Rust and VS Code + RLS can give - for example, both can't help with variables passed through combinators like map and and_then).

As for RustDT, I can attest that the debugger works well(I tested it a while back).
Although, consider GDB 7.12 because it has better Rust support.

@matklad I installed the plugin but I cannot find the Cargo debug option, nor do I find the crust binary in the Clion directory.

lilianmoraru commented Mar 11, 2017

@hgallagher1993 The VS Code fork seems to be active, it even added support for RLS and works well(personally, I don't see much of a difference between the completion that Intellij-Rust and VS Code + RLS can give - for example, both can't help with variables passed through combinators like map and and_then).

As for RustDT, I can attest that the debugger works well(I tested it a while back).
Although, consider GDB 7.12 because it has better Rust support.

@matklad I installed the plugin but I cannot find the Cargo debug option, nor do I find the crust binary in the Clion directory.

@gilescope

This comment has been minimized.

Show comment
Hide comment
@gilescope

gilescope Mar 17, 2017

Seems like LLDB is being pushed by Apple over GDB. Hoping we can use CLion to support LLDB.

gilescope commented Mar 17, 2017

Seems like LLDB is being pushed by Apple over GDB. Hoping we can use CLion to support LLDB.

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Mar 27, 2017

Member

In the latest alpha, you don't need to install a separate debugger plugin or create a separate run configuration.

Launching cargo command with debug "just works" (except that it doesn't handle a lot of stuff, like passing arguments to the debugged binary :) ). This required nightly cargo though.

https://zippy.gfycat.com/AcidicMediocreCoati.webm

Member

matklad commented Mar 27, 2017

In the latest alpha, you don't need to install a separate debugger plugin or create a separate run configuration.

Launching cargo command with debug "just works" (except that it doesn't handle a lot of stuff, like passing arguments to the debugged binary :) ). This required nightly cargo though.

https://zippy.gfycat.com/AcidicMediocreCoati.webm

@henryborchers

This comment has been minimized.

Show comment
Hide comment
@henryborchers

henryborchers Mar 27, 2017

No luck on my OS X or Windows machine.

I first tried it on my Mac and the output message read,
Blocking waiting for file lock on build directory
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
I then got a popup stating "Debugging is not possible".

When I tried it on my Windows computer, I got the same exact output messages but with no error popup message and my program didn't even execute. Is this only working on Linux for now?

henryborchers commented Mar 27, 2017

No luck on my OS X or Windows machine.

I first tried it on my Mac and the output message read,
Blocking waiting for file lock on build directory
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
I then got a popup stating "Debugging is not possible".

When I tried it on my Windows computer, I got the same exact output messages but with no error popup message and my program didn't even execute. Is this only working on Linux for now?

@henryborchers

This comment has been minimized.

Show comment
Hide comment
@henryborchers

henryborchers Mar 27, 2017

D'oh. I forgot to set it to nightly Cargo. That's fixed but I'm now getting the message "NSUnbufferedIO is not set, output may be delayed" and I'm hitting no breakpoints.

henryborchers commented Mar 27, 2017

D'oh. I forgot to set it to nightly Cargo. That's fixed but I'm now getting the message "NSUnbufferedIO is not set, output may be delayed" and I'm hitting no breakpoints.

@lilianmoraru

This comment has been minimized.

Show comment
Hide comment
@lilianmoraru

lilianmoraru Mar 27, 2017

The "Blocking waiting" problem seems to pop very often(Linux here).

lilianmoraru commented Mar 27, 2017

The "Blocking waiting" problem seems to pop very often(Linux here).

@stephanbuys

This comment has been minimized.

Show comment
Hide comment
@stephanbuys

stephanbuys Mar 28, 2017

On MacOS Sierra I get, I've tried code-signing the bundled CLion (2016.3) gdb, but no luck yet.

macOS 10.12 has known issues running GDB due to System Integrity Protection.
Please switch the debugger to LLDB in Preferences.

Using the Toolchain setting to change to LLDB produces:

Error running Run helloworld: GDB executable not found

stephanbuys commented Mar 28, 2017

On MacOS Sierra I get, I've tried code-signing the bundled CLion (2016.3) gdb, but no luck yet.

macOS 10.12 has known issues running GDB due to System Integrity Protection.
Please switch the debugger to LLDB in Preferences.

Using the Toolchain setting to change to LLDB produces:

Error running Run helloworld: GDB executable not found
@lilianmoraru

This comment has been minimized.

Show comment
Hide comment
@lilianmoraru

lilianmoraru Apr 3, 2017

I get "Debugging is not possible", "Can't find a binary to debug" with the latest nightly.

lilianmoraru commented Apr 3, 2017

I get "Debugging is not possible", "Can't find a binary to debug" with the latest nightly.

@matklad

This comment has been minimized.

Show comment
Hide comment
@matklad

matklad Apr 3, 2017

Member

I get "Debugging is not possible", "Can't find a binary to debug" with the latest nightly.

This can mean either of three things:

  • you are using a stable cargo, which reports binaries only if they are not fresh (i.e. executing cargo clean before debugging should help)

  • run configuration produced zero binaries (that's unlikely if you are debugging cargo run or cargo test).

  • run configuration produced more than one binary (for example, cargo test excutes a ton of binaries at once). In this case, you need to pin the binary down by adding an explicit --bin or --lib argument.

Sorry that this works awful at the moment: there still lots of stuff to do until the basic "it works"! :)

Member

matklad commented Apr 3, 2017

I get "Debugging is not possible", "Can't find a binary to debug" with the latest nightly.

This can mean either of three things:

  • you are using a stable cargo, which reports binaries only if they are not fresh (i.e. executing cargo clean before debugging should help)

  • run configuration produced zero binaries (that's unlikely if you are debugging cargo run or cargo test).

  • run configuration produced more than one binary (for example, cargo test excutes a ton of binaries at once). In this case, you need to pin the binary down by adding an explicit --bin or --lib argument.

Sorry that this works awful at the moment: there still lots of stuff to do until the basic "it works"! :)

@lilianmoraru

This comment has been minimized.

Show comment
Hide comment
@lilianmoraru

lilianmoraru Apr 3, 2017

@matklad Sorry, it is a new machine and I forgot about the nightly thing(and you clearly mention it in the first post).
Thanks, setting rustup to nightly worked.

lilianmoraru commented Apr 3, 2017

@matklad Sorry, it is a new machine and I forgot about the nightly thing(and you clearly mention it in the first post).
Thanks, setting rustup to nightly worked.

@henryborchers

This comment has been minimized.

Show comment
Hide comment
@henryborchers

henryborchers Apr 3, 2017

Has anybody got this to hit breakpoints on either on OS X or Windows?

henryborchers commented Apr 3, 2017

Has anybody got this to hit breakpoints on either on OS X or Windows?

@makslevental

This comment has been minimized.

Show comment
Hide comment
@makslevental

makslevental Nov 27, 2017

@matklad

not sure what i'm doing wrong but i'm getting this error in CLion when trying to debug

image

and yet

image

here is my folder structure

image

makslevental commented Nov 27, 2017

@matklad

not sure what i'm doing wrong but i'm getting this error in CLion when trying to debug

image

and yet

image

here is my folder structure

image

@AurevoirXavier

This comment has been minimized.

Show comment
Hide comment
@AurevoirXavier

AurevoirXavier Dec 3, 2017

I have the same problem with @makslevental .
cargo --version
cargo 0.24.0-nightly (5bb478a51 2017-11-29)
Clion: 2017.2.3
System: High Sierra
Although there is only a main.rs file in src/, I specify run --package xxx --bin xxx .
But it still show me this error.

AurevoirXavier commented Dec 3, 2017

I have the same problem with @makslevental .
cargo --version
cargo 0.24.0-nightly (5bb478a51 2017-11-29)
Clion: 2017.2.3
System: High Sierra
Although there is only a main.rs file in src/, I specify run --package xxx --bin xxx .
But it still show me this error.

@UYEONG

This comment has been minimized.

Show comment
Hide comment
@UYEONG

UYEONG Dec 6, 2017

I have the same problem too.

2017-12-06 11 12 29


2017-12-06 11 13 28


2017-12-06 11 13 40

UYEONG commented Dec 6, 2017

I have the same problem too.

2017-12-06 11 12 29


2017-12-06 11 13 28


2017-12-06 11 13 40

@RobinRheem

This comment has been minimized.

Show comment
Hide comment
@RobinRheem

RobinRheem Dec 6, 2017

@UYEONG Why not help the project! We're counting on you 👍

RobinRheem commented Dec 6, 2017

@UYEONG Why not help the project! We're counting on you 👍

@chrisballinger

This comment has been minimized.

Show comment
Hide comment
@chrisballinger

chrisballinger Dec 6, 2017

@AurevoirXavier @UYEONG I have this same error message "Debugging is not possible. More than one binary produced". Here's a sample project: https://github.com/chrisballinger/sds011-rs

It seemed to work okay for a simple binary project but once I remade it as a lib+binary it stopped working. I can still use the CLion Run command, just not Debug.

  • cargo 0.23.0
  • clion 2017.2
  • rust plugin: 0.2.0.2081

chrisballinger commented Dec 6, 2017

@AurevoirXavier @UYEONG I have this same error message "Debugging is not possible. More than one binary produced". Here's a sample project: https://github.com/chrisballinger/sds011-rs

It seemed to work okay for a simple binary project but once I remade it as a lib+binary it stopped working. I can still use the CLion Run command, just not Debug.

  • cargo 0.23.0
  • clion 2017.2
  • rust plugin: 0.2.0.2081
@AurevoirXavier

This comment has been minimized.

Show comment
Hide comment
@AurevoirXavier

AurevoirXavier Dec 6, 2017

@chrisballinger Hello, what your simple binary project mean? Even just cargo new xxx --bin, I still get that error...

AurevoirXavier commented Dec 6, 2017

@chrisballinger Hello, what your simple binary project mean? Even just cargo new xxx --bin, I still get that error...

@chrisballinger

This comment has been minimized.

Show comment
Hide comment
@chrisballinger

chrisballinger Dec 6, 2017

@AurevoirXavier It was a cargo new xxx --bin at first and it worked, then I did cargo new xxx and moved the source into there and manually created a new main file in src/bin/sds011.rs. Perhaps there was a regression in one of the last two updates of the rust plugin?

chrisballinger commented Dec 6, 2017

@AurevoirXavier It was a cargo new xxx --bin at first and it worked, then I did cargo new xxx and moved the source into there and manually created a new main file in src/bin/sds011.rs. Perhaps there was a regression in one of the last two updates of the rust plugin?

@Pzixel

This comment has been minimized.

Show comment
Hide comment
@Pzixel

Pzixel Dec 9, 2017

So it's not possible to debug Rust project in interlij community edition? Because the only way to make it work is pay for CLion? Damn, it's quite not good for non-Java developers who's trying to learn some Rust, but it only has VSCode plugin that eventually stops to work and IntelliJ plugin that doesn't support debugging...

Pzixel commented Dec 9, 2017

So it's not possible to debug Rust project in interlij community edition? Because the only way to make it work is pay for CLion? Damn, it's quite not good for non-Java developers who's trying to learn some Rust, but it only has VSCode plugin that eventually stops to work and IntelliJ plugin that doesn't support debugging...

@AurevoirXavier

This comment has been minimized.

Show comment
Hide comment
@AurevoirXavier

AurevoirXavier Dec 23, 2017

@makslevental @UYEONG @chrisballinger Try Clion 3.1 EAP and set toolchains to LLDB. It works for me now!

AurevoirXavier commented Dec 23, 2017

@makslevental @UYEONG @chrisballinger Try Clion 3.1 EAP and set toolchains to LLDB. It works for me now!

@makslevental

This comment has been minimized.

Show comment
Hide comment
@makslevental

makslevental commented Dec 24, 2017

@AurevoirXavier thanks will do

@UYEONG

This comment has been minimized.

Show comment
Hide comment
@UYEONG

UYEONG Dec 26, 2017

@AurevoirXavier It's working for me too! thanks.

UYEONG commented Dec 26, 2017

@AurevoirXavier It's working for me too! thanks.

@U007D

This comment has been minimized.

Show comment
Hide comment
@U007D

U007D Dec 29, 2017

I'm getting this same error as well (I am on Ubuntu):

My project is not the simplest (multiple sub-crates using workspaces) with the main crate being lib + bin, but seeing as so many others are having this same issue, I'm hoping the project's layout is not the issue (at least it's not the only issue! :)).

  • I'm invoking a cargo test --lib --all --tests configuration by clicking the Debug button.
  • Toolchains | Debugger is set to 'Bundled LLDB✓Version 5.0.0`

CLion:

CLion 2017.3.1 Build #CL-173.4127.32, built on December 26, 2017
JRE: 1.8.0_152-release-1024-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.13.0-19-generic

Intellij-Rust: Version: 0.2.0.2083

cargo: cargo 0.25.0-nightly (930f9d949 2017-12-05)
rustc: rustc 1.24.0-nightly (5165ee9e2 2017-12-22)

I'm assuming I don't need to downgrade to CLion 3.1 EAP--please correct me if I'm wrong. Any ideas?

U007D commented Dec 29, 2017

I'm getting this same error as well (I am on Ubuntu):

My project is not the simplest (multiple sub-crates using workspaces) with the main crate being lib + bin, but seeing as so many others are having this same issue, I'm hoping the project's layout is not the issue (at least it's not the only issue! :)).

  • I'm invoking a cargo test --lib --all --tests configuration by clicking the Debug button.
  • Toolchains | Debugger is set to 'Bundled LLDB✓Version 5.0.0`

CLion:

CLion 2017.3.1 Build #CL-173.4127.32, built on December 26, 2017
JRE: 1.8.0_152-release-1024-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.13.0-19-generic

Intellij-Rust: Version: 0.2.0.2083

cargo: cargo 0.25.0-nightly (930f9d949 2017-12-05)
rustc: rustc 1.24.0-nightly (5165ee9e2 2017-12-22)

I'm assuming I don't need to downgrade to CLion 3.1 EAP--please correct me if I'm wrong. Any ideas?

@norru

This comment has been minimized.

Show comment
Hide comment
@norru

norru Jan 14, 2018

@pabloa's approach above has been working for me for many months now, with Linux/gcc toolchain at least. Variable inspections are very rough on the edges though.

I had to purchase a CLion licence and stick to an IDE which, well, let's say doesn't really match my workflow.

CLion + Rust plugin is getting there but a LONG way from mainstream-ready.

norru commented Jan 14, 2018

@pabloa's approach above has been working for me for many months now, with Linux/gcc toolchain at least. Variable inspections are very rough on the edges though.

I had to purchase a CLion licence and stick to an IDE which, well, let's say doesn't really match my workflow.

CLion + Rust plugin is getting there but a LONG way from mainstream-ready.

@perlindgren

This comment has been minimized.

Show comment
Hide comment
@perlindgren

perlindgren Jan 17, 2018

I'm experimenting with debugging Rust on embedded (Nucleo STM32F401re) using openocd and arm-none-eabi-gdb. I have it somewhat working. Here is the current status.

  1. The program is not loaded. (I had to use the pause and in the gdb console load it, the file has the right path, so it loads correctly)
  2. Breakpoints do not work, setting them in the IDE has no effect, stepping works and even (surprisingly) run to line. Setting breakpoints in the gdb console works fine.
  3. Variables are sometimes not shown. When they work, they are also updated in the source file. However mouse overs never work.
  4. Watching
    local (stack) as well as static (heap) variables always work.

I'm on the latest nightly xargo/cargo and nightly rustup channel. Arch linux with the CLion December 26 build. The bebug config:
/usr/bin/arm-none-eabi-gdb
(GNU gdb (GDB) 8.0.1)
'target remote' args: :3333
Symbol file:/home/pln/CLionProjects/rtfm-app/target/thumbv7em-none-eabihf/debug/examples/bare0
Sysroot:
(Empty)

To me it seems not so far from working and the Rust support in CLion looks promising (perhaps the best amongst RustDT (not supported), and vscode (RLS based)). So a couple of questions/remarks.
.gbinit will run before the 'target remote' from the plugin is launched. I tried to use that to load the binary, but I did not get that to work. It would be better with a 'classic' script option, allowing you to override the default connection procedure. Regarding the breakpoint integration, I have no clue what is wrong, as there seems to be some connection in between the IDE and gdb. (Rust uses C++ style namespaces/symbols, so that should not be a problem.) Another observation, if you try run to line, on a line not reachable, the debugger will not halt even if you press pause. I also tried using the OpenOCD Dowload & Run plugin, but it did not do the trick as being tailored to C/C++ (It could be a good stard for a dedicated Rust embedded debug plugin though...).

Any feedback appreciated.
/ Per
(The example project I based this experiment on is found at https://gitlab.henriktjader.com/pln/rtfm-app, under development for a course in embedded systems that I give for the first time using Rust.)
image

perlindgren commented Jan 17, 2018

I'm experimenting with debugging Rust on embedded (Nucleo STM32F401re) using openocd and arm-none-eabi-gdb. I have it somewhat working. Here is the current status.

  1. The program is not loaded. (I had to use the pause and in the gdb console load it, the file has the right path, so it loads correctly)
  2. Breakpoints do not work, setting them in the IDE has no effect, stepping works and even (surprisingly) run to line. Setting breakpoints in the gdb console works fine.
  3. Variables are sometimes not shown. When they work, they are also updated in the source file. However mouse overs never work.
  4. Watching
    local (stack) as well as static (heap) variables always work.

I'm on the latest nightly xargo/cargo and nightly rustup channel. Arch linux with the CLion December 26 build. The bebug config:
/usr/bin/arm-none-eabi-gdb
(GNU gdb (GDB) 8.0.1)
'target remote' args: :3333
Symbol file:/home/pln/CLionProjects/rtfm-app/target/thumbv7em-none-eabihf/debug/examples/bare0
Sysroot:
(Empty)

To me it seems not so far from working and the Rust support in CLion looks promising (perhaps the best amongst RustDT (not supported), and vscode (RLS based)). So a couple of questions/remarks.
.gbinit will run before the 'target remote' from the plugin is launched. I tried to use that to load the binary, but I did not get that to work. It would be better with a 'classic' script option, allowing you to override the default connection procedure. Regarding the breakpoint integration, I have no clue what is wrong, as there seems to be some connection in between the IDE and gdb. (Rust uses C++ style namespaces/symbols, so that should not be a problem.) Another observation, if you try run to line, on a line not reachable, the debugger will not halt even if you press pause. I also tried using the OpenOCD Dowload & Run plugin, but it did not do the trick as being tailored to C/C++ (It could be a good stard for a dedicated Rust embedded debug plugin though...).

Any feedback appreciated.
/ Per
(The example project I based this experiment on is found at https://gitlab.henriktjader.com/pln/rtfm-app, under development for a course in embedded systems that I give for the first time using Rust.)
image

@tdbgamer

This comment has been minimized.

Show comment
Hide comment
@tdbgamer

tdbgamer Feb 7, 2018

Is debugging support even planned for IntelliJ IDEA? If everyone has to buy CLion to use Rust, they're just going to switch to VSCode or other alternatives.

tdbgamer commented Feb 7, 2018

Is debugging support even planned for IntelliJ IDEA? If everyone has to buy CLion to use Rust, they're just going to switch to VSCode or other alternatives.

@gilescope

This comment has been minimized.

Show comment
Hide comment
@gilescope

gilescope Feb 7, 2018

gilescope commented Feb 7, 2018

@tdbgamer

This comment has been minimized.

Show comment
Hide comment
@tdbgamer

tdbgamer Feb 10, 2018

@gilescope
Don't get me wrong, I'm not whining or expecting them to do anything for me for free, just curious. But...

They don't make money from developers buying their IDEs. They make money when developers use their IDE and force their company to buy licenses. That's why there are so many community editions (also so they can let contributers maintain their code for them).

I would never pay $ 199.00/year for just debugging ($15-$20 plugin? I'd absolutely do it). Instead my team and I will use different editors and have no incentive to ask our boss to buy IntelliJ licenses... Just sayin. Same reason Microsoft gives everything away for free to college students. It's a pretty good business model.

tdbgamer commented Feb 10, 2018

@gilescope
Don't get me wrong, I'm not whining or expecting them to do anything for me for free, just curious. But...

They don't make money from developers buying their IDEs. They make money when developers use their IDE and force their company to buy licenses. That's why there are so many community editions (also so they can let contributers maintain their code for them).

I would never pay $ 199.00/year for just debugging ($15-$20 plugin? I'd absolutely do it). Instead my team and I will use different editors and have no incentive to ask our boss to buy IntelliJ licenses... Just sayin. Same reason Microsoft gives everything away for free to college students. It's a pretty good business model.

@Pzixel

This comment has been minimized.

Show comment
Hide comment
@Pzixel

Pzixel Feb 11, 2018

@tdbgamer I think plugin guys have never to deal with pricing 😄 And it seems that IntelliJ just doesn't provide infrastructure required to make debugger work. It's sad, but it's a mistake of IDE guys, not plugin ones.

Pzixel commented Feb 11, 2018

@tdbgamer I think plugin guys have never to deal with pricing 😄 And it seems that IntelliJ just doesn't provide infrastructure required to make debugger work. It's sad, but it's a mistake of IDE guys, not plugin ones.

@tdbgamer

This comment has been minimized.

Show comment
Hide comment
@tdbgamer

tdbgamer Feb 11, 2018

@Pzixel
Sure I understand that. But I didn't know if they planned on implementing a workaround in the plug-in or not. Probably the answer is no based on the responses. Hopefully the IDE people will see this then.

tdbgamer commented Feb 11, 2018

@Pzixel
Sure I understand that. But I didn't know if they planned on implementing a workaround in the plug-in or not. Probably the answer is no based on the responses. Hopefully the IDE people will see this then.

@sssilver

This comment has been minimized.

Show comment
Hide comment
@sssilver

sssilver Feb 12, 2018

Can we escalate this and get some sort of an official response?

sssilver commented Feb 12, 2018

Can we escalate this and get some sort of an official response?

@farodin91

This comment has been minimized.

Show comment
Hide comment
@farodin91

farodin91 Feb 12, 2018

Contributor

@Undin Is there any progress on the debugger side?

Contributor

farodin91 commented Feb 12, 2018

@Undin Is there any progress on the debugger side?

@Undin

This comment has been minimized.

Show comment
Hide comment
@Undin

Undin Feb 13, 2018

Member

Is debugging support even planned for IntelliJ IDEA?

Currently, the debugger is supported only in CLion because it has all the necessary infrastructure for working with LLDB, GDB and native code. We don't have immediate plans to move it to IDEA

Member

Undin commented Feb 13, 2018

Is debugging support even planned for IntelliJ IDEA?

Currently, the debugger is supported only in CLion because it has all the necessary infrastructure for working with LLDB, GDB and native code. We don't have immediate plans to move it to IDEA

@sanmai-NL

This comment has been minimized.

Show comment
Hide comment
@sanmai-NL

sanmai-NL Feb 13, 2018

@Undin: I think your response is clear and your statement is nothing new really, thanks. But could you or @matklad perhaps change the issue title to add ‘... in CLion’ to prevent any confusion?

sanmai-NL commented Feb 13, 2018

@Undin: I think your response is clear and your statement is nothing new really, thanks. But could you or @matklad perhaps change the issue title to add ‘... in CLion’ to prevent any confusion?

@Pzixel

This comment has been minimized.

Show comment
Hide comment
@Pzixel

Pzixel Feb 13, 2018

@sanmai-NL Clion already have implemented debugger? What do you mean then?

Pzixel commented Feb 13, 2018

@sanmai-NL Clion already have implemented debugger? What do you mean then?

@sanmai-NL

This comment has been minimized.

Show comment
Hide comment
@sanmai-NL

sanmai-NL Feb 13, 2018

Apparently that implementation isn’t completely done yet. #535 (comment) . If @matklad now thinks otherwise, the whole issue can be closed instead.

sanmai-NL commented Feb 13, 2018

Apparently that implementation isn’t completely done yet. #535 (comment) . If @matklad now thinks otherwise, the whole issue can be closed instead.

@vlad20012

This comment has been minimized.

Show comment
Hide comment
@vlad20012

vlad20012 Feb 13, 2018

Collaborator

@sanmai-NL Note that matklad leaved JetBrains and now don't work on IntelliJ-Rust

Collaborator

vlad20012 commented Feb 13, 2018

@sanmai-NL Note that matklad leaved JetBrains and now don't work on IntelliJ-Rust

@sanmai-NL

This comment has been minimized.

Show comment
Hide comment
@sanmai-NL

sanmai-NL Feb 13, 2018

@vlad20012: okay, mentioned him since he is the issue reporter. 🙂

sanmai-NL commented Feb 13, 2018

@vlad20012: okay, mentioned him since he is the issue reporter. 🙂

@Undin

This comment has been minimized.

Show comment
Hide comment
@Undin

Undin May 7, 2018

Member

I think it can be closed due to debugger works (in CLion) in general
If you have some problem with debugger, please, file separate issue

Member

Undin commented May 7, 2018

I think it can be closed due to debugger works (in CLion) in general
If you have some problem with debugger, please, file separate issue

@Undin Undin closed this May 7, 2018

@gilescope

This comment has been minimized.

Show comment
Hide comment
@gilescope

gilescope May 8, 2018

For anyone interested in improving rust debugging, there is work going on here: https://github.com/tromey/lldb/tree/rust

Hopefully this will lead to IDEs being able to provide a richer debugging experience once it is complete.

gilescope commented May 8, 2018

For anyone interested in improving rust debugging, there is work going on here: https://github.com/tromey/lldb/tree/rust

Hopefully this will lead to IDEs being able to provide a richer debugging experience once it is complete.

@gilescope

This comment has been minimized.

Show comment
Hide comment
@gilescope

gilescope May 15, 2018

Just wanted to say how much faster the debugger is now compared to a year ago. Really impressed. Just need String to appear as a &str and I will be at peace 👍

gilescope commented May 15, 2018

Just wanted to say how much faster the debugger is now compared to a year ago. Really impressed. Just need String to appear as a &str and I will be at peace 👍

@Undin

This comment has been minimized.

Show comment
Hide comment
@Undin

Undin May 15, 2018

Member

Just wanted to say how much faster the debugger is now compared to a year ago.

Thanks to CLion team!

Just need String to appear as a &str and I will be at peace

It's already implemented (see #2494) and will be landed in next release

Member

Undin commented May 15, 2018

Just wanted to say how much faster the debugger is now compared to a year ago.

Thanks to CLion team!

Just need String to appear as a &str and I will be at peace

It's already implemented (see #2494) and will be landed in next release

@gilescope

This comment has been minimized.

Show comment
Hide comment
@gilescope

gilescope May 17, 2018

gilescope commented May 17, 2018

@andrewdavidmackenzie

This comment has been minimized.

Show comment
Hide comment
@andrewdavidmackenzie

andrewdavidmackenzie May 26, 2018

The link in description (https://teamcity.jetbrains.com/repository/download/IntellijIdeaPlugins_Rust_BuildDebugger/.lastSuccessful/intellij-rust-debugger-0.0.1.%7Bbuild.number%7D.zip) is broken.

Searching TeamCity for "rust debug", "rust debugger", "intellij-rust-debugger" doesn't show anything.

Where can I download the plugin to add debugging capabilities to rust, either for IntelliJ with rust plugin (preferred) or CLion?

thanks

andrewdavidmackenzie commented May 26, 2018

The link in description (https://teamcity.jetbrains.com/repository/download/IntellijIdeaPlugins_Rust_BuildDebugger/.lastSuccessful/intellij-rust-debugger-0.0.1.%7Bbuild.number%7D.zip) is broken.

Searching TeamCity for "rust debug", "rust debugger", "intellij-rust-debugger" doesn't show anything.

Where can I download the plugin to add debugging capabilities to rust, either for IntelliJ with rust plugin (preferred) or CLion?

thanks

@U007D

This comment has been minimized.

Show comment
Hide comment
@U007D

U007D May 26, 2018

@andrewdavidmackenzie The latest CLion + IntelliJ Rust will give you a debuggable Rust development environment. Note: CLion specifically is required for debugging.

U007D commented May 26, 2018

@andrewdavidmackenzie The latest CLion + IntelliJ Rust will give you a debuggable Rust development environment. Note: CLion specifically is required for debugging.

@Undin

This comment has been minimized.

Show comment
Hide comment
@Undin

Undin May 26, 2018

Member

The link in description (https://teamcity.jetbrains.com/repository/download/IntellijIdeaPlugins_Rust_BuildDebugger/.lastSuccessful/intellij-rust-debugger-0.0.1.%7Bbuild.number%7D.zip) is broken.
Searching TeamCity for "rust debug", "rust debugger", "intellij-rust-debugger" doesn't show anything.

@andrewdavidmackenzie yeah, it's the outdated link in "Old content" section.
Now you don't need any other plugin except "intellij-rust".

Where can I download the plugin to add debugging capabilities to rust, either for IntelliJ with rust plugin (preferred) or CLion?

You can install it in Plugins settings in IDE or find in the plugin repository. As before, debugging is available only in CLion

Member

Undin commented May 26, 2018

The link in description (https://teamcity.jetbrains.com/repository/download/IntellijIdeaPlugins_Rust_BuildDebugger/.lastSuccessful/intellij-rust-debugger-0.0.1.%7Bbuild.number%7D.zip) is broken.
Searching TeamCity for "rust debug", "rust debugger", "intellij-rust-debugger" doesn't show anything.

@andrewdavidmackenzie yeah, it's the outdated link in "Old content" section.
Now you don't need any other plugin except "intellij-rust".

Where can I download the plugin to add debugging capabilities to rust, either for IntelliJ with rust plugin (preferred) or CLion?

You can install it in Plugins settings in IDE or find in the plugin repository. As before, debugging is available only in CLion

@andrewdavidmackenzie

This comment has been minimized.

Show comment
Hide comment
@andrewdavidmackenzie

andrewdavidmackenzie May 26, 2018

I got it working after adding localhost entry to /etc/hosts

The description made me think it might work in IntelliJ, my mistake. Thanks!

andrewdavidmackenzie commented May 26, 2018

I got it working after adding localhost entry to /etc/hosts

The description made me think it might work in IntelliJ, my mistake. Thanks!

@johnthagen

This comment has been minimized.

Show comment
Hide comment
@johnthagen

johnthagen Jul 23, 2018

Contributor

@perlindgren Were you ever able to make progress on CLion + STM32/OpenOCD? I am working trying to also get that to work (opened a Rust Users thread about it).

Contributor

johnthagen commented Jul 23, 2018

@perlindgren Were you ever able to make progress on CLion + STM32/OpenOCD? I am working trying to also get that to work (opened a Rust Users thread about it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment