-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
lldb can not print Option<i32> #79530
Comments
This is not a bug in rustc. Instead, this case requires a patch to lldb. The issue is that
However, the variant part construct isn't used by C or C++ (I don't know about Swift) and so stock lldb ignores it. IIRC the rust lldb patches handled this ok. So does gdb:
|
@tromey, how hard would it be get an upstreamable fix for lldb out of your rust lldb patches? |
Sorry about the extreme delay on this response. I forgot about it. Anyway, it's hard to know the answer. I feel that my track record getting things into upstream lldb is poor, and I don't know if that's due to something I did, or what. Also, this is the kind of work I wouldn't want to do in my spare time. |
@tromey do you know if there has been any progress on this topic? I think that the vscode-lldb guys may propose their patch to the upstream maybe... wdyt? |
Hi @tromey my employer is making contributions to upstream LLDB and we might be interested to get this fixed upstream as it'll improve our internal debugging experience. Would you be able to point me at the right place where this is fixed in a fork so I can engage with LLDB folks on this. I'm myself not familiar with LLDB codebase so would appreciate any ideas you have on this. |
Sorry again for the delay. My changes were all in the rust lldb. I'm sure they are still there in the history somewhere, though I don't know exactly where. I'd imagine they would require some effort to update to the latest lldb. Luckily the patches were not really that large. |
I've recently submitted a patch to LLDB to fix Rust enums which has got accepted https://reviews.llvm.org/D149213. If anybody has any feedback on this let me know. I'm planning to do a follow up contribution to synthetic providers in rust-lang |
Tested here today with latest version, not working yet.
|
@jgardona What version of LLDB do you have? The fix should be in lldb 18.1+. You won't see this pretty printed though as the synthetic provider was never merged to rust-project. What you should see is all enum variants and their discriminants but that should let you understand what the value is (or allow to write a synth provider to do so) |
…, r=Mark-Simulacrum Implement lldb formattter for "clang encoded" enums (LLDB 18.1+) ## Summary: fixes rust-lang#79530 I landed a fix last year to enable `DW_TAG_variant_part` encoding in LLDBs (https://reviews.llvm.org/D149213). This PR is a corresponding fix in synthetic formatters to decode that information. This is in no way perfect implementation but at least it improves the status quo. But most types of enums will be visible and debuggable in some way. I've also updated most of the existing tests that touch enums and re-enabled test cases based on LLDB for enums. ## Test Plan: ran tests `./x test tests/debuginfo/`. Also tested manually in LLDB CLI and LLDB VSCode ## Other Thoughs: A better approach would probably be adopting [formatters from codelldb](https://github.com/vadimcn/codelldb/blob/master/formatters/rust.py). There is some neat hack that hooks up summary provider via synthetic provider which can ultimately fix more display issues for Rust types and enums too. But getting it to work well might take more time that I have right now.
Hello. Sorry fro delay this message. |
It worked. This is way better as we can see data inside and understand what it is. |
It’ll get nicer with the next release of rust compiler when you use ‘rust-lldb’ script. The new synthetic provider has just been merged in yesterday. |
…, r=Mark-Simulacrum Implement lldb formattter for "clang encoded" enums (LLDB 18.1+) (v2) This PR is identical to rust-lang#124458, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F). Original PR description: --- ## Summary: fixes rust-lang#79530 I landed a fix last year to enable `DW_TAG_variant_part` encoding in LLDBs (https://reviews.llvm.org/D149213). This PR is a corresponding fix in synthetic formatters to decode that information. This is in no way perfect implementation but at least it improves the status quo. But most types of enums will be visible and debuggable in some way. I've also updated most of the existing tests that touch enums and re-enabled test cases based on LLDB for enums. ## Test Plan: ran tests `./x test tests/debuginfo/`. Also tested manually in LLDB CLI and LLDB VSCode ## Other Thoughs: A better approach would probably be adopting [formatters from codelldb](https://github.com/vadimcn/codelldb/blob/master/formatters/rust.py). There is some neat hack that hooks up summary provider via synthetic provider which can ultimately fix more display issues for Rust types and enums too. But getting it to work well might take more time that I have right now.
…r=dtolnay Implement lldb formatter for "clang encoded" enums (LLDB 18.1+) (V3) This is a redo of PR (rust-lang#124458) which was approved previously but force-pushed out. Then a V2 (rust-lang#124745) failed `debuginfo\msvc-pretty-enums.rs` test during merge. I've fixed the test and checked it to pass on Windows with `.\x.ps1 test .\tests\debuginfo\msvc-pretty-enums.rs` Below is the original summary: ## Summary: fixes rust-lang#79530 I landed a fix last year to enable `DW_TAG_variant_part` encoding in LLDBs (https://reviews.llvm.org/D149213). This PR is a corresponding fix in synthetic formatters to decode that information. This is in no way perfect implementation but at least it improves the status quo. But most types of enums will be visible and debuggable in some way. I've also updated most of the existing tests that touch enums and re-enabled test cases based on LLDB for enums. ## Test Plan: ran tests `./x test tests/debuginfo/`. Also tested manually in LLDB CLI and LLDB VSCode ## Other Thoughs: A better approach would probably be adopting [formatters from codelldb](https://github.com/vadimcn/codelldb/blob/master/formatters/rust.py). There is some neat hack that hooks up summary provider via synthetic provider which can ultimately fix more display issues for Rust types and enums too. But getting it to work well might take more time that I have right now.
I tried this code:
Trying to print the value of
x
gives:This is with:
and
The text was updated successfully, but these errors were encountered: