223 Commits

Author SHA1 Message Date
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
Matthias Springer
13c00cbc2a
[mlir][IR] Rename DenseIntOrFPElementsAttr to DenseTypedElementsAttr (#185687)
`DenseIntOrFPElementsAttr` was recently generalized to accept any type
that implement the `DenseElementType` interface. The name
`DenseIntOrFPElementsAttr` does not make sense anymore. This commit
renames the attribute to `DenseTypedElementsAttr`. An alias is kept for
migration purposes. The alias will be removed after some time.
2026-03-13 17:27:23 +01:00
Jonas Devlieghere
d6b32e7dfe
[Dexter] Add missing calls to SBDebugger::{Initialize,Terminate} (#185535)
When using LLDB, the first and last call should be
SBDebugger::Initialize and SBDebugger::Terminate respectively.

While we're resilient against mistakes, I'm adding an assert (#185162)
to debug builds to catch those mistakes in-tree as they have the
potential to leak resources. The assert was tripped by Dexter.

This PR adds the missing calls to SBDebugger::{Initialize,Terminate},
and while I was at it, I also added a missing call to
SBDebugger::Destroy. With that, the Dexter tests pass locally with the
assert enabled.
2026-03-11 08:50:54 -07:00
Carlos Alberto Enciso
bc9d5b01d3
[clang][DebugInfo] Add virtuality call-site target information in DWARF. (#182510)
Given the test case:

  struct CBase {
    virtual void foo();
  };

  void bar(CBase *Base) {
    Base->foo();
  }

and using '-emit-call-site-info' with llc, the following DWARF
is produced for the indirect call 'Base->foo()':

1$: DW_TAG_structure_type "CBase"
      ...
2$:   DW_TAG_subprogram "foo"
        ...

3$: DW_TAG_subprogram "bar"
      ...
4$:   DW_TAG_call_site
        ...

We add DW_AT_LLVM_virtual_call_origin to existing call-site
information, linking indirect calls to the function-declaration
they correspond to.

4$:   DW_TAG_call_site
        ...
        DW_AT_LLVM_virtual_call_origin (2$ "_ZN5CBase3fooEv")

The new attribute DW_AT_LLVM_virtual_call_origin helps to
address the ambiguity to any consumer due to the usage of
DW_AT_call_origin.

The functionality is available to all supported debuggers and
it is generated only for DWARF version 5 or greater.
2026-02-25 05:35:07 +00:00
Paul Kirth
ec8b9ca47d
Revert "[clang][DebugInfo] Add virtuality call-site target informatio… (#182343)
…n in DWARF. (#167666)"

This reverts commit 418ba6e8ae2cde7924388142b8ab90c636d2c21f.

The commit caused an ICE due to hitting unreachable in
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:1307

Fixes #182337
2026-02-19 12:19:11 -08:00
Carlos Alberto Enciso
9fa6eaaf83
[clang][DebugInfo] Add virtuality call-site target information in DWARF. (#182311)
Add missing
  'REQUIRES: x86-registered-target'

to fix buildbot failure:
  https://lab.llvm.org/buildbot/#/builders/190/builds/36803
2026-02-19 16:31:59 +00:00
Carlos Alberto Enciso
418ba6e8ae
[clang][DebugInfo] Add virtuality call-site target information in DWARF. (#167666)
Given the test case:

  struct CBase {
    virtual void foo();
  };

  void bar(CBase *Base) {
    Base->foo();
  }

and using '-emit-call-site-info' with llc, the following DWARF
is produced for the indirect call 'Base->foo()':

1$: DW_TAG_structure_type "CBase"
      ...
2$:   DW_TAG_subprogram "foo"
        ...

3$: DW_TAG_subprogram "bar"
      ...
4$:   DW_TAG_call_site
        ...

We add DW_AT_LLVM_virtual_call_origin to existing call-site
information, linking indirect calls to the function-declaration
they correspond to.

4$:   DW_TAG_call_site
        ...
        DW_AT_LLVM_virtual_call_origin (2$ "_ZN5CBase3fooEv")

The new attribute DW_AT_LLVM_virtual_call_origin helps to
address the ambiguity to any consumer due to the usage of
DW_AT_call_origin.

The functionality is available to all supported debuggers.
2026-02-19 14:48:59 +00:00
David Stenberg
ddaa590ace
[cross-project-tests] Fix lldb version regex (#180204)
The get_lldb_version_string function in the lit config used a greedy
regex that could, if using a lldb binary built with git revision output,
using a SHA that starts with a digit, result in the first digits of the
SHA being interpreted as the lldb version.

For example, if lldb emits:

    $ lldb --version
    lldb version 23.0.0git \
    (https://github.com/dstenb/llvm-project.git revision \
    7e565729e33d19d468520e7bfbb8b23a918adc9c)

the version would be interpreted as 7 rather than 23.0.0:

    Marking some LLDB LLVM data-formatter tests as unsupported: using
    version 7 whereas a version >= 1900 is required

(That check should compare towards 19.0.0, but that issue is addressed
 in an other patch.)

Resolve this by using a non-greedy matcher.

Also, include a drive-by fix of some typos.
2026-02-12 10:13:25 +01:00
Dunbobbin
5c114d80f8 [TEST][FIX] Fix typo in tool name: 'llvm-ar' 2026-02-11 22:04:01 +00:00
Ben Dunbobbin
5710e418c3
[DTLTO][Windows] Expand short 8.3 form paths in ThinLTO module IDs (#178303)
Windows supports short 8.3 form filenames (e.g. `compile_commands.json`
-> `COMPIL~1.JSO`) for legacy reasons. See:
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names.

Short 8.3 form paths are undesirable in distributed compilation
scenarios because they are local mappings tied to a specific directory
layout on a specific machine. As a result, they can break or defeat
sandboxing and path-based isolation mechanisms used by distributed build
systems.

We have observed such failures with DTLTO even in simple scenarios. For
example, on Windows, running:

```
clang.exe hello.c -flto=thin -fuse-ld=lld -fthinlto-distributor=fastbuild.exe -###
```

on my development machine reveals a short 8.3 form path being passed to
LLD (output paraphrased):

```
ld.lld -o a.out -plugin-opt=thinlto --thinlto-distributor=fastbuild.exe \
    --thinlto-remote-compiler=clang.exe C:\Users\DUNBOB~1\AppData\Local\Temp\hello-380d65.o
```

This behavior occurs because, on Windows, the system temporary directory
is commonly derived from the `TMP`/`TEMP` environment variables. For
historical compatibility reasons, these variables are often set to short
8.3 form paths, particularly on systems where user names exceed eight
characters.

Whilst it's possible for users to work around these issues, in practice,
especially in automated and CI environments, users often have limited
control over their environment.

DTLTO generally tries to avoid embedding distribution-specific logic in
the LLVM source tree, and this principle also applies to path
normalization. However, on Windows, such short 8.3 form paths are
undesirable for any distribution system. This normalization also cannot
be delegated to distributors, as the ThinLTO module ID must be finalized
early during LTO and cannot be modified later.

Given this, normalizing away short 8.3 paths on Windows is a pragmatic,
targeted improvement, even though path normalization is not something a
toolchain would typically perform in the general case.

SIE internal tracker: TOOLCHAIN-19185
2026-02-11 21:20:25 +00:00
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