Skip to content

Debuginfo tests don't control for ambient tools #126092

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
workingjubilee opened this issue Jun 6, 2024 · 14 comments
Open

Debuginfo tests don't control for ambient tools #126092

workingjubilee opened this issue Jun 6, 2024 · 14 comments
Labels
A-compiletest Area: The compiletest test runner A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) WG-debugging Working group: Bad Rust debugging experiences

Comments

@workingjubilee
Copy link
Member

The debuginfo tests should probably use a specific debugger, like maybe an lldb we build with the compiler, so that they work consistently. In practice, they have been effectively broken on user's machines by just trying to use whatever is installed.

In other words: just because I use Linux doesn't mean I have gdb installed.

@workingjubilee workingjubilee added the C-bug Category: This is a bug. label Jun 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 6, 2024
@workingjubilee workingjubilee added A-testsuite Area: The testsuite used to check the correctness of rustc A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) WG-debugging Working group: Bad Rust debugging experiences T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 6, 2024
@workingjubilee
Copy link
Member Author

workingjubilee commented Jun 6, 2024

The debuginfo test suite should also be insulated against gdb changing how it prints things, Because It Does.

@Noratrieb
Copy link
Member

Some points:

  • compiletest supports cdb, gdb and lldb, running the test suite for all the ones that are available (either via config.toml or via PATH).
  • our LLVM builds do currently not contain lldb.

@workingjubilee
Copy link
Member Author

That's... informative, thank you!

It does seem like we should reassess our strategy if we're gonna run a test suite that isn't guaranteed to pass even between different versions of a debugger on "any ol' random debugger lying around".

@bjorn3
Copy link
Member

bjorn3 commented Jun 8, 2024

On macOS we can't ship our own debugger. Only an Apple signed lldb is allowed to use the debugging apis of the kernel.

@workingjubilee
Copy link
Member Author

Wait, gdb is useless on macOS?

@bjorn3
Copy link
Member

bjorn3 commented Jun 8, 2024

Supposedly you can use gdb on macOS jf you sign it with a self-signed code signing certificate which you add to the system keychain, mark as trusted for code signing and set the right entitlements when signing gdb. I don't know if you need to disable SIP for this to work though. We can't disable SIP on CI. https://dev.to/jasonelwood/setup-gdb-on-macos-in-2020-489k

@workingjubilee
Copy link
Member Author

Hmm, okay. I think on Linux it is still desirable to control for the sheer amount of variability that Linux distros have, but I can believe that the debuginfo tests have to draw on the environment sometimes.

@jieyouxu
Copy link
Member

jieyouxu commented Jun 9, 2024

I think it's fine if we can't necessarily control for the debugger used, but we should at least document it and/or report the debugger used when running the debuginfo test suite.

@workingjubilee
Copy link
Member Author

yeah, that was also reported as #126628

@jieyouxu jieyouxu added the A-compiletest Area: The compiletest test runner label Jun 24, 2024
@saethlin
Copy link
Member

FYI all of the lldb tests have been failing for anyone who uses a rolling distro for the past 8 months because of llvm/llvm-project#70453

@jieyouxu
Copy link
Member

In case anyone stumbled across this, IIRC lldb debuginfo tests (currently) require Python 3.10 dll to be present in PATH on Windows, not sure about Unixes but presumably only working with Python 3.10 is well-behaved.

@jieyouxu jieyouxu added E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. and removed E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. labels Oct 17, 2024
@jieyouxu
Copy link
Member

this has come back to bite us in #133107

@jyn514
Copy link
Member

jyn514 commented Feb 14, 2025

i think we should consider the version of the debugger to be part of the "prerequisites" compiletest uses to determine whether to run the test at all (see #126628). it doesn't make any sense to run a test that needs lldb 19 against lldb 12.

@jieyouxu
Copy link
Member

jieyouxu commented Apr 2, 2025

i think we should consider the version of the debugger to be part of the "prerequisites" compiletest uses to determine whether to run the test at all (see #126628). it doesn't make any sense to run a test that needs lldb 19 against lldb 12.

I think there are two parts to this:

  1. I think it's reasonable if they are conditioned on prerequisites being available for them to be eligible to run (by default).
  2. But there needs to be a way (CI should force, locally should opt-in) to ensure debuginfo tests do get run and not trivially ignored.

compiler-errors added a commit to compiler-errors/rust that referenced this issue 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.
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-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) WG-debugging Working group: Bad Rust debugging experiences
Projects
No open projects
Development

No branches or pull requests

7 participants