LLDB Debugger doesn't pretty-print Vec

image

Using latest nightly msvc, Vscode with CodeLLDB
I believe the issue is related to the recent change in Vec's structure.

When that happened CodeLLDB decided to forgo custom formatters, and start using ones that come with rustc

But it doesn't work for me for some reason.

Maybe it has something to do with the fact that my toolchain/lib/rustlib/etc doesn't have files like lldb_lookup.py that CodeLLDB uses

Same for Option

I shouldn't be commenting on this, because I don't know how CodeLLDB works. However, the "start using ones that come with rustc" sounds a little suspicious. If that means "uses the same formatters as rust-lldb", then it's a known issue: The rust-lldb formatters are known to be broken; there are several issues open about them. (Everything ranging from "showing incorrect information" to "hangs while trying to parse data").

I read a while back that the person who was maintaining those things went on to do other things, and no one picked up the mantle.

2 Likes

That somewhat tracks with my experience.

What are my options for debugging rust?

Ironically, the best Rust debugging experience I've had is using Visual Studio on Windows to debug Rust programs. I only use Windows as a tertiary platform, so it's not ideal. With that said, I've done remote debugging (from Visual Studio to msvsmon.exe on a remote system), to debug a Windows service written in Rust, and was surprised at how convenient it was.

For my part, I really want the debugging story to be better in the Rust eco-system. Often when these types of threads appear, you'll find plenty of people argue that debuggers aren't as necessary when developing Rust as they are when writing C or C++. This is definitely true, but it doesn't mean debuggers can't be important. I would be using rust-lldb much more if it was in a better shape.

I also know there are people who use rust-gdb with some success, but I assume you're asking for a GUI solution, so I'm not sure that's super helpful.

4 Likes

Ouch

Thank you.

FWIW, I'm confident that PRs to improve the Rust LLDB providers (files beginning lldb_ in that directory) would be accepted. If you've got the time, improving them would help everyone in the Rust community who uses LLDB.

3 Likes

This is a case where it would probably be better if one couldn't get as far as one can with println!() debugging in Rust -- I'm certain I would have taken the time to dig into the lldb providers by this time if I was completely stuck on a problem without them.

With that said, it is in my pipeline (I have a few cases saved away that are known to trigger problems). Just haven't found the time yet.

1 Like

Rust-gdb from the command line has worked okay for me, the two times I used it. That said, not everyone wants such a workflow (I learned gdb for C in the early 2010s, so it works for me). And as I understand it, gdb doesn't work well on Mac OS X (I have zero personal experience with that platform).

1 Like

Unfortunately not super helpful, but while doing some initial scouting I saw that people that have worked on the rust-lldb scripts have noted that one of the problems is the lack of upstream documentation. Apparently there's a fair amount of reverse engineering and guessing involved -- which is less than ideal.

Thank you. I'm thinking of trying to add a fix for rust/src/etc at master · rust-lang/rust · GitHub, the starting point for the docs could be Custom Data Formatters · vadimcn/codelldb Wiki · GitHub

1 Like