Cannot place breakpoint in library code (.cargo cache).
See original GitHub issueThis is pretty severe:
- open any source file in a library dependency of any project, by either opening the file or
- do a ctrl+click/definition lookup from any source file in a Rust project
- or put a breakpoint in the application code, debug and keep stepping until some library source file is reached
Example path:
$HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.18.0/src/lib.rs
- attempt to place a breakpoint at any point in the lib file
Result:
- there is no way to place a breakpoint
Expected results:
- a breakpoint can be placed and the breakpoint is triggered by running the main project via a Debug configuration
Additional information:
- ctrl-click and hover or any LSP activity in the editor containing the open library file don’t work
Workaround:
- import the entire
.cargo
folder into the Eclipse workspace as a project via File -> Open Projects From Filesystems…. Breakpoints can be then placed in any library source code in the .cargo cache.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Android Studio's debugger not stopping at breakpoints within ...
I had a problem with trying to debug Kotlin code. The debugger wasn't stoping at any of the breakpoints. It turns out it...
Read more >Profiles - The Cargo Book
Profiles. Profiles provide a way to alter the compiler settings, influencing things like optimizations and debugging symbols. Cargo has 4 built-in profiles: ...
Read more >Setting a Breakpoint in an Explicitly Loaded Library
Once a shared object has been loaded with dlopen() you can place breakpoints in it and debug it as you would any part...
Read more >Is the crate dependency becoming a problem? : r/rust - Reddit
Where you also have single file libraries that include the minimum ... tell massive blocks of code won't be used, why can't the...
Read more >How to Debug Rust with Visual Studio Code - ForrestTheWoods
Visual Studio Code is my Rust editor of choice. Unfortunately it can't quite debug Rust out of the box. Configuring the debugger isn't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We can create an issue for the RLS project, but I think this is unlikely to change. My gut feeling is that this would need deep changes in the RLS implementation and its dependency projects. We could as well ask the CDT guys to make breakpoints work for non-workspace resources, which is also unlikely to be implemented.
I did some tests with multiple workspaces trying to provoke failures and it did not show any problems. So I assume we can continue with this approach, as long as no problems arise. In this case, I would not go with the workaround placing a
Cargo.toml
andsrc/lib.rs
file in this directory directly. It is one thing to place a.project
file in there, but placing other Rust config/source files in this directory has the potential to screw up other tools.I didn’t notice any problems in my manual test, or behavior different to adding the
~/.cargo
directory directly as a project. I only did some quick tests though. Also: this seems like potential bugs looming in LSP4E. Users could use linked resources in their projects as well.I thought the lookup would prefer locations in the same project as the source of the navigation. But I realized it is not the case and I don’t understand the logic which resource gets selected if multiple workspace resources represent the same file on the file system. Eclipse even warns when creating a link that contains resources that are already part of the workspace. I guess this solution would cause many other problems. I just included it, because it seems to be the only workaround I came up with, which makes the RLS to provide useful information for library source files (populates outline view, etc.).
Thanks for the reports. So this can definitely be improved.
Path is expected to be absolute here. It seems like it’s not necessarily the case, and relative
user.home
should be supported.I suggest we open it as an enhancement request to RLS (support for source files without a Cargo.toml parent); and see whether there is some enthusiasm there.
I don’t think it’s much of an issue. For sure, some people will complain from time to time, but it would be a very small minority of people who 1. see this file 2. get curious about it 3. dislike it 4. think it’s worth the complaint.
I think it should work. The .project files are portable and usable by multiple instances and multiple users and multiple machines.
I don’t think LSP4E currently like linked resource that much. It has in several place built on the idea that workspace parent <=> filesystem parent, which become wrong with linked folders.
What would tell us which resources to link?