Skip to content

Add LLDB providers for BTreeMap and BTreeSet #140130

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ede1998
Copy link

@ede1998 ede1998 commented Apr 21, 2025

Fixes #111868.

I'm unsure what the supported LLDB versions for rust-lldb are. I tested with LLDB 18 and 19 and it works with those but I know that it does not work with LLDB 14 which was picked by my codelldb extension for some reason (even though it packages LLDB 19).

I also had to work around what seems like an LLDB bug to me. Otherwise, I'd have kept the code more similar to the GDB provider.
SBTarget.FindFirstType() does not find the types that I'm searching for (LeafNode<i32, i32>*):

target = node.GetTarget()
print("leaf type:", node.GetType())
internal_type = target.FindFirstType(node.GetType().GetName())
print("Actual type:", internal_type)

which prints

leaf type: struct alloc::collections::btree::node::LeafNode<int, int> *
Actual type: No value

All in all, my experience with LLDB debug provider was very fiddly/they seem to break easily but I think it would be better to have BTreeMap/BTreeSet providers than not have them.

Getting to run the debuginfo tests was a pain too because of #126092 and errors with import _lldb (#123621).
I ended up re-compling lldb from source against python 3.10 because the tests don't work if lldb is compiled against python 3.12.

Also, it seems like the tests are not run in CI? At least I had a test commit in the PR before to trigger a debuginfo test failure which I didn't see here in my PR.

@rustbot
Copy link
Collaborator

rustbot commented Apr 21, 2025

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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 21, 2025
@rust-log-analyzer

This comment has been minimized.

@ede1998 ede1998 force-pushed the add-lldb-btree-providers branch from 687620b to 950f608 Compare April 22, 2025 10:09
@Mark-Simulacrum
Copy link
Member

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 4, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@ede1998 ede1998 force-pushed the add-lldb-btree-providers branch from e792e29 to bb58d72 Compare May 7, 2025 21:41
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 7, 2025
@rust-log-analyzer

This comment has been minimized.

@ede1998 ede1998 force-pushed the add-lldb-btree-providers branch from bb58d72 to f5148c7 Compare May 9, 2025 20:08
@ede1998 ede1998 force-pushed the add-lldb-btree-providers branch from f5148c7 to 53ef2e0 Compare May 10, 2025 12:49
@ede1998 ede1998 marked this pull request as ready for review May 10, 2025 12:55
@rustbot
Copy link
Collaborator

rustbot commented May 10, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 10, 2025
@ede1998
Copy link
Author

ede1998 commented May 10, 2025

@rustbot ready

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 14, 2025

📌 Commit 53ef2e0 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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 14, 2025
compiler-errors added a commit to compiler-errors/rust that referenced this pull request May 15, 2025
…r=Mark-Simulacrum

Add LLDB providers for BTreeMap and BTreeSet

Fixes rust-lang#111868.

I'm unsure what the supported LLDB versions for `rust-lldb` are. I tested with LLDB 18 and 19 and it works with those but I know that it does not work with LLDB 14 which was picked by my `codelldb` extension for some reason (even though it packages LLDB 19).

I also had to work around what seems like an LLDB bug to me. Otherwise, I'd have kept the code more similar to the GDB provider.
`SBTarget.FindFirstType()` does not find the types that I'm searching for (`LeafNode<i32, i32>*`):

```
target = node.GetTarget()
print("leaf type:", node.GetType())
internal_type = target.FindFirstType(node.GetType().GetName())
print("Actual type:", internal_type)
```

which prints

```
leaf type: struct alloc::collections::btree::node::LeafNode<int, int> *
Actual type: No value
```

All in all, my experience with LLDB debug provider was very fiddly/they seem to break easily but I think it would be better to have `BTreeMap`/`BTreeSet` providers than not have them.

Getting to run the `debuginfo` tests was a pain too because of rust-lang#126092 and errors with `import _lldb` (rust-lang#123621).
I ended up re-compling lldb from source against python 3.10 because the tests don't work if lldb is compiled against python 3.12.

Also, it seems like the tests are not run in CI? At least I had a test commit in the PR before to trigger a `debuginfo` test failure which I didn't see here in my PR.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 15, 2025
…mpiler-errors

Rollup of 14 pull requests

Successful merges:

 - rust-lang#139749 (docs(library/core/src/pin): fix typo "necessarily" -> "necessary")
 - rust-lang#140130 (Add LLDB providers for BTreeMap and BTreeSet)
 - rust-lang#140685 (Simplify `Vec::as_non_null` implementation and make it `const`)
 - rust-lang#140712 (normalization: avoid incompletely constraining GAT args)
 - rust-lang#140768 (Improve `dangerous_implicit_aurorefs` diagnostic output)
 - rust-lang#140834 (move (or remove) some impl Trait tests)
 - rust-lang#140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at)
 - rust-lang#140947 (Flush errors before deep normalize in `dropck_outlives`)
 - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc)
 - rust-lang#140977 ([win] Use a dash instead of slash for linker to avoid breaking lld)
 - rust-lang#140990 (VxWorks: updates from recent libc versions)
 - rust-lang#141003 (Improve ternary operator recovery)
 - rust-lang#141013 (Implement methods to set STARTUPINFO flags for Command API on Windows)
 - rust-lang#141026 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@compiler-errors
Copy link
Member

Failed in a rollup #141041 (comment)

@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 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No BTreeMap BTreeSet debug visualizers for lldb / macOS
6 participants