Commit graph

212 commits

Author SHA1 Message Date
Stephen Tozer
17e7497629
[Dexter] Switch to using script-mode by default (#204369)
This patch changes the default mode of Dexter from heuristic-mode to
script-mode. The --use-script argument is replaced with --use-heuristic,
some comments/docs/error messages are updated accordingly, and tests
have their flags switched accordingly.
2026-07-03 09:19:30 +01:00
Stephen Tozer
2870ebbcb5
[CrossProjectTests] Fixup expect in ctor.cpp to accept multiple steps (#207337)
In the test `ctor.cpp`, Dexter tests that when we step into the
constructor used in the test, the value of `this` isn't irretrievable.
To protect against a rotten pass it also checked that we stepped once,
but this caused failures on some platforms where we would step twice on
the constructor - this patch resolves the issue by accepting any
non-zero value for the number of steps.
2026-07-03 08:51:22 +01:00
Stephen Tozer
db5740f1a6
[Dexter] Update lldb-based dexter-tests to use script-mode (#204367)
This patch replaces uses of heuristic-mode Dexter in the dexter-tests
suite with uses of the script-mode, for tests that use DAP (via
lldb-dap). The updates are largely straightforward but occasionally
non-trivial, and in some cases some slight modifications have been made
to keep the "spirit" of the test intact.
2026-07-02 19:27:35 +01:00
Stephen Tozer
cb54896ff4
[Dexter] Add additional variable metrics, sanitize lldb-dap function names (#204366)
This patch makes some required changes prior to switching over to using
the script model by default, to keep the tests in `dexter-tests` working
and meaningful.

In addition to the existing metrics, we split the "missing_vars" metric
into 3 - adding "irretrievable" and "optimized_out", so that we can
specifically test those properties in the output.

We also add some function name sanitizing to lldb-dap, to account for
the fact that some function names get presented with a suffix " [opt]",
which causes the script to fail.
2026-07-02 18:26:58 +01:00
Stephen Tozer
b43a0db74e
[Dexter] Document the structured script model (#204365)
This patch adds documentation for the script model to the Dexter README,
shunting heuristic-mode information into a separate doc, creating a new
doc for script-mode, and linking to both (with a brief summary of the
differences) from the base README.
2026-07-02 17:56:11 +01:00
Stephen Tozer
142d555b62
[Dexter] Add ability to check float values within a range (#204161)
Adds a new node type, !float, which can be used to match debugger ouptut
as
float values rather than as strings, optionally allowing a range to be
specified for inexact matches. This new node allows a list of values to
be
given, effectively a shorthand for a list of individual !float nodes.
2026-07-02 16:13:33 +01:00
Stephen Tozer
938751d785
[Dexter] Allow matching lists of values for aggregate members (#204160)
This patch slightly extends the matching of aggregate members to allow
for lists of expected values for individual functioning the same as
lists of expected values for scalar values. This is accomplished by
recursively calling `get_expect_match` instead of `DebuggerExpectMatch`,
which contains logic for matching against all possible expected values
and selecting the best match (and committing any associated context
changes, e.g. modified address labels).
2026-07-02 13:12:05 +01:00
Stephen Tozer
9db1a29384
[Dexter] Add !type and !type/all nodes to test variable types (#204159)
This patch adds the second kind of variable expect, !type, which tests
the type of a variable as reported by the debugger. As with !value, this
is a string comparison of the debugger output with the script expected
value - this means that even if two types are identical (e.g. typedef),
a !type node will only match the one that the debugger displays by
default.

Script writing and aggregates work the same for !type as for !value, and
the metrics reported are largely similar, with the exception that
"unexpected", "seen", and "missing" metrics are reported separately for
values and types.
2026-07-02 10:35:38 +01:00
Stephen Tozer
41f826f54c
[Dexter] Add condition check to state nodes (#203847)
This patch enables the ability for state nodes to check conditions,
meaning they will be active only if the condition is met.

Condition evaluation is somewhat language specific; we directly check
whether the value of the evaluated expression is "true"
(case-insensitive), which works for the languages we actually use Dexter
with, but may require generalizing in future.

We also cache conditions as they are evaluated; each time we step, we
clear all cached conditions for the current frame and any expired
frames, but we keep the cached conditions for any frames rootwards from
the current frame; this prevents us from unexpectedly exiting out of a
callee frame because of debug info not surviving a stack unwind; if the
early exit is desired, an !and{at_frame_idx, condition} under the lower
frame may suffice.
2026-07-01 15:11:17 +01:00
Stephen Tozer
19f4c9913d
[Dexter] Enable after_hit_count for state nodes (#203846)
The after_hit_count attribute for a state node causes it to become
active only after it would have become active N times. This uses the
existing logic for incrementing hit counts, i.e. after the node becomes
"active", we will not add another hit count until it stops being active
for at least one step. Since state nodes with after_hit_count do not
become active before reaching the required hit count, this requires us
to keep track of an "early" set of state nodes, meaning nodes that would
be active if not for their after_hit_count.
2026-07-01 14:20:41 +01:00
Stephen Tozer
3b44af9503
[Dexter] Add support for writing !step values (#203845)
Following from the previous patch, this patch adds support to Dexter for
generating expected values for !step nodes. This is relatively limited:
the kind of !step which this is most well-suited to this is !step
exactly, as the !step order of ignoring extra lines is redundant (all
lines are added as expected values), and !step never can't know what
lines could have been stepped on but weren't without some extra work
(e.g. finding viable breakpoint locations in the enclosing state node).
2026-07-01 12:38:34 +01:00
Stephen Tozer
f9ddebc5c6
[Dexter] Add !step node for testing stepping behaviour (#203844)
This patch adds a node for generating metrics based on lines stepped on.
The new node has 3 versions: !step exactly, !step order, and !step
never, which check an expected list of line numbers against the actual
line numbers seen while the expect is active. "exactly" and "order" both
check that the list of line numbers appear in-order in the debugger
while the expect is in scope; "exactly" treats any seen line numbers
outside of this list as incorrect, while "order" ignores them. "never"
does not have an order, but treats any line numbers from the list that
are seen in the debugger as being incorrect.
2026-07-01 11:14:46 +01:00
Stephen Tozer
7f73dd43b1
[Dexter] Add at_frame_idx to check values in frames above current (#203505)
This patch adds a new attribute for !and nodes, `at_frame_idx`, which
matches against frames above its parent node; for example, in the
script:

```
!where {function: foo}:
  !where {function: bar}:
    !and {at_frame_idx: 1}:
      !value x: 0
```

The `!value x` node checks the value of 'x' in 'foo' while the debugger
is inside 'bar'. Use of this attribute comes with some restrictions: a
!where node can never be nested under a !and{at_frame_idx} node, and
neither can another !and{at_frame_idx} node.
2026-07-01 09:27:47 +01:00
Stephen Tozer
0bd538ad4c
[Dexter] Add for_hit_count for state nodes (#203359)
This patch adds the ability for state nodes to use a `for_hit_count:
<int>` field to limit the number of times that a given state node will
be active.

The hit count for each state node increments each time it is _entered_,
meaning it must be inactive (not matching any frame on the stack) in the
prior step; for example, if a `!where {lines}` node covers the entirety
of a loop, repeated iterations of that loop will not increment the
hit_count - only once the line range is existed and entered again will
the hit_count increment.
2026-06-30 20:56:02 +01:00
Stephen Tozer
242d4b60fe
[Dexter] Write expects for variables in Debugger scopes (#203254)
Following on from the previous patch, this patch adds support for
writing expects from !value/all nodes, generating separate expects for
each variable in the requested debugger scope, for each continuous range
of lines it is live for.

NB: As with the other patch that implements script-writing features,
each test in this patch has a corresponding "expected" file, which is
almost identical (including the `RUN` lines), and exists to be `diff`'d
against the output of Dexter's script generation.
2026-06-30 19:56:47 +01:00
Stephen Tozer
ede433bf09
[Dexter] Allow fetching "scopes" from the debugger (#202802)
To further improve Dexter's script writing ability, this patch starts
implementing the ability for Dexter to fetch all variables with in a
given "scope", as defined by the DAP "scopes" request. This allows the
test to collect all available variables without needing to specify them
explicitly in the script, aiding in fast script
generation/re-generation.

This patch does not add any script-writing functionality, but adds the
!value/all Node, which fetches all variable values from the given scope,
and enables fetching these values from DAP-based debuggers.
2026-06-30 18:56:30 +01:00
Stephen Tozer
19a0860da1
Reapply "[Dexter] Add rewriting for aggregate variables (#202800)" (#206535)
This reverts commit 5bf495456b9898c45c437b8dadae21417d04a9a5.

Reapply the original patch after the underlying issue was fixed in PR
#206732.
2026-06-30 16:55:06 +01:00
Stephen Tozer
57414efcaa
[Dexter] Avoid incorrect state matching against frames below main (#206732)
This patch fixes an error that caused some Dexter test failures, driven
by two separate causes. The first issue is that frames below main were
appearing in the program stacktrace; while Dexter tries to filter frames
below main during the stacktrace collection step based on a pre-written
list, this list may not be comprehensive enough, as the symbol
"___lldb_unnamed_symbol_2a150" has also appeared. In order to guard
against this and future cases that might appear, this patch adds a check
to Dexter for "presentationHint: deemphasize" in the DAP response; this
is added by LLDB (and other dap-based debuggers) as a hint that the
frame is not user source, and should be a generally useful way of
avoiding evaluating frames that are not wanted.

The second issue is a mismatch between the breakpoint-setting logic and
the state-matching logic: the former allows root !where nodes to omit
the "file" field, using the script file as a default file. The state
matching logic does not perform any checking for an omitted file.
Together, this means that we may correctly set breakpoints for e.g.
"test.cpp:10", but when we go to match against frames, the !where node
may match against some other line-10 that appears below (e.g. as a
caller of) the frame at test.cpp:10. This patch copies the default_file
logic to state matching, meaning that we will only match against the
intended frame.
2026-06-30 15:57:48 +01:00
Stephen Tozer
cdef97000c
Revert "[Dexter] Add rewriting for aggregate variables (#202800)" (#206495)
This reverts commit 2cf48dca33.

The original commit is failing sometimes in pre-commit CI for linux
builds, possibly due to some unspecified environmental dependency.
2026-06-29 14:56:07 +01:00
Stephen Tozer
bb9f0817a9
[Dexter] Add !address node (#202801)
Adds a node type for Dexter that allows checking abstract labels instead
of concrete addresses. Each address node has a label and optional
offset, and the first time during evaluation that a given address label
is matched against a valid pointer value, the address label will be
assigned a value that matches the seen address (adjusting for any
offset). From that point, the resolved address value will be used for
the remainder of the test evaluation.
2026-06-29 13:25:31 +01:00
Stephen Tozer
2cf48dca33
[Dexter] Add rewriting for aggregate variables (#202800)
Following on from the previous patch, this patch allows Dexter to write
disaggregated expected values for aggregate variables. Dexter eagerly
tries to disaggregate whenever subvalues are available, but will
fallback to the root/parent value if all available subvalues are
unavailable.

NB: Each test in this patch has a corresponding "expected" file, which
is almost identical (including the `RUN` lines), and exists to be
`diff`'d against the output of Dexter's script generation.
2026-06-29 11:43:04 +01:00
Stephen Tozer
384cecd5b2
Reapply "[Dexter] Add ability to rewrite scripts to fill-in unknown values" (#206034)
Reverts llvm/llvm-project#205657

The original commit was causing pre-merge CI to fail for AArch64, as one
of the tests expects stepping behaviour that is seen on not seen on
AArch64 targets; the test suite containing the failing test is meant to
be configured to not run for AArch64, but the unsupported label was not
being applied, due to an error in the unsupported check. This patch
fixes the unsupported check in scripts/lit.local.cfg, which should
prevent further errors.
2026-06-26 15:35:13 +01:00
Jan Svoboda
c0cbb8ac9e
Revert "[Dexter] Add ability to rewrite scripts to fill-in unknown values" (#205657)
Reverts llvm/llvm-project#202799 to fix the failing
cross-project-tests::debuginfo-tests/dexter/feature_tests/scripts/rewriting/rewrite_expect_list.cpp
test and unblock pre-commit CI.
2026-06-24 19:57:20 +00:00
Stephen Tozer
25a6b5be68
[Dexter] Add ability to rewrite scripts to fill-in unknown values (#202799)
This patch adds a feature to Dexter that allows scripts to be passed to
Dexter with missing expected values (`null` values in YAML), which
Dexter will attempt to "fill-in" with expected values that match the
debugger's actual output. The result is written to a file with the same
name as the original test file, in the directory given by
--results-directory if one is present; all content outside of the Dexter
script itself is preserved exactly as-is.

NB: Each test in this patch has a corresponding "expected" file, which
is almost identical (including the `RUN` lines), and exists to be
`diff`'d against the output of Dexter's script generation.
2026-06-24 16:55:25 +01:00
Stephen Tozer
d08ca31f48
[Dexter] Add !then node (#202546)
In order to exercise more control over stepping in Dexter tests, this
patch adds the `!then` node which can be used to step out of a function
or exit the current test. Unlike expect nodes, !then nodes appear as
direct singular children of a state node:

!where {lines: 10}: !then finish

The two currently available commands are "step_out" and "finish".
step_out performs a debugger "step out" command, skipping over all
!wheres in the current frame and not stepping into any lower !wheres.
The finish command ends the debugger session immediately after finishing
the current step.
2026-06-17 15:43:24 +01:00
Stephen Tozer
4cb6eee15d
[Dexter] Add support for aggregate expects in the debugger (#202545)
Allows aggregate expects to be written in Dexter scripts, in the form:

```
!value expect:
  member1: 0
  member2:
    submember1: 1
    submember2: 2
```

This uses the "variables" feature provided in the DAP interface to
recursively fetch sub-variables from each evaluated variable, and
modifies the DebuggerExpectMatch class to also be recursive, containing
submatches for each expected aggregate member value.

Some key concepts that are affected by this are the "match_result",
which has changed from a bool to a 3-way result ("FALSE", "TRUE",
"PARTIAL"), where "PARTIAL" means that at least one submatch was TRUE
and at least one was FALSE. We also add a `match_distance`, which is
used as a measure of correctness. The match distance ranges from 0.0 to
1.0: a total match has a distance of 0.0, a total mismatch has 1.0, and
a partial match's distance is equal to the average distance of its
immediate children.
2026-06-16 16:25:46 +01:00
Stephen Tozer
53d18800ed
Reapply "[Dexter] Add label nodes for line references" (#203938)
This reverts commit
2a789821b0.

The original commit previously caused pre-merge check failures for Linux
AArch64 cross-project-tests, due to the stepping behaviour being
slightly different to x86_64. The tests have been adjusted to be less
brittle to exact stepping behaviour, but this reapply also disables the
tests for ARM targets as there is not currently the infrastructure to
reliably test them, meaning we may end up with latent failures.
2026-06-16 13:03:33 +01:00
Stephen Tozer
2a789821b0
Revert "[Dexter] Add label nodes for line references" (#203920)
Reverts llvm/llvm-project#202544

Commit appears to be causing failures in the pre-merge checks for
AArch64 specifically, though this is not entirely consistent. Reverting
to fix pre-merge checks immediately, will aim to reland with either a
fix or disabling tests for AArch64.
2026-06-15 16:09:51 +01:00
Stephen Tozer
d3c6d78de1
[Dexter] Add label nodes for line references (#202544)
This patch adds a !label node to Dexter scripts, which references lines
at a position in the source program marked with "!dex_label
<identifier>". Each label use can be given a positive or negative
offset, and file lookup is based on the provided --source-root-dir
(using the test file's directory if none is provided).
2026-06-15 13:47:08 +01:00
Stephen Tozer
066fe34dcc
[Dexter][NFC] Fixup test line numbers (#203360)
A previous commit (78ae864) added a test that contained off-by-1 errors
in the line numbers used in the Dexter script; this patch adjusts these
to the correct line number.
2026-06-11 19:15:00 +01:00
Stephen Tozer
78ae86408c
[Dexter] Add support for nested state nodes (#201395)
This patch adds support for nested state nodes, !where and a new !and
node. Nested state nodes are evaluated only at a frame relative to the
frame that their parent matched to:

- `!where` can only match the frame immediately called from/leafwards
from their parent frame.
- `!and` can only match the same frame as their parent frame.
2026-06-11 19:05:55 +01:00
Stephen Tozer
50347f52b6
[Dexter][NFC] Mark script tests unsupported for non-lldb debuggers (#201596)
The recently-added structured script feature currently relies on
DAP-based debuggers, of which the only one currently supported by Dexter
is LLDB. In order to prevent the tests that depend on this feature from
running for other debuggers, we require LLDB for the script test
directory.
2026-06-04 15:29:33 +01:00
Stephen Tozer
5816ef1560
[Dexter] Add basic result evaluation for structured scripts (#198803)
This patch adds evaluation for structured scripts, completing the
features required to run simple Dexter tests using structured scripts.
The basic output from these evaluations is a list of named metrics
aggregating the results of evaluating !value nodes. The verbose output
gives a per-step summary of the results for each expect node active at
that step.

Most of the new functionality is in the evaluation/ dir, which has also
absorbed some functionality previously stored in the
ScriptDebuggerController for matching !where nodes to a debugger StepIR,
as this is logic which is common to both managing a debugger session and
evaluating the end result.
2026-06-03 15:56:47 +01:00
Stephen Tozer
c7ecad5c28
[Dexter] Add basic debugging support for structured scripts (#197418)
This patch adds a debugger controller for structured scripts. This
controller operates as follows:
- !where nodes at the root of the script (currently the only kind
allowed) have function or line breakpoints set to cover them.
- Whenever the debugger stops, the controller will examine the stack to
determine whether any !where nodes are in scope.
- While any !where is in scope, its associated !values will be evaluated
in the debugger and the results stored, and the debugger will
single-step.
- When no !where is in scope, the debugger will continue.

This is a simplified implementation compared to the final version, as it
is missing support for nested !where nodes, Scope evaluation, and
conditions/hit counts; these will be added in later commits.
2026-06-03 12:12:25 +01:00
Stephen Tozer
a5547d3592
[Dexter] Add basic structured script parsing (#193710)
See PSA:
https://discourse.llvm.org/t/psa-planned-changes-to-dexter/90402

This patch begins adding support for "structured scripts" to Dexter,
starting with some of the core classes and the ability to parse script
files. This patch does not add the ability to actually run scripts, or
any of the underlying functionality required to do so.

NB: This patch adds a dependency on PyYAML, which is specified in a new
requirements.txt file.
2026-05-11 13:04:28 +01:00
Stephen Tozer
35314409da
[Dexter][NFC] Add split step-data collection methods for DAP (#196350)
This patch adds some extra state collection methods to DebuggerBase and
implements them for DAP only. These methods are used to fetch a
stacktrace without variable information, and to populate variable
information into a StepIR containing only a stacktrace. These methods
are currently unused, making this patch NFC, but this is a necessary
precursor to the new script model, where we examine the stacktrace to
determine what variable info we will collect.

As part of the stacktrace-collection function, we also fetch the
instruction address for each stack frame, if it is made available by the
debugger; to enable this, this patch adds a new value with default
`None` to `FrameIR`.
2026-05-08 09:52:12 +01:00
Stephen Tozer
a30e9a4a8e
[Dexter] Add timestamps to DAP logging (#193705)
DAP logs are currently optionally output by Dexter to assist in
debugging or analyzing Dexter sessions. The output currently includes
the contents of every DAP message sent to/from the debug adapter, but
for some long-running programs it can also be useful to know when
messages have been sent and received; to assist, this patch adds
timestamps to DAP messages in the log.
2026-05-06 11:20:54 +01:00
Michael Buch
25b0ab2d4f
[ci][llvm] Run cross-project-tests on llvm/ changes (#188522)
This patch ensures we run the `cross-project-tests` on `llvm/` PRs. At
the very least those tests depend on debug-info and
`llvm/ADT/`/`llvm/Support` (and the data-formatters that also live in
`llvm/`).

This would've helped catch
https://github.com/llvm/llvm-project/pull/188483 at pre-merge time.
2026-04-17 17:31:10 +01:00
Nerixyz
91b90652bb
Reland "[CodeView] Generate S_DEFRANGE_REGISTER_REL_INDIR" (#189401)
Initially added in #187709. It was reverted in #188833, because
[llvm-clang-x86_64-sie-win](https://lab.llvm.org/buildbot/#/builders/46/builds/32873)
was failing in
`cross-project-tests/debuginfo-tests/dexter-tests/nrvo.cpp`.

The test passed for me locally. After checking on another machine, I
found that `S_DEFRANGE_REGISTER_REL_INDIR` is only supported by
dbgeng/WinDbg from Windows 10.0 Build 19041 (released 2020) onwards.
SDKs before this will fail to read the value. That buildbot is on
Windows 10.0 Build 17763.

I'm not sure if we should make the generation of that record
conditional. Debuggers that can't read the record will skip it. They'll
still see that there's some local variable, but won't be able to display
the value.

As far as I know, users of older Windows 10 builds should be able to
install a newer Windows SDK and use the WinDbg from that version. But I
haven't tested that.
2026-04-02 12:15:11 +02:00
Michael Buch
1b16876ecd [cross-project-tests] Mark llgdb-tests/sret.cpp as UNSUPPORTED on Linux
See https://github.com/llvm/llvm-project/issues/188957

Fails with following error on the `cross-project-tests-sie-ubuntu-dwarf5` builder:
```
******************** TEST 'cross-project-tests :: debuginfo-tests/llgdb-tests/sret.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
Running debugger
Running FileCheck
Debugger output was:
Breakpoint 1 at 0x11fb: file /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp, line 64.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, B::AInstance (this=0x7fffffffe6ef) at /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp:64
64	    A a(12);
$1 = {_vptr$A = 0x0, m_int = 0, static __clang_vtable = <optimized out>}
A debugging session is active.
	Inferior 1 [process 1110596] will be killed.
Quit anyway? (y or n) [answered Y; input not from terminal]
--
Command Output (stderr):
--
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang --driver-mode=g++ --target=x86_64-unknown-linux-gnu -O0 -g /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp -c -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o # RUN: at line 4
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang --driver-mode=g++ --target=x86_64-unknown-linux-gnu -O0 -g /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp -c -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang --driver-mode=g++ --target=x86_64-unknown-linux-gnu /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out # RUN: at line 5
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/bin/clang --driver-mode=g++ --target=x86_64-unknown-linux-gnu /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out
PYTHON_EXEC_PATH=/usr/bin/python3.10 LLDB_PYTHON_PATH=/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/./lib/python3.10/site-packages /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out # RUN: at line 6
+ PYTHON_EXEC_PATH=/usr/bin/python3.10
+ LLDB_PYTHON_PATH=/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/./lib/python3.10/site-packages
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp:14:11: error: CHECK: expected string not found in input
// CHECK: {{(_vptr\$A =)?.*}}m_int = 12
          ^
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output:7:5: note: scanning from here
$1 = {_vptr$A = 0x0, m_int = 0, static __clang_vtable = <optimized out>}
    ^
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output:7:6: note: possible intended match here
$1 = {_vptr$A = 0x0, m_int = 0, static __clang_vtable = <optimized out>}
     ^
Input file: /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output
Check file: /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp
-dump-input=help explains the following input dump.
Input was:
<<<<<<
            1: Breakpoint 1 at 0x11fb: file /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp, line 64.
            2: [Thread debugging using libthread_db enabled]
            3: Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
            4:
            5: Breakpoint 1, B::AInstance (this=0x7fffffffe6ef) at /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp:64
            6: 64 A a(12);
            7: $1 = {_vptr$A = 0x0, m_int = 0, static __clang_vtable = <optimized out>}
check:12       ^~~~
check:14'0         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:14'1          ?                                                                    possible intended match
            8: A debugging session is active.
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            9:
check:14'0     ~
           10:  Inferior 1 [process 1110596] will be killed.
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11:
check:14'0     ~
           12: Quit anyway? (y or n) [answered Y; input not from terminal]
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
--
```
2026-03-27 10:48:33 +00:00
Michael Buch
0af58d309b [cross-project-tests] XFAIL memvars/const-branch.c on x86_64 Darwin
Fails on x86_64 macOS buildbot:
```
07:43:57
 ******************** TEST 'cross-project-tests :: debuginfo-tests/dexter-tests/memvars/const-branch.c' FAILED ********************
07:43:57  Exit Code: 2
07:43:57
07:43:57  Command Output (stdout):
07:43:57  --
07:43:57  const-branch.c: (0.0000)
07:43:57
07:43:57  ## BEGIN ##
07:43:57  .   [1, "main [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 48, 10, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
07:43:57  .   .   [2, "fun [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 26, 3, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
07:43:57  .   .   .   [3, "esc [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 15, 7, "StopReason.BREAKPOINT", "StepKind.FUNC", []]
07:43:57  .   .   .   [4, "esc [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 16, 6, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
07:43:57  .   .   .   [5, "esc [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 17, 1, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
07:43:57  .   .   [6, "fun [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 27, 13, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
07:43:57  .   .   [7, "fun [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 44, 3, "StopReason.BREAKPOINT", "StepKind.VERTICAL_FORWARD", []]
07:43:57  .   [8, "main [opt]", "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c", 48, 3, "StopReason.STEP", "StepKind.HORIZONTAL_BACKWARD", []]
07:43:57  [9, "start", "/usr/lib/dyld`start", 408, 1, "StopReason.STEP", "StepKind.VERTICAL_FORWARD", []]
07:43:57  ## END (9 steps) ##
07:43:57
07:43:57
07:43:57    const-branch.c:26-44 [param] ExpectValue [7/7]
07:43:57      expected encountered watches:
07:43:57        5
07:43:57
07:43:57      unexpected result:
07:43:57        (variable not available): steps [6-7] [-7]
```
2026-03-27 08:27:26 +00:00
Jonas Devlieghere
f9acb06ce4
[debuginfo-tests] Update line numbers in llgdb-tests/nrvo-string.cpp (#188901)
Update the line numbers in llgdb-tests/nrvo-string.cpp for #188780 which
shifts the file by 6 lines.
2026-03-27 03:28:00 +00:00
Nerixyz
48e9c76d88
Revert "[CodeView] Generate S_DEFRANGE_REGISTER_REL_INDIR (#187709)" (#188833)
This reverts commit 08a4085. The change breaks `nvro.cpp` in the
debugging tests on the buildbot
(https://lab.llvm.org/buildbot/#/builders/46/builds/32873) but works
locally for me. It might be because the buildbot is using an older
Windows SDK.

In addition, it reverts parts of #188769 (using `.` over `->`).
2026-03-26 20:20:36 +00:00
Nerixyz
9daff72e9d
[Dexter][Dbgeng] Don't replace '.' with '->' in expressions (#188769)
After #187709, the
[nrvo.cpp](3a56470a0e/cross-project-tests/debuginfo-tests/dexter-tests/nrvo.cpp)
test failed (e.g.
https://lab.llvm.org/buildbot/#/builders/46/builds/32858), because it
couldn't evaluate the expression `result.i` anymore. This was because it
actually evaluated `result->i`, which doesn't work anymore as `result`
is not a pointer or reference. Before #187709, `result` was declared as
a reference that lives at `frame-pointer+offset`.
Now it's no longer a reference, but the location is
`*(frame-pointer+offset) + 0`.

There weren't any other tests that were accessing struct fields and used
dbgeng as the debugger.
2026-03-26 19:38:28 +01:00
Michael Buch
f7feb2ad47 [cross-project-tests] XFAIL llgdb-tests/sret.cpp on Darwin
I un-XFAILed this because it was passing on AArch64 Linux. But turns out
on the Darwin bots this is failing. Hence XFAIL on Darwin (there's only
64-bit bots out there for Darwin).

```
******************** TEST 'cross-project-tests :: debuginfo-tests/llgdb-tests/sret.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running debugger
Running FileCheck
Debugger output was:
imported lldb from: "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Resources/Python"
>  break 63
SBBreakpoint: id = 1, file = '/Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp', line = 63, exact_match = 0, locations = 1
>  r
success
>  p a
(A) $0 = (m_int = 1876949584)
> quit

--
Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang --driver-mode=g++ --target=arm64-apple-darwin23.6.0 -O0 -g /Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp -c -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o # RUN: at line 3
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang --driver-mode=g++ --target=arm64-apple-darwin23.6.0 -O0 -g /Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp -c -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang --driver-mode=g++ --target=arm64-apple-darwin23.6.0 /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out # RUN: at line 4
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang --driver-mode=g++ --target=arm64-apple-darwin23.6.0 /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.o -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out
PYTHON_EXEC_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 LLDB_PYTHON_PATH=/Users/buildbot/buildbot-root/aarch64-darwin/build/./lib/python3.9/site-packages /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl /Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out # RUN: at line 5
+ PYTHON_EXEC_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9
+ LLDB_PYTHON_PATH=/Users/buildbot/buildbot-root/aarch64-darwin/build/./lib/python3.9/site-packages
+ /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl /Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.tmp.out
 [1m/Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp:13:11:  [0m [0;1;31merror:  [0m [1mCHECK: expected string not found in input
 [0m// CHECK: {{(_vptr\$A =)?.*}}m_int = 12
 [0;1;32m          ^
 [0m [1m/Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output:7:9:  [0m [0;1;30mnote:  [0m [1mscanning from here
 [0m(A) $0 = (m_int = 1876949584)
 [0;1;32m        ^
 [0m [1m/Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output:7:10:  [0m [0;1;30mnote:  [0m [1mpossible intended match here
 [0m(A) $0 = (m_int = 1876949584)
 [0;1;32m         ^
 [0m
Input file: /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/projects/cross-project-tests/debuginfo-tests/llgdb-tests/Output/sret.cpp.gdb.output
Check file: /Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
 [1m [0m [0;1;30m            1:  [0m [1m [0;1;46mimported lldb from: "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Resources/Python"  [0m
 [0;1;30m            2:  [0m [1m [0;1;46m> break 63  [0m
 [0;1;30m            3:  [0m [1m [0;1;46mSBBreakpoint: id = 1, file = '/Users/buildbot/buildbot-root/llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp', line = 63, exact_match = 0, locations = 1  [0m
 [0;1;30m            4:  [0m [1m [0;1;46m> r  [0m
 [0;1;30m            5:  [0m [1m [0;1;46msuccess  [0m
```
2026-03-26 16:57:10 +00:00
Michael Buch
1d48918ef2
[cross-project-tests] Add has-gdb LIT feature (#188780)
This patch adds a `has-gdb` LIT feature that I then use in the
`REQUIRES` clause for `llgdb` tests.

These tests were failing because `llgdb.py` couldn't find `gdb` on the
host when I tried enabling these tests on PR CI
(https://github.com/llvm/llvm-project/issues/188775).

We should get `gdb` installed on the buildbots. But we should also be
able to run the rest of the `cross-project-tests` in the meantime even
if gdb isn't installed.
2026-03-26 16:26:09 +00:00
Michael Buch
8700d19a3d [cross-project-tests] Mark expect_step_kind/direction.cpp as UNSUPPORTED
The test was failing on one Linux bot but XPASSing on another.

To unblock PR CI I'm going to skip it for now until we figure out what's going on.
2026-03-26 16:14:22 +00:00
Michael Buch
0b6ba34a1c
[cross-project-tests] un-XFAIL/XFAIL dexter tests on Linux (#188777)
See https://github.com/llvm/llvm-project/issues/188775 for the XFAILed
test.

The other was failing as XPASS on AArch64.

This is part of enabling the tests on PR CI
(https://github.com/llvm/llvm-project/pull/188522)
2026-03-26 16:09:05 +00:00
Jakub Kuderski
6e916d0598
[llvm][ADT] Add variable-width tag encoding to PointerUnion (#188167)
PointerUnion stores a fixed-width `ceil(log2(N))`-bit tag in the low
bits of the pointer. This works only when every member type provides at
least that many low bits — if the least-aligned type doesn't,
compilation fails, even though the higher-aligned types may have plenty
of spare bits going to waste.

Introduce a variable-length escape-encoded tag that exploits the extra
low bits of higher-aligned types, analogous to UTF-8: types are grouped
into tiers by NumLowBitsAvailable; each non-final tier reserves one code
as an escape prefix, and the next tier extends the tag into the newly
available bits. This allows PointerUnion to hold more type variants than
a fixed-width tag permits.

The fixed-width path is used when the minimum alignment already provides
enough bits (the common case); the variable-width path activates only
when it doesn't, and requires types to be listed in non-decreasing
NumLowBitsAvailable order.

I need this for https://github.com/llvm/llvm-project/pull/186923 which
requires a 6-member PointerUnion in MLIR TypeRange/ValueRange. On 32-bit
systems, some members only provide 2 low bits, insufficient for a 3-bit
fixed-width tag.
2026-03-25 12:09:24 -04:00
Jakub Kuderski
9c6054d29d
[lldb][ADT] Fix LLDB/GDB formatters for PointerUnion after recactoring (#188483)
In #188242, we replaced `PointerUnion`'s `PointerIntPair` storage with
`PunnedPointer<void*>`. The old formatters relied on the PIP synthetic
provider (LLDB) / `get_pointer_int_pair helper` (GDB) which no longer
work.

Instead, read raw bytes from `PunnedPointer` and compute the active tag
from template argument type alignments -- the same fixed-width encoding
the C++ implementation uses. When template arg enumeration is truncated
(e.g., function-local types in GDB), the formatters fall back to showing
a tag-stripped `void*` instead of silently misdecoding.

Alternatives that didn't work out:
- Adding a C++ helper (`getActiveMemberIdx`) callable from Python: gets
optimized out even with `__attribute__((used, noinline))`, and
expression evaluation fails for synthetic children.
- Using `isa`/`dyn_cast` checks from Python: requires expression
evaluation, which does not work for local types or synthetic children
without a frame context.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 10:16:01 -04:00