Skip to content
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 lldb formatter for "clang encoded" enums (LLDB 18.1+) (v2) #124745

Closed
wants to merge 1 commit into from

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented May 5, 2024

This PR is identical to #124458, which was approved and merged but then removed from master by a force-push due to a CI bug.

Original PR description:


Summary:

fixes #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. 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.

Summary:
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.
@rustbot
Copy link
Collaborator

rustbot commented May 5, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 5, 2024
@dtolnay
Copy link
Member Author

dtolnay commented May 5, 2024

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented May 5, 2024

📌 Commit 43e6600 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2024
fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
…, 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.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2024
Rollup of 6 pull requests

Successful merges:

 - rust-lang#124146 (Triagebot: Rename `macos` ping group to `apple`)
 - rust-lang#124742 (Add `rustfmt` cfg to well known cfgs list)
 - rust-lang#124745 (Implement lldb formattter for "clang encoded" enums (LLDB 18.1+) (v2))
 - rust-lang#124747 (Support Result<T, E> across FFI when niche optimization can be used (v2))
 - rust-lang#124765 ([rustdoc] Fix bad color for setting cog in ayu theme)
 - rust-lang#124768 ([resubmission] Meta: Enable the brand new triagebot transfer command)

r? `@ghost`
`@rustbot` modify labels: rollup
@fmease
Copy link
Member

fmease commented May 5, 2024

Failed in rollup: #124769 (comment)
CC @VladimirMakaev
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 5, 2024
@fmease
Copy link
Member

fmease commented May 5, 2024

@bors rollup=iffy

@fmease
Copy link
Member

fmease commented May 5, 2024

Since the original author (and maintainers) cannot directly modify this PR, I suggest opening a 3rd PR, VladimirMakaev.

@VladimirMakaev
Copy link
Contributor

@fmease I'll open a new PR. Is there a good way I can rerun those tests on CI for a PR? They seem to all pass when I do so locally on Linux server. Need to dig why things are failing on msvc would be nice to be able to trigger a build on PR to know upfront

@dtolnay dtolnay closed this May 5, 2024
@dtolnay dtolnay changed the title Implement lldb formattter for "clang encoded" enums (LLDB 18.1+) (v2) Implement lldb formatter for "clang encoded" enums (LLDB 18.1+) (v2) May 7, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lldb can not print Option<i32>
6 participants