123 Commits

Author SHA1 Message Date
Orlando Cazalet-Hyams
8c7e1ab98e
[Dexter] Add DAP stepNext and stepOut support (#152717) 2025-08-13 13:57:53 +01:00
Orlando Cazalet-Hyams
ba5ff57917
[Dexter] Track DAP capabilities (#152715) 2025-08-12 13:47:33 +01:00
Orlando Cazalet-Hyams
2d33b799bd
[Dexter][NFC] Rename step -> step_in (#152716) 2025-08-12 10:51:02 +01:00
Stephen Tozer
d9345545a0 Reapply "[Dexter] Add DAP support for Dexter, including lldb-dap (#149394)"
This reverts commit e1e312e6af34803d1686d9ce5a441446811f425d.

The original patch had some python3.10 syntax, which was incompatible with
the python3.8 minimum version in LLVM currently; this reapply brings
everything down to 3.8 compatibility. Separately, some incorrect arguments
were passed in LLDBDAP._get_launch_params, which have been removed.
2025-08-11 11:50:00 +01:00
Stephen Tozer
e1e312e6af Revert "[Dexter] Add DAP support for Dexter, including lldb-dap (#149394)"
This reverts commit 83dfdd8f5485f6b50213c88f02878f86b3f53852.

Temporary revert, as the above patch contains some python code requiring at
least version 3.10, when the minimum required by LLVM is 3.8.
2025-07-29 17:26:30 +01:00
Stephen Tozer
83dfdd8f54
[Dexter] Add DAP support for Dexter, including lldb-dap (#149394)
This patch adds a new variety of driver to Dexter, allowing it to work
with DAP-based interfaces for debuggers. The first concrete instance of
this is implemented in this patch, adding support for an `lldb-dap`
debugger. This is functionally very similar to the existing LLDB
debugger support*, but uses lldb-dap as its executable instead of lldb.

This has been tested successfully against the existing feature_test
suite, and manually tested against some other inputs; support is
essentially complete, although any further DAP-based debuggers may
require additional hooks inserted into the base class to deal with any
idiosyncrasies they exhibit (as with the several that have been inserted
for lldb-dap).

NB: There are some small differences resulting from differences between
lldb-dap's use of the lldb API and Dexter's use in its lldb driver; one
small example of this is when evaluating variables, lldb-dap will try to
first use `GetValueForVariablePath` and fallback to `EvaluateExpression`
if necessary, while Dexter will always use `EvaluateExpression`; these
can give slightly different results, resulting in different output from
Dexter for the same input.
2025-07-29 16:34:41 +01:00
Stephen Tozer
c6ac07b95a
[Dexter] Add option to Dexter to name results based on directory (#148611)
As a legacy of Dexter's role as a test runner, it selects a name for
result files based on the relative path from the test root to each
individual test. Since Dexter no longer takes a test directory as an
argument, only the basename for each test is ever used. This patch adds
an optional --test-root-dir argument, allowing for relative paths to be
used for result files again.
2025-07-15 11:16:51 +01:00
Stephen Tozer
2334fd2ea3 [Dexter] Update Dexter tests to use new dexter test substitutions
Following commit b8fc288, which changed some dexter test substitutions to
be specific to C and C++, some tests that had been added since the original
patch was written were still using the old substitution; this patch updates
them to use the new.
2025-04-03 16:05:42 +01:00
Stephen Tozer
b8fc288c46
[Dexter] Replace clang with clang++ in various cross project tests (#65987)
This patch replaces invocations of clang with clang++ for a set of
c++ files in the dexter cross-project tests. As a small additional change,
this patch removes -lstdc++ from a test that did not appear to require it.
2025-04-03 15:37:43 +01:00
Augusto Noronha
7cabcdb2d2
[debuginfo-tests] Use built lldb for testing if available (#131681)
The cross-project-tests's debuginfo-tests don't rely on lldb being built
to run. While this is a good, a bug in the system lldb can cause a test
to fail with no way of fixing it. This patch makes it so the tests use
the built lldb instead if it's available.
2025-03-19 12:42:47 -07:00
Jeremy Morse
1ed359e682
[Dexter] Remove clang-opt-bisect analyzer tool (#128165)
The idea behind this tool was that you'd instrument a source file to
measure its debug-info quality, then watch as it progressively got worse
with more optimisations being enabled in clang. However we've since
stripped the "building" portions of Dexter out as they were ill placed,
which makes this tooling redundant. The lack of __init__.py adjacent to
it means it couldn't be run anyway.

The core idea behind this is still sound; just it's best placed on the
other side of the build system, something that Dexter shouldn't try to
solve.
2025-02-24 11:56:51 +00:00
Eisuke Kawashima
a1a3e019d7
[cross-project-tests] Fix invalid escape sequences (#94031)
These generate a SyntaxWarning with Python 3.12.
2025-01-13 13:15:22 +01:00
Eisuke Kawashima
ca92bdfa3e
[cross-project-tests] Use "is" instead of "==" to check for None (#94016)
From PEP8
(https://peps.python.org/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or
is not, never the equality operators.
2025-01-13 13:03:04 +01:00
Stephen Tozer
23309d7d95
[Dexter] Set up ComInterface module to be imported correctly (#111850)
Fixes issue added by: https://github.com/llvm/llvm-project/pull/111833

Following the previous commit that changed how Dexter imports modules,
the ComInterface module import became broken. This is because it had a
different directory structure to other modules, where we want to import
single file rather than a dir containing a __init__.py. For this case,
an optional extra arg has been added to load_module allowing a filename
to be specified, letting us import ComInterface.py directly and fixing
the issue.
2024-10-10 16:53:36 +01:00
Stephen Tozer
6779376ee9
[Dexter] Remove outdated imp dependency (#111833)
Fixes: https://github.com/llvm/llvm-project/issues/111815

This patch replaces usage of the python `imp` library, which is
deprecated since python3.4 and removed in python3.12, with the
`importlib` library. As part of this update the repeated
find_module+load_module pattern is moved into a utility function, since
the importlib equivalent is much more verbose.
2024-10-10 14:38:07 +01:00
Jason Molenda
93e45a69dd
[Dexter] Adapt to upcoming lldb stepping behavior (#108127)
lldb will change how it reports stop reasons around breakpoints in the
near future. I landed an earlier version of this change and noticed
debuginfo test failures on the CI bots due to the changes. I'm
addressing the issues found by CI at
https://github.com/llvm/llvm-project/pull/105594 and will re-land once
I've done all of them.

Currently, when lldb stops at a breakpoint instruction -- but has not
yet executed the instruction -- it will overwrite the thread's Stop
Reason with "breakpoint-hit". This caused bugs when the original stop
reason was important to the user - for instance, a watchpoint on an
AArch64 system where we have to instruction-step past the watchpoint to
find the new value. Normally we would instruction step, fetch the new
value, then report the user that a watchpoint has been hit with the old
and new values. But if the instruction after this access is a breakpoint
site, we overwrite the "watchpoint hit" stop reason (and related
actions) with "breakpoint hit".

dexter sets breakpoints on all source lines, then steps line-to-line,
hitting the breakpoints. But with this new behavior, we see two steps
per source line: The first step gets us to the start of the next line,
with a "step completed" stop reason. Then we step again and we execute
the breakpoint instruction, stop with the pc the same, and report
"breakpoint hit". Now we can step a second time and move past the
breakpoint.

I've changed the `step` method in LLDB.py to check if we step to a
breakpoint site but have a "step completed" stop reason -- in which case
we have this new breakpoint behavior, and we need to step a second time
to actually hit the breakpoint like the debuginfo tests expect.
2024-09-11 16:09:48 -07:00
Stephen Tozer
57dc09341e
[Dexter] Sanitize user details from git repo URL in dexter --version (#105533)
Currently the output of dexter --version contains the raw output of `git
remote get-url origin`, which may contain a username and password. This
patch adds a small change to remove these from the output string. A
similar patch for LLVM's default version string* also removes the git
URL altogether unless opted-in to; it's not clear whether this is a
necessary or desirable step yet, but if so we can trivially remove the
URL from Dexter as well.

*PR here: https://github.com/llvm/llvm-project/pull/105220
2024-08-22 10:56:28 +01:00
David Blaikie
1c9a81b2bd Fix gdb pretty printers for libSupport
Remove the testing for std::optional - it was originally for
llvm::Optional, but now that that doesn't exist and we use
std::optional, testing for that pretty printer should live, wherever the
pretty printer lives, not here in LLVM.

And the PointerIntPair pretty printer bit rotted due to changes in
PointerIntPair, 875391728c11339c8a6cd3338bcaa5ec0ffc2496.
2024-06-19 05:50:08 +00:00
Orlando Cazalet-Hyams
832b91fcb9
[dexter] Correctly identify stop-reason while driving VisualStudio (#94754)
Prior to this patch VisualStudio._get_step_info incorrectly identifies
the reason the debugger has stopped. e.g., stepping through a program
would be reported as a StopReason.Breakpoint rather than
StopReason.Step.

Fix. No test added as there are no VisualStudio tests (tested locally).
2024-06-10 08:47:39 +01:00
Jonas Devlieghere
70550cd6aa
[x-project tests] Fix ambiguity in call to createStringError (NFC)
Fixes:

  https://lab.llvm.org/buildbot/#/builders/139/builds/66928/
  https://lab.llvm.org/buildbot/#/builders/216/builds/40166/
2024-06-05 11:05:33 -07:00
Jay Foad
1650f1b3d7
Fix typo "indicies" (#92232) 2024-05-15 13:10:16 +01:00
Jie Fu
63a2969301 [cross-project-tests] Update code to use mlir::cast (NFC)
/llvm-project/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:41:16:
 error: 'cast' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
    VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f});
               ^
/llvm-project/llvm/../mlir/include/mlir/IR/Types.h:345:9: note: 'cast' has been explicitly marked deprecated here
U Type::cast() const {
        ^
/llvm-project/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:41:16:
 error: 'cast<mlir::ShapedType>' is deprecated: Use mlir::cast<U>() instead [-Werror,-Wdeprecated-declarations]
    VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f});
               ^
/llvm-project/llvm/../mlir/include/mlir/IR/Types.h:112:5: note: 'cast<mlir::ShapedType>' has been explicitly marked deprecated here
  [[deprecated("Use mlir::cast<U>() instead")]]
    ^
2 errors generated.
2024-05-01 10:28:29 +08:00
Stephen Tozer
4b5b7eca0e
[Dexter] Add VisualStudio2022 support to Dexter (#85248)
Dexter currently supports Visual Studio 2015/2017/2019, but not 2022;
this patch adds support for 2022.
2024-03-14 18:10:14 +00:00
dyung
5a744776bb
Mark test as XFAIL that started failing after 418f0066eb. (#85027)
Similar failures were previously seen and XFAILed in
https://reviews.llvm.org/D118468.

See the phabricator review for a description of the problem, and the
linked discourse thread for what the failing output looks like.

This change should fix the issue on two buildbots that are running older
versions of GDB:
- https://lab.llvm.org/buildbot/#/builders/217/builds/37559
- https://lab.llvm.org/buildbot/#/builders/247/builds/15173
2024-03-13 11:10:03 +00:00
Adrian Prantl
64111831ed Relax test to work with newer versions of lldb 2024-03-12 17:01:15 -07:00
Adrian Prantl
418f0066eb Modernize llgdb script and make it easier to debug. 2024-03-12 16:12:19 -07:00
Adrian Prantl
422d240dc9 Relax tests to also work with newer versions of lldb.
- result variables are optional
- static members may print their values
- public/protected shows up in ptype output
2024-03-12 16:12:19 -07:00
Adrian Prantl
536e0ebaaa Remove XFAIL from tests passing on green dragon 2024-03-12 11:06:23 -07:00
dyung
69b8bc7111
[Dexter] Extend XFAIL of Dexter tests to all MacOS architectures. (#83936)
I am trying to bring up a MacOS buildbot targeting x86 and noticed that
two Dexter tests were failing,
cross-project-tests/debuginfo-tests/llgdb-tests/static-member.cpp and
cross-project-tests/debuginfo-tests/llgdb-tests/static-member-2.cpp.
Looking in the history for these tests, they were XFAILed for Apple
Silicon in 9c46606 and are failing similar on x86 for me, so we should extend
the XFAIL to all MacOS architectures.
2024-03-07 17:43:12 -05:00
Stephen Tozer
e1c0e7e515
[Dexter] Set ShouldBuild=false for Visual Studio solutions (#75045)
Since Dexter no longer intends to build any code, the ShouldBuild
property in any Visual Studio project being run by Dexter should be
false to ensure that a build step is never invoked by Dexter, whether
the project has already been built or not.

Reviewed by: OCHyams
2023-12-11 15:19:40 +00:00
Felipe de Azevedo Piovezan
a8837b49c1
[cross-project-tests] Fix struct-dse example so that it fails again (#73566)
The purpose of this example is to provide a case where the debugger /
debug info experience could be improved. A recent commit by clang
(0d2860b795879f4dd152963b52f969b53b136899) changed codegen such that it
changes how "small structs" are initialized, in a way that the debugger
is now able to correctly display the variable being targeted by this
test.

In order to keep the example relevant, i.e. failing, this commit makes
it so that the struct is now "big enough" to not trigger the new
codegen.
2023-11-27 13:14:10 -08:00
Ben Mudd
9120e85448 [Dexter] Associate parser errors with correct file (#66765)
Currently if Dexter encounters a parser error with a command, the resulting
error message will refer to the most recently declared file (i.e. the source
file it is testing) rather than the file containing the command itself. This
patch fixes this so that parser errors point towards the correct location.
2023-09-19 14:16:17 +01:00
Shubham Sandeep Rastogi
0d0ab7600f Fix Dexter test broken with e6cc7b723f244f52663b6d67a5d94597109da1ef 2023-09-14 09:34:02 -07:00
Shubham Sandeep Rastogi
e6cc7b723f
[Dexter] Fix test failures on greendragon (#66299)
The issue with these test failures is that the dSYM was not being found
by lldb, which is why setting breakpoints was failing and lldb quit
without performing any steps. This change copies the dSYM to the same
temp directory that the executable is copied to.
2023-09-14 09:28:47 -07:00
Douglas Yung
0a6f658f97 Fix Dexter test after 37a20cc68f54. Adding the XFAIL line caused the line references to be off.
Should fix https://lab.llvm.org/buildbot/#/builders/216/builds/27001.
2023-09-08 23:34:54 -07:00
Shubham Sandeep Rastogi
37a20cc68f XFAIL dexter tests that broke greendragon.
The patch in https://reviews.llvm.org/D151465 broke greendragon, because
it is hardcoding the use of libstdc++ which is not available on darwin.

XFAILing these tests till they can be fixed.
2023-09-08 15:51:10 -07:00
Christopher Di Bella
4a351ef70a
[cross-project-tests] remove final dexter.builder import (#65653) 2023-09-08 11:47:26 +02:00
Stephen Tozer
43d70e4640 [DebugInfoTests] Mark debuginfo 'optnone-*' tests unsupported on darwin
The optnone tests, following the removal of the Dexter builder in a
prior patch (45a40c16), are experiencing intermittent failures. This
patch marks them unsupported to be fixed in a new commit, rather than
reverting the Dexter patch.
2023-09-06 16:12:04 +01:00
Stephen Tozer
45a40c1639 Re-reapply "[Dexter] Remove builder from Dexter"
This patch makes a further attempt to fix the tests broken by the
previous revision by ensuring that the command line for the modified
Dexter tests use -std=gnu++11, in keeping with the old build script.

This reverts commit 5647f2908de90fe07b0805e988cd2e91a1751928.
2023-09-06 15:06:07 +01:00
Stephen Tozer
5647f2908d Revert "Reapply "[Dexter] Remove builder from Dexter""
Re-application of the Dexter builder removal reversed due to continued
errors on the green dragon LLDB buildbot:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/59716/

Cause of the error is unclear, but it looks as though there is some
unexpected non-determinism in the test failures.

This reverts commit 323270451d8db24f2c816f455b3d8f70f434286d.
2023-09-05 15:18:09 +01:00
Stephen Tozer
323270451d Reapply "[Dexter] Remove builder from Dexter"
Fixes a test which was broken on the green dragon buildbot, and further
failures on the SIE buildbot.

This reverts commit 8df9eff90ff8c79e3e508cce7fec1cd897487069.
2023-09-05 13:59:53 +01:00
Jonas Devlieghere
a902015f54
[lldb] Fix grammar in error message emitted by IRExecutionUnit
The error message "Couldn't lookup symbols" emitted from IRExecutionUnit
is grammatically incorrect. "Lookup" is noun when spelled without a
space. Update the error message to use the verb "look up" instead.
2023-08-24 14:11:30 -07:00
Stephen Tozer
8df9eff90f Revert "[Dexter] Remove builder from Dexter"
& Revert "[Dexter] Fix incorrect substitution errors in clang-cl builder"

This reverts commits 262520a3c5450fd7f149438245b2aef12736347f,
and 0b72b71cd3c8ad824342c05bc6d9d64d87eeb81b.

Failures occurred on two buildbots, the SIE buildbot:
https://lab.llvm.org/buildbot/#/builders/216/builds/26006

And the green dragon buildbot:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/59091

Errors appear to be related to incorrect tool substitution in the Dexter
test commands, and a currently unknown error with one of the general
debuginfo tests that uses Dexter.
2023-08-21 18:06:27 +01:00
Stephen Tozer
0b72b71cd3 [Dexter] Fix incorrect substitution errors in clang-cl builder
Following 262520a3, tests on windows bots began failing due to an incorrect
substitution in the previous patch, where clang-cl was used instead of
clang_cl.

Also fixes an inconsistency in the builders used for some of the tests
in 'dexter-tests', where %clang++ was used for some tests and %clang for
tests that should have identical RUN lines.
2023-08-21 17:21:36 +01:00
Stephen Tozer
262520a3c5 [Dexter] Remove builder from Dexter
See "discussion":
  https://discourse.llvm.org/t/rfc-dexter-feature-removals/60462

This patch removes the builder functionality from Dexter, as it is an active
maintenance burden and is no longer required since Dexter is being invoked by
other test runners that can handle the build step better, and there has been no
objection that it is still needed.

Differential Revision: https://reviews.llvm.org/D151465
2023-08-21 15:08:11 +01:00
Jonas Devlieghere
9c4660629c
[Dexter] XFAIL Dexter tests for Apple Silicon (arm64) 2023-05-26 15:43:20 -07:00
Jonas Devlieghere
7adff65d4a
[Dexter] Don't hardcode x86_64 as the default architecture
Use platform.machine() as the default architecture instead of hardcoding
it to x86_64.
2023-05-26 15:06:58 -07:00
Tobias Hieta
f98ee40f4b
[NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our
Python code. This catches the last of the python files to
reformat. Since they where so few I bunched them together.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: jhenderson, #libc, Mordante, sivachandra

Differential Revision: https://reviews.llvm.org/D150784
2023-05-25 11:17:05 +02:00
Stephen Tozer
ee5617dc71 [Dexter] Add timeout options
Adds a pair of options for Dexter that allow the user to specify a
timeout duration. These options are:

* --timeout-total: Times out if the total run-time of the debugger session
  exceeds <timeout-total> seconds.
* --timeout-breakpoint: Times out if the time without hitting a
  breakpoint exceeds <timeout-breakpoint> seconds.

Reviewed By: Orlando

Differential Revision: https://reviews.llvm.org/D145063
2023-03-22 13:50:00 +00:00
Stephen Tozer
73a01952b5 [Dexter] Add a simple logging class to Dexter
Adds a basic logging class to Dexter that uses the existing PrettyOutput
class for printing and supports 3 levels of verbosity (note, warning,
error). Intended to consolidate the logging logic for Dexter into one
place, removing the need for conditional log statements and making it
easier for us later if we wish to use a more complete logging class.

Reviewed By: Orlando

Differential Revision: https://reviews.llvm.org/D144983
2023-03-15 19:25:37 +00:00