202 Commits

Author SHA1 Message Date
Michael Buch
33f427c5c0 [cross-project-tests][lldb] Further relax llvm::Expected test assertions
Fixes following error on macOS:
```
CHECK-NEXT: (llvm::SmallVector<int, 2>) value = size=2 {
^
<stdin>:41:65: note: scanning from here
(llvm::Expected<llvm::SmallVector<int, 2> &>) ExpectedVecRef = {
                                                                ^
<stdin>:42:31: note: possible intended match here
 (std::__1::reference_wrapper<llvm::SmallVector<int, 2> >::type) value = size=2 {
```
2026-02-10 11:48:04 +00:00
Michael Buch
92bcff7dc2 [cross-project-tests][lldb] Relax llvm::Expected check
The `CHECK` for `(int)` was too strict. On macOS the type prints as:
```
08:46:24            29: (lldb) v -T ExpectedRef
08:46:24            30: (llvm::Expected<int &>) ExpectedRef = {
08:46:24  next:14'0                                            X error: no match found
08:46:24            31:  (std::__1::reference_wrapper<int>::type) value = 100
08:46:24  next:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:46:24  next:14'1                                         ?                  possible intended match
08:46:24            32: }
08:46:24  next:14'0     ~~
```
2026-02-10 09:15:11 +00:00
Peter Rong
9cd29a8ba1
[DebugInfo] Fix an assertion in DWARFTypePrinter (#178986)
A `DW_TAG_ptr_to_member_type` has no `RawName` and would trigger an
assertion.


7e48b14d1e/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h (L497-L502)

The assertion is mostly benign since it will be compared with other
strings and return false.


7e48b14d1e/llvm/include/llvm/DebugInfo/DWARF/DWARFTypePrinter.h (L505-L510)

But this is blocking our assertion builds.
We should escape `DW_TAG_ptr_to_member_type` as well when looking for
type names.

Adding a test to demonstrate how the assertion could be triggered, and
how we fixed it.

Depends on https://github.com/llvm/llvm-project/pull/180655

[Assisted-by](https://t.ly/Dkjjk): [Claude Opus
4.5](https://www.anthropic.com/news/claude-opus-4-5)
2026-02-10 04:59:53 +00:00
jeffreytan81
d6ae568d58
Fix LLDB data formatter for llvm::Expected<T> with non-reference types (#179294)
This patch fixes LLDB data formatter support for llvm::Expected<T> with
the following changes:

llvm/utils/lldbDataFormatters.py: Fix ExpectedSynthProvider to handle
non-templated storage types (e.g., int, int*). Previously the formatter
only worked with templated storage types like std::reference_wrapper<T>.

cross-project-tests/lit.cfg.py:

Fix get_lldb_version_string() to use locally-built LLDB on non-Darwin
platforms instead of system LLDB
Fix minimum version from "1900" to "19.0.0" (typo in original code)
New test files: Added expected.cpp and expected.test to test the
formatter with Expected<int> and Expected<int*>.

---------

Co-authored-by: Jeffrey Tan <jeffreytan@fb.com>
2026-02-09 19:23:40 -08:00
Rose Hudson
e45ea95dbe
[DTLTO] support distributing bitcode from FatLTO objects (#176928)
We already have code to extract bitcode files from archives so they can
be distributed. Extend this code to extract bitcode from FatLTO objects
too, which otherwise cannot be used with DTLTO.
2026-01-28 17:45:58 +00:00
Ben Dunbobbin
1d74db7e8d
[DTLTO] Make temporary file handling consistent (#176807)
DTLTO emits temporary files to allow distribution of archive member
inputs.

It also emits temporary files from the ThinLTO backend, such as the
index files needed for each distributed ThinLTO backend compilation.

This change brings archive member temporary files into line with those
produced by the ThinLTO backend. They are now emitted in the same
location, warnings are emitted if they cannot be deleted, and they are
cleaned up on abnormal exit (e.g. Ctrl-C). All temporary files are
preserved when --save-temps is specified.

The existing signal-handling test has been extended to cover the full
set of DTLTO temporary files, and a new test has been added to exercise
temporary file handling in normal operation. Additionally, a minimal
test has been added to show the COFF behaviour.

SIE Internal tracker: TOOLCHAIN-21022
2026-01-26 17:55:49 +00:00
Ben Dunbobbin
00fecbcf00
[DTLTO][NFC] Minor cleanups and improvements to DTLTO tests (#177282)
This change makes small, non-functional improvements to the DTLTO test
suite, including:
- Tightening+Regularizing FileCheck match expressions across tests
- Simplifying `signal.test` using more lit macro features
2026-01-22 00:48:31 +00:00
Ben Dunbobbin
663647f1b2
[DTLTO] Fix handling of multi-module bitcode inputs (#174624)
This change fixes two issues when processing multi-module bitcode files
in DTLTO:

1. The DTLTO archive handling code incorrectly uses
getSingleBitcodeModule(), which asserts when the bitcode file contains
more than one module.
2. The temporary file containing the contents of an input archive member
was not emitted for multi-module bitcode files. This was due to
incorrect logic for recording whether a bitcode input contains any
ThinLTO modules. In a typical multi-module bitcode file, the first
module is a ThinLTO module while a subsequent auxiliary module is
non-ThinLTO. When modules are processed in order, the auxiliary module
causes the entire bitcode file to be classified as non-ThinLTO, and the
archive-member emission logic then incorrectly skips it.

In addition, this patch adds a test that verifies that multi-module
bitcode files can be successfully linked with DTLTO. The test reproduces
both issues as they existed prior to this change.

SIE Tracker: TOOLCHAIN-21008
2026-01-15 00:21:01 +00:00
Michael Buch
fc4273f45d [cross-project-tests][formatters] Add test for printing dynamic pointer type in llvm::PointerUnion
Make sure we show the concrete type of the pointer.
2026-01-13 10:47:35 +00:00
Michael Buch
f73f43cf50
[llvm][formatters] Add LLDB formatter for llvm::PointerUnion (#175218)
We make use of the fact that the `PointerUnion` element is a
`PointerIntPair`, for which we have a synthetic provider already. We get
the `Int` portion of the pair (which is the index into the template
parameter pack of the union) to get the active type and the `Pointer`
portion of the pair to get the actual pointer value.

Before:
```
(lldb) (lldb) v -T z_float
(llvm::PointerUnion<Z *, float *>) z_float = {
  (llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> >, 0, Z *, float *>) llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *>, llvm::PointerIntPairInfo<void *, 1, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> > >, 0, Z *, float *> = {
    (llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> >, 1, float *>) llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *>, llvm::PointerIntPairInfo<void *, 1, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> > >, 1, float *> = {
      (llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> >, 2>) llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<Z *, float *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *>, llvm::PointerIntPairInfo<void *, 1, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> > >, 2> = {
        (llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<Z *, float *> >) Val = {...}
      }
    }
  }
}
```

After:
```
(llvm::PointerUnion<Z *, float *>) z_float = {
  (float *) Pointer = 0x000000016fdfebb0
}
```
2026-01-12 15:20:03 +00:00
Benjamin Maxwell
471b7b79ee
Update veclib-sincos.c test checks (NFC) (#175221) 2026-01-09 18:48:52 +00:00
Michael Buch
85f5007ec5 [cross-project-tests][formatters] Remove redundant CHECK statement
See https://github.com/llvm/llvm-project/pull/173238#discussion_r2672090386

On some downstream CI this was flakey because LLDB's `location added to breakpoint` notification would appear after the commands. Simply remove checking for the command for now.
2026-01-08 16:37:48 +00:00
Michael Buch
e471478bad [cross-project-tests][lit] Account for Apple LLDB version in compatibility check
The LLVM release version and Apple LLDB version follow slightly different numbering scheme. Make sure we set the minimum required LLDB version appropriately.

Also refactors the `apple-lldb-pre-1000` feature check to use the same `get_lldb_version_string` method.

Currently this was causing the LLDB LLVM formatters to be skipped on our public macOS CI.
2026-01-08 11:54:13 +00:00
Michael Buch
0b9d07860a Reland "[llvm][formatters] Add LLDB data-formatter for llvm::PointerIntPair"
Reverts a4cc033408fe0a69aad6865ddc7e020d64098f20.

Relanding the original patch as-is, but changing the `__builtin_debugtrap`s to explicitly set breakpoints. Some bots failed to compile the tests when `__builtin_debugtrap` was used.

Also adding `REQUIRES: lldb-formats-compatibility` to the test because some build-bots run the tests with an LLDB version that doesn't support the `FindDirectNestedType` API.

Original commit message:

This patch revives the llvm::PointerIntPair LLDB data-formatter. The previous version was commented out because it relied on expression evaluation and was hence slow/brittle. The formatter in this PR doesn't rely on evaluating expressions.

Drive-by change:
* removes the llvm::PointerUnion formatter which was also commented out. A future version of it will look very different than it does now, so there's no point in keeping it because the diff won't be helpful in a review.
2026-01-07 18:10:46 +00:00
Michael Buch
1c123f7766
[cross-project-tests][formatters] Add a LIT feature that tests for a compatible LLDB version (#174812)
Most of this logic is similar to how we add the
`gdb-clang-incompatibility` attribute.

Some LLVM LLDB formatters will rely on LLDB features not available in
older versions of LLDB. This feature will allow those tests to add a
`REQUIRES: lldb-formatters-compatibility`, which will then mark the test
`UNSUPPORTED` for incompatible LLDB versions. I picked `19.0` pretty
arbitrarily based on when approximately the
`SBType::FindDirectNestedType` API was added to LLDB (which a future
formatter will require).
2026-01-07 18:09:25 +00:00
Michael Buch
8fb7ed7ad6 [cross-project-tests][formatters] Factor out setting the LLDB test options into helper function 2026-01-07 16:27:08 +00:00
Michael Buch
7584db7820
[cross-project-tests] Unset _FORTIFY_SOURCE when building the LLDB formatter tests (#174770)
When building `cross-project-tests` with `_FORTIFY_SOURCE` set, we get
following warnings:
```
In file included from /app/gcc/14.2.0/include/c++/14.2.0/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /app/gcc/14.2.0/include/c++/14.2.0/x86_64-pc-linux-gnu/bits/c++config.h:680,
                 from /app/gcc/14.2.0/include/c++/14.2.0/type_traits:38,
                 from ../include/llvm/ADT/ADL.h:12,
                 from ../include/llvm/ADT/Hashing.h:47,
                 from ../include/llvm/ADT/ArrayRef.h:12,
                 from ../../cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/arrayref.cpp:1:
/usr/include/features.h:381:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  381 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
```

This patch works around this by undefining the macro when compiling the
LLDB formatter tests.

If this ever becomes an issue we could try to detect `_FORTIFY_SOURCE`
and skip the tests if set.
2026-01-07 16:11:04 +00:00
Michael Buch
dd79244d89 [cross-project-tests][formatters] Move LLDB test setup into it's own CMakeLists.txt
Once we start adding more tests, having this in a separate CMakeLists.txt is more maintainable.
2026-01-07 14:13:19 +00:00
Stephen Tozer
11ddbfcb34
[Dexter] Replace DAP "initialized" timeout with a warning (#174198)
Fixes https://github.com/llvm/llvm-project/issues/172893.

In the issue reported above there, it appears that LLDB is hitting a 3s
timeout as part of some CI tests; this patch attempts to fix the issue
by replacing the 3s timeout with a 60s timeout, which should be suitably
long for any CI job (lldb-dap itself will automatically time out after
30s, so this should not be hit unless the process hangs).
2026-01-07 12:38:02 +00:00
Michael Buch
a4cc033408
Revert "[llvm][formatters] Add LLDB data-formatter for llvm::PointerIntPair" (#174673)
Reverts llvm/llvm-project#173261

Some bots were failing with:
```
Step 6 (build-unified-tree) failure: build (failure)
...
2.874 [7103/10/382] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CallingConvEmitter.cpp.o
2.875 [7102/10/383] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeEmitterGen.cpp.o
2.895 [7101/10/384] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenMapTable.cpp.o
2.896 [7100/10/385] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CompressInstEmitter.cpp.o
2.898 [7099/10/386] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CTagsEmitter.cpp.o
2.901 [7098/10/387] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelEmitter.cpp.o
2.905 [7097/10/388] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherEmitter.cpp.o
2.918 [7096/10/389] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherGen.cpp.o
2.920 [7095/10/390] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DecoderTree.cpp.o
2.932 [7094/10/391] Building CXX object projects/cross-project-tests/CMakeFiles/check-lldb-llvm-support-pointer-int-pair.dir/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp.o
FAILED: projects/cross-project-tests/CMakeFiles/check-lldb-llvm-support-pointer-int-pair.dir/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp.o 
/opt/ccache/bin/g++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/abi-test/build/projects/cross-project-tests -I/home/buildbot/buildbot-root/abi-test/llvm/cross-project-tests -I/home/buildbot/buildbot-root/abi-test/build/include -I/home/buildbot/buildbot-root/abi-test/llvm/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -g -O0 -std=c++17 -MD -MT projects/cross-project-tests/CMakeFiles/check-lldb-llvm-support-pointer-int-pair.dir/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp.o -MF projects/cross-project-tests/CMakeFiles/check-lldb-llvm-support-pointer-int-pair.dir/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp.o.d -o projects/cross-project-tests/CMakeFiles/check-lldb-llvm-support-pointer-int-pair.dir/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp.o -c /home/buildbot/buildbot-root/abi-test/llvm/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp
/home/buildbot/buildbot-root/abi-test/llvm/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp: In function ‘int main()’:
/home/buildbot/buildbot-root/abi-test/llvm/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/pointer-int-pair.cpp:25:3: error: ‘__builtin_debugtrap’ was not declared in this scope; did you mean ‘__builtin_trap’?
   25 |   __builtin_debugtrap();
      |   ^~~~~~~~~~~~~~~~~~~
      |   __builtin_trap
2.932 [7094/9/392] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherOpt.cpp.o
2.933 [7094/8/393] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DecoderTableEmitter.cpp.o
2.936 [7094/7/394] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DecoderEmitter.cpp.o
2.937 [7094/6/395] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAEmitter.cpp.o
2.944 [7094/5/396] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o
3.340 [7094/4/397] Building PPCGenTargetFeatures.inc...
3.450 [7094/3/398] Building ARMTargetParserDef.inc...
3.780 [7094/2/399] Building AArch64TargetParserDef.inc...
5.093 [7094/1/400] Building RISCVTargetParserDef.inc...
ninja: build stopped: subcommand failed.
```
2026-01-07 00:36:05 +00:00
Michael Buch
9471f530b7
[llvm][formatters] Add LLDB data-formatter for llvm::PointerIntPair (#173261)
Depends on:
* https://github.com/llvm/llvm-project/pull/173238

(only last commit relevant for review)

This patch revives the `llvm::PointerIntPair` LLDB data-formatter. The
previous version was commented out because it relied on expression
evaluation and was hence slow/brittle. The formatter in this PR doesn't
rely on evaluating expressions.

Drive-by change:
* removes the `llvm::PointerUnion` formatter which was also commented
out. A future version of it will look very different than it does now,
so there's no point in keeping it because the diff won't be helpful in a
review.
2026-01-06 23:28:40 +00:00
Michael Buch
3eeec298e6
[cross-project] Add tests for LLDB data-formatters for llvm::ArrayRef (#173238)
This patch adds the bare-minimum tests for the LLDB `llvm::ArrayRef`
formatters. Since this would be the first LLVM data fromatter test for
LLDB, I wanted to keep the test itself minimal and mainly set up/agree
on the infrastructure (i.e., CMake machinery, etc.).

The setup mimicks that of GDB. The main differences are:
1. the GDB formatter tests put all the test cases in one monolithic test
file, whereas I'm planning on having one test-file per LLVM container.
2. the GDB formatter tests currently only get run if LLVM was built with
debug-info. Not sure we have any build-bots out there running this
configuration. In this patch we rely on just the debug-info from the
LLVM headers (see latest commit). That way the tests get more
consistently run (at least our public macOS buildbot runs the
cross-project-tests in Release+Asserts).
2026-01-06 18:46:22 +00:00
Konstantin Belochapka
b66557d8f8
[DTLTO][ELF][COFF] Add archive support for DTLTO. (#157043)
This patch implements support for handling archive members in DTLTO.
 
Unlike ThinLTO, where archive members are passed as in-memory buffers,
DTLTO requires archive members to be materialized as individual files on
the filesystem.
This is necessary because DTLTO invokes clang externally, which expects
file-based inputs.
To support this, this implementation identifies archive members among
the input files,
saves them to the filesystem, and updates their module_id to match their
file paths.
2025-12-31 00:40:30 -08:00
Ben Dunbobbin
0ecadb0422
[DTLTO] Remove temporary files on abnormal exit, e.g. CTRL-C (#172280)
Ensure that DTLTO temporary files are removed when the
link exits due to CTRL-C or comparable interrupt events.

Fixes: https://github.com/llvm/llvm-project/issues/171778
2025-12-17 10:22:08 +00:00
Stephen Tozer
5446eb9275
[Dexter] Adjust launch sequencing to align closer with DAP spec (#170523)
Following PR #169744 the DAP launch sequencing of Dexter was changed to
complete a launch request/response before performing configuration
steps. This matches LLDB's current behaviour, but is not compatible with
the DAP specification and causes issues interfacing with other
debuggers.

This patch tries to bridge the gap by using a sequencing that is mostly
DAP-compliant while still interfacing correctly with lldb-dap: we send a
launch request first, then perform all configuration steps and send
configurationDone, and then await the launch response. For lldb-dap, we
do not wait for the launch response and may send configuration requests
before it is received, but lldb-dap appears to handle this without
issue. For other debug adapters, the launch request will be ignored
until the configurationDone request is received and responded to, at
which point the launch request will be acted upon and responded to.

As an additional note, the initialized event should be sent after the
initialize response and before the launch request according to the spec,
but as LLDB currently sends it after the launch response Dexter has
avoided checking for it. Since the initialized event is now being sent
after the launch response by LLDB, we can start checking for it earlier
in the sequence as well (though technically the client should receive
the initialized event before it sends the launch request).
2025-12-09 11:32:09 +00:00
Janet Yang
fb18f75343
[lldb-dap] Add breakpoints after debugger initialization in DExTer (#169744)
# Summary
This is a forward fix for test errors from
https://github.com/llvm/llvm-project/pull/163653.

The PR moved debugger initialization outside of
InitializeRequestHandler, and into Launch/AttachRequestHandlers to
support DAP sessions sharing debugger instances for dynamically created
targets. However, DExTer's DAP class seemed to set breakpoints before
the debugger was initialized, which caused the tests to hang waiting for
a breakpoint to hit due to none of the breakpoints getting resolved.

# Tests
```
bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/
```
2025-11-26 18:27:09 -08:00
Michael Buch
e96cc99687
[llvm][DebugInfo] Unwrap template parameters that are typedefs when reconstructing DIE names (#168734)
Depends on: 
* https://github.com/llvm/llvm-project/pull/168725

When compiling with `-glldb`, we repoint the `DW_AT_type` of a DIE to be
a typedef that refers to the `preferred_name`. I.e.,:
```
template <typename T> structure t7;
using t7i = t7<int>;
template <typename T> struct __attribute__((__preferred_name__(t7i))) t7 {};
template <typename... Ts> void f1()

int main() { f1<t7i>(); }
```
would produce following (minified) DWARF:
```
DW_TAG_subprogram
  DW_AT_name      ("_STN|f1|<t7<int> >")
  DW_TAG_template_type_parameter
    DW_AT_type  (0x0000299c "t7i")
...
DW_TAG_typedef
  DW_AT_type      (0x000029a7 "t7<int>")
  DW_AT_name      ("t7i")
```

Note how the `DW_AT_type` of the template parameter is a typedef itself
(instead of the canonical type). The `DWARFTypePrinter` would take the
`DW_AT_name` of this typedef when reconstructing the name of `f1`, so we
would end up with a verifier failure:
```
error: Simplified template DW_AT_name could not be reconstituted:
         original: f1<t7<int> >
    reconstituted: f1<t7i>
```

Fixing this allows us to un-XFAIL the `simplified-template-names.cpp`
test in `cross-project-tests`. Unfortunately this is only tested on
Darwin, where LLDB tuning is the default. AFAIK, there is no other case
where the template parameter type wouldn't be canonical.
2025-11-20 17:49:53 +00:00
Michael Buch
e99c83ff38
[llvm][DebugInfo] Add support for _BitInt in DWARFTypePrinter (#168382)
As of recent, LLVM includes the bit-size as a `DW_AT_bit_size` (and as
part of `DW_AT_name`) of `_BitInt`s in DWARF. This allows us to mark
`_BitInt`s as "reconstitutable" when compiling with
`-gsimple-template-names`. However, before doing so we need to make sure
the `DWARFTypePrinter` can reconstruct template parameter values that
have `_BitInt` type. This patch adds support for printing
`DW_TAG_template_value_parameter`s that have `_BitInt` type. Since
`-gsimple-template-names` only omits template parameters that are `<=
64` bit wide, we don't support `_BitInt`s larger than 64 bits.
2025-11-19 22:57:39 +00:00
Michael Buch
8f91d9f0ac
[cross-project-tests][DebugInfo] Make simplified-template-names test runnable on Darwin (#168725)
The test was failing on Darwin for two reasons:
1. `-fdebug-type-sections` is not a recognized flag on Darwin
2. We fail to reconstitute a name if the template parameter has a type
that has a preferred_name. With LLDB tuning the type of such a parameter
is a typedef, i.e., the preferred name. Without tuning it would be the
canonical type that the typedef (possibly through a chain of typedefs)
points to.

This patch addresses (1) by splitting the `-fdebug-type-sections` tests
into a separate file (and only mark that one `UNSUPPORTED`). Which means
we can at least XFAIL the non-type-sections tests on Darwin.

To fix (2) we might need to make the `DWARFTypePrinter` aware of
non-canonical `DW_AT_type`s of template parameters.
2025-11-19 17:24:22 +00:00
Katya Romanova
beb06eb884
Fixed 2 tests that failed on MacOS (#168482)
1. Fixed 2 DTLTO cache tests that failed on MacOS because input to grep
command is different compared to Windows
2. Removed unneeded comments from  dtlto-cache.ll
2025-11-18 01:24:38 -08:00
John Harrison
9f69321385
Improve error response message parsing for DAP evaluate requests. (#168430)
Updated the evaluate handler to check for DAP ErrorResponse bodies,
which are used to display user errors if a request fails. This was
updated in PR https://github.com/llvm/llvm-project/pull/167720

This should fix https://lab.llvm.org/buildbot/#/builders/163
2025-11-18 00:42:19 -08:00
Katya Romanova
3ee54a6b99
[DTLTO] [LLVM] Initial DTLTO cache implementation (#156433)
This patch implements DTLTO cache. DTLTO cache is implemented the same
way as ThinLTO cache. In fact the same class Cache is used for both of
them.

 Because parameters for codegen are different for DTLTO and ThinLTO
 (DTLTO codegen is done by invoking clang and its codegen parameters are
 not fully synchronized with codegen parameters used by LTO backend).
 The object files generated by DTLTO and ThinLTO might be different and
 shouldn't be mixed. If ThinLTO and DTLTO share the same cache
 directory, the cache file won't interfere with each other.

 I added a couple of test files in cross-project-test/dtlto directory,
 but if more tests are required for initial implementation, I could add
 them.
2025-11-17 04:24:26 -08:00
Matt Arsenault
590ab43e8a
RuntimeLibcalls: Move VectorLibrary handling into TargetOptions (#167996)
This fixes the -fveclib flag getting lost on its way to the backend.

Previously this was its own cl::opt with a random boolean. Move the
flag handling into CommandFlags with other backend ABI-ish options,
and have clang directly set it, rather than forcing it to go through
command line parsing.

Prior to de68181d7f, codegen used TargetLibraryInfo to find the vector
function. Clang has special handling for TargetLibraryInfo, where it
would
directly construct one with the vector library in the pass pipeline.
RuntimeLibcallsInfo currently is not used as an analysis in codegen, and
needs to know the vector library when constructed.

RuntimeLibraryAnalysis could follow the same trick that
TargetLibraryInfo is using in the future, but a lot more boilerplate changes 
are needed to thread that analysis through codegen. Ideally this would come 
from an IR module flag, and nothing would be in TargetOptions. For now, it's 
better for all of these sorts of controls to be consistent.
2025-11-14 11:19:21 -08:00
Sam Parker
1820102167
Wasm fmuladd relaxed (#163177)
Reland #161355, after fixing up the cross-projects-tests for the wasm
simd intrinsics.

Original commit message:
Lower v4f32 and v2f64 fmuladd calls to relaxed_madd instructions.
If we have FP16, then lower v8f16 fmuladds to FMA.

I've introduced an ISD node for fmuladd to maintain the rounding
ambiguity through legalization / combine / isel.
2025-10-13 16:50:53 +01:00
Orlando Cazalet-Hyams
1bd9c1bde3
[Dexter] Allow retries on all dexter tests to avoid lldb-dap flakiness (#161847)
This isn't pretty but should help us keep the bot stable while issues
such as #158306 and #158311 are investigated
2025-10-06 09:56:04 +01:00
Andrew Ng
05d032aea6
[cross-project-tests] Add a couple of missing testing dependencies (#159750)
Added testing dependencies for `llvm-dis` and `obj2yaml`.
2025-09-23 14:55:13 +01:00
Orlando Cazalet-Hyams
af144d582e
[Dexter] llvm-lit: Always log DAP messages to stderr (#158586)
This will help diagnose flaky buildbots. The stderr output is only shown
by lit if the test fails.
2025-09-15 15:38:09 +01:00
Orlando Cazalet-Hyams
e25e25de7d
[Dexter] Add -v to lit dexter substitutions (#158025)
Buildbot cross-project-tests-sie-ubuntu has been flaky after moving to
lldb-dap.

https://lab.llvm.org/buildbot/#/builders/181/builds/27670 - this test
fails for a single run but unfortunately there's not enough output to
diagnose it.

Add `-v` to the substitutions to get as much info as possible out of
failures. Most tests already have -v added manually. If we ever find a
tests needs to specifically run without it we can revert this and add
`-v` manually to tests it's missing from.
2025-09-11 11:25:25 +01:00
Orlando Cazalet-Hyams
97820be5e8
[Dexter] Make lldb-dap _post_step_hook more stable (#157663)
Buildbot cross-project-tests-sie-ubuntu has been unstable recently
(https://lab.llvm.org/buildbot/#/builders/181).

Dexter uses lldb-dap in these tests. Occasionally a one will fail with a
KeyError because of a missing "stackFrames" "source" "path".

I can't reproduce the failure locally, but with PRs #157130 and
#157145 I've got DAP logs from a pass and fail.

In a failure, "path" is missing for a step out of main (off the final brace),
and the passing test has one additional "module" event for libc.so.6.

```
<- {
  "body": {
    "module": {
      "addressRange": "0x7ffff7dd1000",
      "debugInfoSize": "4.9MB",
      "id": "5792732F-7831-58C6-6FB4-F3756458CA24-E46E827D",
      "name": "libc.so.6",
      "path": "/lib/x86_64-linux-gnu/libc.so.6",
      "symbolFilePath": "/usr/lib/debug/.build-id/57/92732f783158c66fb4f3756458ca24e46e827d.debug",
      "symbolStatus": "Symbols loaded."
    },
    "reason": "new"
  },
  "event": "module",
  "seq": 0,
  "type": "event"
}
```

That explains why we get a step that is missing a "path" component in the
failure. I don't understand why LLDB (or LLDB-DAP) is sometimes unable to load
the module (in time?). But "path" is an optional field anyway, so I think it's
worth handling in dexter even if LLDB's behaviour here is confusing.

This commit should stabilize the bot if the only time a module goes missing is
for steps outside main. (Ideally none would go missing, but those shouldn't
interfere with the tests).
2025-09-09 14:35:35 +00:00
Orlando Cazalet-Hyams
4aa59f550a
Revert "[Dexter] llvm-lit: always log DAP messages" (#157679)
Reverts llvm/llvm-project#157145

This was just temporary to help debug a flaky bot
2025-09-09 14:22:04 +00:00
Orlando Cazalet-Hyams
9a9c635347
Revert "[Dexter] Temporarily print DAP logs on specific exception" (#157677)
Reverts llvm/llvm-project#157130

This was just a temporary change to investigate a flaky bot failure
2025-09-09 14:19:03 +00:00
Orlando Cazalet-Hyams
5341e267fb
[Dexter] Temporarily print DAP logs on specific exception (#157130)
Buildbot cross-project-tests-sie-ubuntu sees sporadic test failures due to
missing "stackTrace" "source" "path". The "path" field is optional for
"source" according to DAP, so it's well formed. It works most of the time,
and doesn't consistently fail for any one test which is all strangely
inconsistent.

The failures couldn't be reproduced locally after running the feature_tests
in a loop for 3 hours. I haven't been able to work out why the "source" is
sometimes missing by just looking at LLDB code.

This patch prints the DAP log to stderr when the specific error condition is
hit, to help us understand why LLDB is sometimes getting into this state.

Dump additional context from FileCheck so this can be seen on the bots (on
a failure).

This patch will be reverted once we've collected some logs.
2025-09-08 10:53:54 +00:00
Orlando Cazalet-Hyams
a20fc93a65
[Dexter] llvm-lit: always log DAP messages (#157145)
Buildbot cross-project-tests-sie-ubuntu sees sporadic test failures due to
missing "stackTrace" "source" "path". The "path" field is optional for
"source" according to DAP, so it's well formed. It works most of the time,
and doesn't consistently fail for any one test which is all strangely
inconsistent.

The failures couldn't be reproduced locally after running the feature_tests
in a loop for 3 hours. I haven't been able to work out why the "source" is
sometimes missing by just looking at LLDB code.

With this patch, we might be able to get clues about the flaky tests with
well timed log inspection.
2025-09-08 10:10:39 +01:00
Orlando Cazalet-Hyams
3ec7b895be
[Dexter] Only increment step index if we record the step (#156832)
Prior to this patch we incremented step_index every time the debugger
stopped. Now that some stops are not recorded, we should only increment
the step_index for those that are.

This should make the `-v` output more consistent between platforms and
debuggers.
2025-09-04 10:17:57 +01:00
Stephen Tozer
dc05c5dd12
[Dexter] Use continue when resuming lldb execution to reach breakpoint (#156481)
Currently, Dexter's interface for lldb and lldb-dap has a post-step hook
that checks to see whether lldb reports that we stopped because we
completed a step, and if so checks to see whether the current $pc
address also matches a known breakpoint whose conditions (if any) are
met, and if so it requests to "step in", so that we "resume" execution,
stopping again at the current address, such that lldb now reports that
we have hit a breakpoint and provides the list of breakpoints that were
hit.

This logic has a flaw however: the call to "step in" sets an implicit
breakpoint on the next line. In Dexter's default stepping mode this is
not an issue, as we intend to step there eventually. When we use
DexContinue, however, we set a breakpoint from which we wish to continue
to the next user-specified breakpoint, rather than stepping. Currently,
there is a bug where Dexter sets a DexContinue breakpoint, arrives at
that bp from a step, requests "step in" so that LLDB gives us the hit
breakpoint ID, requests "continue" to hit the next user breakpoint, and
then arrives at the next line after the continue due to the earlier
"step in" request. This effectively negates the DexContinue command.

This patch fixes this behaviour by using "continue" instead of "step in"
in the post-step hook, ensuring that no implicit breakpoint is set so
that we do not incorrectly stop at the next line.
2025-09-03 13:19:06 +01:00
Orlando Cazalet-Hyams
d7d8703262
[Dexter] Implement DexStepFunction and DexContinue (#152721)
Adding together in a single commit as their implementations are linked.

Only supported for DAP debuggers. These two commands make it a bit easier to
drive dexter: DexStepFunction tells dexter to step-next though a function and
DexContinue tells dexter to continue (run free) from one breakpoint to another
within the current DexStepFunction function.

When the DexStepFunction function breakpoint is triggered, dexter sets an
instruction breakpoint at the return-address. This is so that stepping can
resume in any other DexStepFunctions deeps in the call stack.
2025-09-01 09:56:56 +01:00
Stephen Tozer
75b812e130
[Dexter] Update Dexter lit substitutions, making lldb-dap the default (#155838)
This patch updates Dexter's lit test setup, making lldb-dap the default
debugger where available; as part of this, I've replaced references to
`--debugger lldb` with new substitutions that provide the debugger and
executable path: one substitution returns just lldb for the tests that
require it (all the LLDB-using tests in `dexter-tests`), and the other
which provides the system-preferred debugger for the tests that should
be able to run with any debugger (all the tests in `feature_tests`).

As a small note, one test generates output that differs between lldb and
lldb-dap - for this test specifically, we add an lldb-dap feature so
that it can be marked XFAIL if we fall back to using LLDB.
2025-08-29 14:28:17 +01:00
Orlando Cazalet-Hyams
e2dcb8b7a5
[Dexter] Add DexStepFunction and DexContinue skeletons (#152720) 2025-08-27 18:03:48 +01:00
Orlando Cazalet-Hyams
ab459c47d3
[Dexter] add get_pc (#152719) 2025-08-27 17:03:29 +01:00
Orlando Cazalet-Hyams
3bc05d4667
[Dexter] Add DAP instruction and function breakpoint handling (#152718)
Add `add_function_breakpoint` and `add_instruction_breakpoint` to DebuggerBase.

Add implementations for DAP-based debuggers.
2025-08-27 14:34:13 +01:00