Repository navigation
Description
The docs for the debuginfo test suite are quite brief, consisting basically just of a single example. Even that example leasves me more confused than enlightened:
For example, the following will build the test, start the debugger, set a breakpoint, launch the program, inspect a value, and check what the debugger prints:
The #break comment is below the other comments in the file. So apparently something is going on here with the execution order of these comments that makes them not just top-to-bottom in the file?
Also, #break is not the only directive that can start with #. Apparently there's also #locN:
rust/tests/debuginfo/macro-stepping.rs
Line 111 in 70320c1
| foo!(); // #loc1 |
No idea what that does.
Also, keep in mind that whoever hits a test failure in a debuginfo test may have never used gdb or a tool like it. The documentation should either give them some chance to fix the test, or tell them whom to ping for help.
Activity
RalfJung commentedon Oct 30, 2025
Judging from
rust/src/tools/compiletest/src/runtest/debugger.rs
Lines 35 to 39 in 72fe2ff
#locNisn't actually magic. It's just something this test does, maybe? So part of the problem might be the test itself not having sufficient comments.ehuss commentedon Oct 30, 2025
I'm curious what parts exactly led to the confusion?
Would it have helped in the docs to say after "launch the program" to say "and then run the debugger commands in order, which in this case is
run,print foo, and then checks that the debugger emits the string$0 = 123"?Does the line describing
#breakneed to more clearly say "all breakpoints are set before the program starts"?RalfJung commentedon Oct 30, 2025
Based on the test I looked at, with these
#locannotations, I was under the impression that there is an entire DSL of#annotations, and the docs only mentioned#break. But it seems like#breakis truly the only annotation, and the test using#locis an ad-hoc marker, nothing systematic?I think generally what I am missing is reference-level docs for these kinds of tests: a list of the relevant directives, and what they do.
ehuss commentedon Oct 30, 2025
Yea, the
#loclooks like someone's attempt to create some unique text. There's essentially just three things:#break— sets a breakpoint on the line// $DEBUGGER-command:— runs a command// $DEBUGGER-check:— checks the output of the debuggerI'm not sure, but it's possible I didn't include that in the directive listing because they only apply to this one suite, and I thought its description was clear on what was possible.
RalfJung commentedon Dec 1, 2025
Also, it would be good to explain how I can run the test suite with gdb vs lldb. Those seem to use separate annotations in the tests, so everything needs to be tested with both debuggers -- at least that's what it seems like to me.
EDIT: Ah, that is actually explained in the docs. Takes a while to get there when all you see is the CI error, but it's at least theoretically possible.
RalfJung commentedon Dec 1, 2025
Ah, that was premature...
./x test debuginfo -- --debugger lldbruns zero tests, so it doesn't actually let me test my lldb annotations.RalfJung commentedon Dec 1, 2025
This might be related to the fact that apparently I don't have lldb installed. 😂 But, maybe there could be an error message or so...?