llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.32k stars 12.12k forks source link

[lldb-dap] vscode - is lldb-dap able to debug rust programs using lldb-dbp ext in vscode? #110829

Open chanmaoganda opened 1 month ago

chanmaoganda commented 1 month ago

I'm currently using llvm@18.1.8 and lldb-dap@0.2.6. I tried to debug rust programs, but i got the following error: warning: This version of LLDB has no plugin for the language "rust". Inspection of frame variables will be limited. though frames is limited, variables are able to inspect

vogelsgesang commented 1 month ago

Not lldb-dap specific, but applies to lldb in general

llvmbot commented 1 month ago

@llvm/issue-subscribers-lldb

Author: Jingchen Wang (chanmaoganda)

I'm currently using llvm@18.1.8 and lldb-dap@0.2.6. I tried to debug rust programs, but i got the following error: `warning: This version of LLDB has no plugin for the language "rust". Inspection of frame variables will be limited.` though frames is limited, variables are able to inspect - debug variables ![image](https://github.com/user-attachments/assets/3c298d38-babb-4960-8fef-d98b16bf56a7) ![image](https://github.com/user-attachments/assets/59d3f019-82a4-4d1d-aa36-1c36d2f4ee08)
jimingham commented 1 month ago

lldb doesn't have "native" support for Rust. There's no Rust Language or runtime plugins, and there isn't a Rust frontend to use for parsing expressions. The current level of support for rust in lldb is: Rust claims to be "another variant of C++". So we ingest Rust types from DWARF into the Clang AST's, and use the C++ parser to parse expressions using those types. Rust also supplies some lldb data formatters that can help introspect common Rust data types. From reports I've gotten execution control is okay, and with the Rust data formatters the frame var command is mostly useful. But you don't get very far with the expression parser.

DavidSpickett commented 3 weeks ago

You might be able to emulate what rust-lldb does (https://github.com/rust-lang/rust/blob/master/src/etc/rust-lldb) by adding a initCommand (https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/README.md#configuration-settings-reference) to load the formatters file (https://github.com/rust-lang/rust/blob/27e38f8fc7efc57b75e9a763d7a0ee44822cd5f7/src/etc/lldb_lookup.py).

Allegedly CodeLLDB can be used - https://code.visualstudio.com/docs/languages/rust#_debugging

Though I wonder if it suffers from the same drawbacks.