4185 Commits

Author SHA1 Message Date
Jonas Devlieghere
b9d276748e
[lldb] Support arm64e Objective-C signing in the expression evaluator (#187765)
When targeting arm64e, ISA pointers, class_ro_t pointers, and interface
selectors are signed in Objective-C. This PR adds support for that in
the expression evaluator.
2026-03-21 00:50:16 +00:00
Dave Lee
7a5431eee3
[lldb][bytecode] Fix Update() and failing test (#187795)
Fixes a breakage from https://github.com/llvm/llvm-project/pull/182155
2026-03-20 15:27:34 -07:00
Jonas Devlieghere
2b78c71cb5
[lldb] Support -fptrauth-indirect-gotos in the expression evaluator (#187562)
When targeting arm64e, we enable `-fptrauth-indirect-gotos` by default,
which signs label addresses and authenticates indirect branches. Add
support (and a test) for this in the LLDB expression evaluator.
2026-03-20 16:58:30 -05:00
Jonas Devlieghere
9b30151594
[lldb] Support PointerAuthAuthTraps in the expression evaluator (#187612)
Enable and test PointerAuthAuthTraps, which ensures that we trap after
an authentication failures.
2026-03-20 16:29:25 -05:00
Stefan Gränitz
39d6bb2180
[lldb] Add HTTP support in SymbolLocatorSymStore (#186986)
The initial version of SymbolLocatorSymStore supported servers only on
local paths. This patch extends it to HTTP/HTTPS end-points. For that to
work on Windows, we add a WinHTTP-based HTTP client backend in LLVM next
to the existing CURL-based implementation.

We don't add a HTTP server implementation, because there is no use right
now. Test coverage for the LLVM part is built on llvm-debuginfod-find
and works server-less, since it checks textual output of request
headers. The existing CURL-based implementation uses the same approach.
The LLDB API test for the specific SymbolLocatorSymStore feature spawns
a HTTP server from Python.

To keep the size of this patch within reasonable limits, the initial
implementation of the SymbolLocatorSymStore feature is dump: There is no
caching, no verification of downloaded files and no protection against
file corruptions. We use a local implementation of LLVM's
HTTPResponseHandler, but should think about extracting and reusing
Debuginfod's StreamedHTTPResponseHandler in the future.

The goal of this patch is a basic working implementation that is
testable in isolation. We will iterate on it to improve it further. This
should be fine since downloading from SymStores is not default-enabled
yet. Users have to set their server URLs explicitly.

---------

Co-authored-by: Alexandre Ganea <aganea@havenstudios.com>
2026-03-20 12:47:45 +01:00
Jonas Devlieghere
4f298d4efa
[lldb] Support arm64e in the expression evaluator (#186001)
This PR upstreams support for PtrAuth in the LLDB expression evaluator.
It's a rebased version of an older patch in the Swiftlang repo
(https://github.com/swiftlang/llvm-project/pull/5012) but adapted to not
rely on `GlobalPtrAuthInfo.h`. I followed Anton's advice, and instead of
iterating over all globals and hack on wrappers, the pass now iterates
over all global uses and fixes up ConstantPtrAuth expressions if any.

This is one of the last large chunks of downstream PtrAuth code in LLDB,
and the primary blocker for running the LLDB test suite in arm64e mode
on Apple Silicon, which I'd really like to make the default in the
future.
2026-03-19 13:01:18 -05:00
Jason Molenda
e405a11957
[lldb][debugserver] Get the size of the shared cache in mapped VM (#187419)
Fetch the size of the shared cache address range in VM in the inferior
process and return it, if possible. This allows for a simple call to
DynamicLoader::GetSharedCacheInformation to get the virtual address
extent of the shared cache in the inferior. It's a minor addition to the
method that fetches the shared cache filepath from the inferior, plus
piping it up through lldb's layers.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-03-19 10:41:57 -07:00
John Harrison
e9799e51ed
[lldb-dap] Improve support for variables with anonymous fields and types (#186482)
While looking at the '[raw]' value of a std::vector I noticed we didn't
handle the anonymous inner struct very well. The 'evaluateName' was
incorrect (e.g. the evaluateName would return `<var>.` for the anonymous
struct).

This improves support for variables with anonymous fields and anonymous
types.

* Changed the name of anonymous fields from `<null>` to `(anonymous)`,
which matches other tooling like clangd's representation and how types
are presented if the field is not defined.
* Adjusts variables to not return an 'evaluateName' for anonymous
fields.
* Adjusted '[raw]' values to be marked as 'internal' which deemphasizes
them in the UI.

While working in this area, I also consolidated some helpers that are
only used within Variables.cpp.

Before my changes:
<img width="513" height="460" alt="before"
src="https://github.com/user-attachments/assets/3da0aada-8ba3-415d-bbec-56b41a9b9415"
/>

After my changes:
<img width="414" height="467" alt="after"
src="https://github.com/user-attachments/assets/66a47108-ee44-4e01-8eab-e89edb348fde"
/>
2026-03-18 11:39:22 -07:00
Steven Wu
480eba33e2
[lldb][PrefixMap] follow up fixes to #187145 (#187337)
Fix and improve #187145 for following issues:
* Fix unhandled error.
* Align the log type with the file where it contains.
* The added test doesn't work on windows host for remote debugging, add
  decorator to skip when host and target do not match.
2026-03-18 11:32:41 -07:00
Steven Wu
1b8db068ed
[PrefixMap] Teach lldb to auto-load compilation-prefix-map.json (#187145)
Add a LoadCompilationPrefixMap() helper in SymbolFile::FindPlugin that
walks up from the symbol file's directory looking for a
compilation-prefix-map.json file. When found, each key→value entry is
applied to the module's source path mapping list, allowing LLDB to
resolve source file paths that were rewritten by -fdebug-prefix-map at
build time without requiring manual `settings set target.source-map`.

The JSON file format maps fake paths (as written into debug info) back
to their real on-disk counterparts:
  { "/fake/srcdir": "/real/srcdir" }

Directory results are cached so the filesystem is walked at most once
per unique directory across all modules loaded in a session.

Also apply the module's source path remappings in
SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex when constructing
compile units from N_SO stabs. This mirrors what MakeAbsoluteAndRemap
does for the dSYM case so that fake paths baked into the debug map are
transparently resolved to real paths.

rdar://84824567

Assisted-By: Claude
2026-03-18 09:11:28 -07:00
Dmitry Vasilyev
fd47fbe87e
[lldb] Do not use mkdir -p in makefile on Windows (#187244)
`Make` uses systems's `mkdir` on Windows even if Git's mkdir.exe is
present in PATH. Windows's mkdir does not support the parameter `-p` and
creates the directory `-p` instead. Few other tests also use `mkdir -p`
but they are linux, objc or macosx related.

---------

Co-authored-by: Charles Zablit <c_zablit@apple.com>
2026-03-18 16:05:25 +04:00
Stefan Gränitz
23a0c9f558
[lldb] Skip file cleanup to avoid permission issue in API test (#187227)
Deleting anything in the build directory of a test-case is causing an
issue on one of the Windows bots. After the previous attempts in
ca15db1cd509c236cd8138bcd098117d0106db56 and
fdd2437af3cdc6d5fe199fcc9d991ccf503b55bd didn't help, we now skip the
file cleanup altogether.
2026-03-18 10:03:10 +00:00
Stefan Gränitz
fdd2437af3
[lldb] Avoid permission issue in API test with SHARED_BUILD_TESTCASE (#187072)
Deleting the inferior binary after an API test-case causes issues on one
of the Windows bots. The previous the fix attempt in ca15db1cd509c236
didn't succeed. We have to use isolated subfolders for each test-case.
This is achieved easily by disabling SHARED_BUILD_TESTCASE.
2026-03-18 09:20:25 +01:00
Sergei Druzhkov
7899b26e88
[lldb-dap] Allow expressions in setVariable request (#185611)
This paths allows expressions in `setVariable` request. It is small
extension of original semantics from DAP specification. DAP has
`setExpression` request to this purpose, but it is too general. So I
prefer to keep this simple solution.
2026-03-18 10:19:46 +03:00
Jonas Devlieghere
cbedaa83e1
[lldb] Upstream arm64e support in ValueObject (#186906)
In #186001, I said the last large chunk of downstream PtrAuth code in
LLDB was the expression evaluator support. However, that wasn't
accurate, as we also have changes to thread this through ValueObject.
2026-03-17 14:27:35 -07:00
Stefan Gränitz
ca15db1cd5
[lldb] Fix permission issue in API test on lldb-x86_64-win (#187021)
Deleting the executable at the end of this API test-case fails with a
permission error, likely because lldb still holds a reference to the
EXE. Exit explicitly to avoid that.
2026-03-17 15:50:59 +01:00
Ilia Kuklin
9f4fbe86a5
[lldb] Add pointer arithmetics for addition and subtraction to DIL (#184652) 2026-03-17 18:10:29 +05:00
Charles Zablit
2b5e302627
[lldb][windows] fix TestReplaceDLL.py reruns (#187002) 2026-03-17 12:40:28 +00:00
Stefan Gränitz
7c2aef4b58
Reland "[lldb] Initial plugin and test for SymbolLocatorSymStore" (#185658)
Minimal infrastructure for a the SymbolLocator plugin that fetches debug
info from Microsoft SymStore repositories. This can work cross-platform
and for various debug info formats in principle, but the current plan is
focussed on PE/COFF on Windows with debug info in PDB files. Once we
have a stable first version, we'd like to add features like download,
environment variables, caching and progress feedback for users.

SymbolVendorPECOFF was tailored towards DWARF debug info so far. I added
code to load the PDB path from the executable (it only checked
gnu_debuglink so far) and not bail out if DWARF sections are missing, so
that in the PDB case we still call AddSymbolFileRepresentation() in the
very end of CreateInstance().

The API test in this patch mocks the directory layout from SymStore, so
it doesn't depend on SymStore.exe from the Windows SDK. It runs on all
platforms that link debug info in a PDB file, which is still just
Windows, but it could be cross-platform in principle.

-----

Relands with minor fixes: API tests create mocked SymStore in the test's
build directory. One log instruction was moved. One more object
access goes through module in SymbolFile.
2026-03-17 09:30:25 +01:00
Nerixyz
58d34e2e02
[lldb] Include stdio.h in synthetic subscript test (#186847)
The [lldb-aarch64-windows](https://lab.llvm.org/buildbot/#/builders/141)
buildbot failed with:

```
lld-link: error: undefined symbol: printf
>>> referenced by main.o:(main)
```

I'm assuming that's because of the use of `__builtin_printf`. In other
tests, we use `printf` form `stdio.h` and these build fine, so I added
an include and used `printf`.
2026-03-16 18:54:44 +01:00
Sergei Druzhkov
fa40c361fc
[lldb-dap] Mark return value as readonly (#186329)
Marked return value as readonly to give VS Code a hint that this
variable doesn't support `setVariable` request.
2026-03-16 12:43:47 +03:00
Jonas Devlieghere
f002fc0ee8
[lldb] Skip tests that are incompatible with MTE (#186043)
Skip tests that are incompatible with MTE. 

Depends on:
- https://github.com/llvm/llvm-project/pull/185780
2026-03-14 11:19:26 -07:00
John Harrison
bb93279edf
[lldb-dap] Fix a regression in synthetic variables. (#186180)
In PR#183176 there was a regression mixing up `GetSyntheticValue` and
`GetNonSyntheticValue` that results in `[raw]` variables not correctly
representing the underlying value.

Addressing this regression and adjusting the naming of a few helpers to
better match existing naming styles in lldb.
2026-03-13 09:39:47 -07:00
Charles Zablit
681f1a5ee9
[lldb][windows] print stop reason if MSVC's runtime check fails (#185473)
This patch extracts the `msg` value of the `failwithmessage` error and
uses it as the stop reason if the MSVC Runtime fails while debugging.

# Before
```
lldb.exe C:\Users\charleszablit\Developer\testing\uninit.exe -b -o 'r'
(lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\uninit.exe"
Current executable set to 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64).
(lldb) r
Process 9400 launched: 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64)
Process 9400 stopped
* thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ff96516c96a
       frame #0: 0x00007ff77efe20ba uninit.exe`failwithmessage(retaddr=0x00007ff77efe150f, crttype=1, errnum=3, msg="The variable 'x' is being used without being initialized.") at error.cpp:210
```

# After
```
lldb.exe C:\Users\charleszablit\Developer\testing\uninit.exe -b -o 'r'
(lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\uninit.exe"
Current executable set to 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64).
(lldb) r
Process 9400 launched: 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64)
Process 9400 stopped
* thread #1, stop reason = Run-time check failure: The variable 'x' is being used without being initialized.
       frame #0: 0x00007ff77efe20ba uninit.exe`failwithmessage(retaddr=0x00007ff77efe150f, crttype=1, errnum=3, msg="The variable 'x' is being used without being initialized.") at error.cpp:210
```


fix https://github.com/llvm/llvm-project/issues/184990.

rdar://172103284
2026-03-13 15:36:51 +00:00
Jonas Devlieghere
1fa7051d82
[lldb] Update TestObjcOptimized.py for MTE (#186042)
Use process.FixAddress to strip the top byte when running under MTE.
2026-03-12 14:10:40 -07:00
eleviant
18023b94be
[lldb][tests] Skip flaky TestLongjmp test on Windows (#186199) 2026-03-12 18:52:27 +01:00
Jonas Devlieghere
643969e780
[lldb] Run the LLDB test suite under MTE on capable Apple HW (#185780)
This PR adds support for running the LLDB test suite under MTE. It's
enabled by default on capable hardware when asserts are enabled. It
relies on a launcher (#185921) which launches the process with the
appropriate posix_spawn attribute. One thing worth noting here is that
child processes inherit the MTE property, so binaries launched by the
test suite in this mode also run under MTE.

Besides the logic to detect the default and thread through the launcher,
I also had to make a small change to LLVM LIT's `ToolSubst` class to
support an optional launcher for the shell tests.
2026-03-12 09:24:15 -07:00
Jonas Devlieghere
6c217bb771
[lldb] Update TestProcessCrashInfo for MTE (#185808)
With MTE, the issue is caught by hardware and libmalloc records a
different message: "BUG IN CLIENT OF LIBMALLOC: MTE tag mismatch
(probable double-free)". Update the test accordingly.
2026-03-11 16:33:08 -07:00
Jonas Devlieghere
85bdc271e5
[lldb] Use SBProcess.FixAddress in address_ranges_helper.py (#185802)
Use `SBProcess.FixAddress` in `address_ranges_helper.py` to support
arm64e and ARM's Memory Tagging Extension (MTE) which rely on TBI to
encode data in the top byte, which in this mode is ignored by the HW.

This fixes TestFindInMemory.py and TestFindRangesInMemory.py when
running the LLDB test suite with MTE.
2026-03-11 16:32:15 -07:00
eleviant
1dd445ca3b
[lldb][tests] Attempt to fix lldb-x86_64-win builder (#185948) 2026-03-11 19:13:34 +01:00
David Spickett
bc9357196a
[lldb][test] Remove Windows xfail from 2 tests in TestLongjmp.py (#185859)
Started passing when #185464 landed.

https://lab.llvm.org/buildbot/#/builders/211/builds/6880

UNEXPECTED SUCCESS: test_step_back_out_dwarf
(TestLongjmp.LongjmpTestCase.test_step_back_out_dwarf)
Test stepping when the inferior calls setjmp/longjmp, in particular,
thread step-out after thread step-in.
UNEXPECTED SUCCESS: test_step_out_dwarf
(TestLongjmp.LongjmpTestCase.test_step_out_dwarf)
Test stepping when the inferior calls setjmp/longjmp, in particular,
thread step-out.

(test_step_over is still expectedly failing)
2026-03-11 11:20:39 +00:00
Charles Zablit
a1c59724d2
[lldb] change how unsupported tests are aggregated (#185675) 2026-03-11 10:51:09 +00:00
Dave Lee
a585f4566f
[lldb] Make date test handle host-target time difference (#185759)
It seems there may be a formatter bug when there's a time zone
difference between the target machine being debugged, and the host the
debugger is running on.
2026-03-10 14:36:30 -07:00
eleviant
1383dd8dbe
[lldb][test] Fix TestLongjmp on Linux (#185464)
Patch fixes llvm.org/pr20231.
The original test was expecting clock() to return 0 when stepping in
debugger which in reality can never happen.
2026-03-10 16:22:27 +01:00
Jonas Devlieghere
c182ca3e3a
[lldb] Assert & fix missing calls to UnregisterPlugin (#185162)
Fix missing calls to UnregisterPlugin and add an assert in the
PluginManager that ensures all plugins have been unregistered by the
time the plugin manager is destroyed.
2026-03-09 13:04:08 -07:00
Adrian Prantl
70509b5e19
[LLDB] Allow one-line summaries in the presence of synthetic child providers (#184926)
This is driven by the Swift language. In Swift many data types such as
Int, and String are structs, and LLDB provides summary formatters and
synthetic child providers for them. For String, for example, a summary
formatter pulls out the string data from the implementation, while a
synthetic child provider hides the implementation details from users, so
strings don't expand their children.

rdar://171646109
2026-03-06 10:07:08 -08:00
Stefan Gränitz
057b7181ab
Revert "[lldb] Initial plugin and test for SymbolLocatorSymStore" (#185032)
Reverts llvm/llvm-project#185004 and llvm/llvm-project#183302
2026-03-06 17:19:37 +01:00
Stefan Gränitz
bc077f52c9
[lldb] Fix lldb-x86_64-win bot after 454eb8bc0ac (#185004)
Attempt to fix forward a test failure after llvm-project#183302,
which seems to be caused by reusing build directories for test
inferiors in LLDB API tests.
2026-03-06 16:22:37 +01:00
Stefan Gränitz
454eb8bc0a
[lldb] Initial plugin and test for SymbolLocatorSymStore (#183302)
Minimal infrastructure for a the SymbolLocator plugin that fetches debug
info from Microsoft SymStore repositories. More features will follow.

SymbolVendorPECOFF was tailored towards DWARF debug info so far. This
patch adds code to load the PDB path from the executable and not bail
out if DWARF sections are missing, so that in the PDB case we still
call `AddSymbolFileRepresentation()` in the very end of
`CreateInstance()`.

The API test in this patch mocks the directory layout from SymStore, so
it doesn't depend on `SymStore.exe` from the Windows SDK. It runs on all
platforms that link debug info in a PDB file, which is still just
Windows, but it could be cross-platform in principle.
2026-03-06 10:07:22 +01:00
Dave Lee
58c5252b28
[lldb] Automatic indexing for synthetic children of collections (#174885)
Synthetic providers for collection types use a child name format of
"[N]".

This `ValueObjectSynthetic` to automatically convert child names in this
convention to the index embedded in the subscript string. With this
change, synthetic formatters for collections will only need to implement
`GetIndexOfChildWithName` or `get_child_index` for non-indexed
collection children. Some examples of non-indexed children are
`$$dereference$$` support, or "hidden" children.

The automatic conversion applies to N values that are less than the
number of children reported by the synthetic provider.
2026-03-05 23:28:22 +00:00
Jim Ingham
ecd6f8c22b Revert "Add the ability to "allow another thread to see the private state" mode. (#184272)"
This reverts commit 97572c1860efeeb97b5940927cee72081b61810a.

This patch seems to cause TestWatchpointCommandPython.py to time out
on the ubuntu buildbots (but nowhere else that I can find so far.)  The
timeout is weird too, the TEST FILE is timing out but the individual
tests aren't being shown and there's no other output.  Grrr...
Anyway I'll revert this and then see if I can do some guessing about
how this change might cause the test to fail.
2026-03-05 12:09:07 -08:00
Jim Ingham
c969b5fe76 Revert "Skip some tests on Windows. They were already expected fail and"
This reverts commit 894408ded44151e4e34a3402210f671355d66310.

These tests were added by 97572c1860efeeb97b5940927cee72081b61810a
and I am reverting that as well.
2026-03-05 12:09:07 -08:00
Jim Ingham
6807b61f4a Fix a bug in the watchpoint callback - in one case we weren't
returning anything from the callback.  Fixing this on the off
chance that is what is causing the linux-only failure in this test
after PR:

https://github.com/llvm/llvm-project/pull/184272
2026-03-05 10:43:50 -08:00
Jim Ingham
894408ded4 Skip some tests on Windows. They were already expected fail and
I needed to use "sleep" so now the test file won't compile.  So
switching to skip...
2026-03-05 10:11:50 -08:00
jimingham
97572c1860
Add the ability to "allow another thread to see the private state" mode. (#184272)
When lldb stops to run a breakpoint condition or other callback that has
to happen between the private stop and returning control to the user, it
will run in the state where the public state is still "running". But if
the callback needs to run lldb commands or python code, it needs to see
the correct "stop" state.

We used to handle that by switching the public state to stopped before
running the callbacks. However, that opened a window where we are still
handling the stop event and another thread would be allowed to continue
the target or do other actions that can interfere with that orderly
process.

This patch adds the ability to designate a particular thread as "seeing
the private state" while all other threads see the "public state". Then
when we run a breakpoint callback, no threads but the one that is
actually running the callback will see the state change until the event
has been delivered to the primary state listener.

It also adds a test that while a long-running breakpoint callback runs,
another thread continues to see the state as running.
2026-03-05 08:17:16 -08:00
John Harrison
6b3f57de0a
[lldb] Skip SBBlock test on Windows. (#184818)
Skipping this test to unblock CI.
2026-03-05 08:12:19 -08:00
Michael Buch
72e68fa73c [lldb][test] TestDataFormatterGenericOptional.py: remove obsolete skipIfs
Clang 7 and GCC 5 are pretty ancient. There's unlikely to be any bot configurations running this anymore. Lets remove it to reduce test noise.
2026-03-05 11:09:30 +00:00
Michael Buch
fcf6bb8f3c [lldb][test] Clean up USE_LIBSTDCPP/USE_LIBCPP usage
This patch makes the two tests consistent with the rest of the formatter API tests (and is in my opionion easier to follow).
2026-03-05 11:07:40 +00:00
jimingham
576c244dc9
Add a test for handling a crashing breakpoint condition (#184247)
I was working on something and broke the handling of breakpoint
conditions that crash. In fixing that I noticed that there wasn't a test
for this scenario, so this PR adds one.

---------

Co-authored-by: Med Ismail Bennani <ismail@bennani.ma>
2026-03-04 16:17:24 -08:00
John Harrison
cee0703cea
[lldb] Fixing the python_api/block tests. (#184647)
Renaming the file to be unique and updating the symbols for Windows.
2026-03-04 16:03:42 -08:00