33844 Commits

Author SHA1 Message Date
Charles Zablit
8d34f2851f
[lldb-dap][windows] add --check-python command (#180784)
Implement [`[RFC] Add a Python check command to lldb-dap and
lldb`](https://discourse.llvm.org/t/rfc-add-a-python-check-command-to-lldb-dap-and-lldb/88972).

This patch adds the `--check-python` flag to `lldb-dap` on Windows, to
allow dap clients to verify the correct Python version is available
before trying to start `lldb-dap`.

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

rdar://165442474
2026-02-11 18:48:31 +01:00
Dave Lee
52bcdc6ad1
[lldb] Implement bytecode based SyntheticChildren (#179832)
Initial implementation of a [bytecode][1] synthetic provider. This is a follow up to
https://github.com/llvm/llvm-project/pull/114333 which implemented the bytecode
interpreter, support for summary formatters, and more.

rdar://169727764

[1]: https://lldb.llvm.org/resources/formatterbytecode.html
2026-02-11 09:43:59 -08:00
David Spickett
a2149815cc
[lldb] Move parts of OutputFormattedUsageText into utility function (#180947)
As seen in #177570, this code has a bunch of corner cases, does not
handle ANSI codes properly and does not handle unicode at all. That's
enough to fix that we need some tests to make it clear where we're
starting from.

The body of OutputFormattedUsageText is moved into a utility in the
AnsiTerminal.h header and tests added to the existing
AnsiTerminalTest.cpp.

Some results are known to be wrong. Some that cause crashes are
commented out, to be enabled once fixed.
2026-02-11 15:43:40 +00:00
Charles Zablit
d7e5a7dacd
[lldb-dap][windows] drain the ConPTY before attaching (#180578)
Add a step to drain the init sequences emitted by the ConPTY before
attaching it to the debuggee.

A ConPTY (PseudoConsole) emits init sequences which flush the screen and
contain the name of the program (ESC[2J for clear screen, ESC[H for
cursor home and more). It's not desirable to filter them out: if a
debuggee also emits them, lldb would filter that output as well. To work
around this, the ConPTY is drained by attaching a dummy process to it,
consuming the init sequences and then attaching the actual debuggee.

---------

Co-authored-by: Nerixyz <nero.9@hotmail.de>
2026-02-11 14:17:17 +00:00
David Spickett
4677fc3d83
Revert "[lldb] Step over non-lldb breakpoints" (#180944)
Reverts llvm/llvm-project#174348 due to reported failures on MacOS and
Arm 32-bit Linux.
2026-02-11 14:03:01 +00:00
Charles Zablit
0ec4aa51dd
[lldb][windows] switch to using std::string instead of std::wstring in Python setup (#180786)
This patch changes the return type of methods returning `std:wstring` to
`std::string` in `PythonPathSetup.cpp`.

This follows lldb's style of converting to `std::wstring` at the last
moment.
2026-02-11 14:23:38 +01:00
Minsoo Choo
5e5b799853
[lldb][NativeRegisterContext] Rename to x86 for shared files (#180624) 2026-02-11 07:19:34 -05:00
Hemang Gadhavi
6b7dd97b1f
[lldb][AIX] Added RegisterInfo file for PPC64 (#165367)
This PR is in reference to porting LLDB on AIX.
Link to discussions on llvm discourse and github:

1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640
2. https://github.com/llvm/llvm-project/issues/101657
The complete changes for porting are present in this draft PR:
https://github.com/llvm/llvm-project/pull/102601

- Added register information file for PPC64 big-endian architecture
(used by AIX)
2026-02-11 16:11:03 +05:30
Duncan McBain
304c680809
[lldb] Step over non-lldb breakpoints (#174348)
Several languages support some sort of "breakpoint" function, which adds
ISA-specific instructions to generate an interrupt at runtime. However,
on some platforms, these instructions don't increment the program
counter. When LLDB sets these instructions it isn't a problem, as we
remove them before continuing, then re-add them after stepping over the
location. However, for breakpoint sequences that are part of the
inferior process, this doesn't happen - and so users might be left
unable to continue past the breakpoint without manually interfering with
the program counter.

This patch adds logic to LLDB to intercept SIGTRAPs, inspect the bytes
of the inferior at the program counter, and if the instruction looks
like a BRK or BKPT or similar, increment the pc by the size of the
instruction we found. This unifies platform behaviour (e.g. on x86_64,
LLDB debug sessions already look like this) and improves UX (in my
opinion, but I think it beats messing with stuff every break).

Some ISAs (like AArch64) require slightly different handling, as while
there are multiple possible instructions, we should be careful only to
find the ones likely to have been emitted by a compiler backend, and not
those inserted from (for example) the UB sanitizer, or any others.

There is an existing builtin-debugtrap test which was under the macos
folder before. I've now moved that to "functionalities", made it pure C
only, and updated it a little bit so that it works regardless of
platform.

What I've not done is change the existing code in debugserver which was
added by Jason Molenda about five years ago
(https://reviews.llvm.org/D91238, 92b036d). It might not be required any
more after this change. Reading the history there, it seems like it was
agreed that this behaviour (skipping over unknown bps) was the desired
end goal.

Fixes #56268

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-02-11 10:18:41 +00:00
Minsoo Choo
fefbffe9b4
[lldb][Process/FreeBSDKernel] Add links to pcb.h (#180267)
We had consensus in #178556 to use cgit links for this kind of use
cases.

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
2026-02-11 10:01:16 +00:00
Nerixyz
ee92a9e1f4
[LLDB] Fix KDP plugin path (#180897)
This should fix a failure on the macOS buildbots (see
https://github.com/llvm/llvm-project/pull/179524#issuecomment-3882784085).
I can't test this, but the only plugins not enabled on Linux and Windows
are `ProcessKDP`, `PlatformDarwin`, and `PlatformDarwinKernel`. Looking
at the path for KDP, it uses `GetPluginNameStatic` as the last name in
the path. This is `kdp-remote` instead of `kdp`.
2026-02-11 08:25:04 +00:00
Jonas Devlieghere
90d49d3782
[lldb] Implement DenseMapInfo for UUID (#180854)
Implement DenseMapInfo for UUID so that we can use UUIDs as keys in
DenseMap and DenseSet.
2026-02-10 15:17:29 -08:00
Nerixyz
5d2097ba88
[LLDB] Fix tablegen paths for KDP and IntelPT properties (#180835)
Fixes the build errors from #179524. Initially I used `Parent` as the
name but switched to `Path` later and forgot to update these files.
2026-02-10 21:21:06 +00:00
Nerixyz
cdbe28887b
[LLDB] Set and verify paths of properties from tablegen (#179524)
In #168245, I attempted to dump the available settings to Markdown. That
required a full build of LLDB. However, to build the docs, only the swig
wrappers should need to be compiled. The comment was that we should be
able to use the definitions from the TableGen files.

Currently, the property definitions in don't have information about the
path where they will be available. They only contain a `Definition`
which groups properties, so they can be added to
`OptionValueProperties`.

With this PR, I'm adding the path for each property definition. For
example, `symbols.enable-external-lookup` would have `Name =
enable-external-lookup, Path = symbols`. In LLDB itself, we don't need
this path, we only need it for the documentation. To avoid mismatches
between the actual path and the declared one, I added a debug-only check
when a property group is added to a parent
(`OptionValueProperties::AppendProperty`).

The TableGen emitter for the properties now additionally emits
`g_{definition}_properties_def`, which includes both the array of
properties and the expected path. This constant has to be used to
initialize a `OptionValueProperties`.

I couldn't test this for everything (e.g. IntelPT or ProcessKDP), but
the necessary changes are simple: (1) set the `Path` in the TableGen
file, (2) update `initialize` to use `_def`.
2026-02-10 19:43:29 +01:00
Charles Zablit
67e571df8c
[lldb-dap][windows] add support for out of PATH python.dll resolution (#179306) 2026-02-10 16:45:36 +01:00
Michael Buch
0a3b376015 [lldb][test] Skip TestLaunchProcessPosixSpawn.py
Fails on public green dragon arm64 bot with:
```
08:53:39  "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/./bin/dsymutil"  -o "fat.out.dSYM" "fat.out"
08:53:39  warning: no debug symbols in executable (-arch x86_64)
08:53:39  warning: no debug symbols in executable (-arch x86_64h)
08:53:39  warning: no debug symbols in executable (-arch arm64)
08:53:39
08:53:39
08:53:39  runCmd: file -arch x86_64 /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/lldb-test-build.noindex/macosx/posix_spawn/TestLaunchProcessPosixSpawn.test_apple_silicon/fat.out
08:53:39
08:53:39  warning: (x86_64) /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/lldb-test-build.noindex/macosx/posix_spawn/TestLaunchProcessPosixSpawn.test_apple_silicon/fat.out empty dSYM file detected, dSYM was created with an executable with no debug info.
08:53:39  output: Current executable set to '/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/lldb-test-build.noindex/macosx/posix_spawn/TestLaunchProcessPosixSpawn.test_apple_silicon/fat.out' (x86_64).
08:53:39
08:53:39
08:53:39  <bound method SBProcess.Kill of SBProcess: pid = 73406, state = exited, threads = 0, executable = fat.out>: success
08:53:39
08:53:39  FAIL: LLDB (/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang-arm64) :: test_apple_silicon (TestLaunchProcessPosixSpawn.TestLaunchProcessPosixSpawn)
08:53:39  runCmd: settings clear --all
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set symbols.enable-external-lookup false
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set target.inherit-tcc true
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set target.disable-aslr false
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set target.detach-on-error false
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set target.auto-apply-fixits false
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set plugin.process.gdb-remote.packet-timeout 60
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set symbols.clang-modules-cache-path "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/lldb-test-build.noindex/module-cache-lldb/lldb-api"
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set use-color false
08:53:39
08:53:39  output:
08:53:39
08:53:39  runCmd: settings set show-statusline false
08:53:39
08:53:39  output:
08:53:39
08:53:39  UNSUPPORTED: LLDB (/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang-arm64) :: test_haswell (TestLaunchProcessPosixSpawn.TestLaunchProcessPosixSpawn) (Current CPU is not Haswell)
08:53:39  Restore dir to: /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/test
08:53:39  ======================================================================
08:53:39  FAIL: test_apple_silicon (TestLaunchProcessPosixSpawn.TestLaunchProcessPosixSpawn)
08:53:39  ----------------------------------------------------------------------
08:53:39  Traceback (most recent call last):
08:53:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 160, in wrapper
08:53:39      return func(*args, **kwargs)
08:53:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py", line 72, in test_apple_silicon
08:53:39      self.run_arch(exe, "x86_64")
08:53:39    File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py", line 48, in run_arch
08:53:39      self.assertTrue(error.Success(), str(error))
08:53:39  AssertionError: False is not true : error: process exited with status -1 (lost connection)
08:53:39  Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang
08:53:39  ----------------------------------------------------------------------
08:53:39  Ran 2 tests in 5.686s
08:53:39
08:53:39  FAILED (failures=1, skipped=1)
```
2026-02-10 09:13:40 +00:00
Jason Molenda
481f248e08
[lldb] Get shared cache path from inferior, open (#180323)
Get the shared cache filepath and uuid that the inferior process is
using from debugserver, try to open that shared cache on the lldb host
mac and if the UUID matches, index all of the binaries in that shared
cache. When looking for binaries loaded in the process, get them from
the already-indexed shared cache.

Every time a binary is loaded, PlatformMacOSX may query the shared cache
filepath and uuid from the Process, and pass that to
HostInfo::GetSharedCacheImageInfo() if available (else fall back to the
old HostInfo::GetSharedCacheImageInfo method which only looks at lldb's
own shared cache), to get the file being requested.

ProcessGDBRemote caches the shared cache filepath and uuid from the
inferior, once it has a non-zero UUID. I added a lock for this ivar
specifically, so I don't have 20 threads all asking for the shared cache
information from debugserver and updating the cached answer. If we never
get back a non-zero UUID shared cache reply, we will re-query at every
library loaded notification. debugserver has been providing the shared
cache UUID since 2013, although I only added the shared cache filepath
field last November.

Note that a process will not report its shared cache filepath or uuid at
initial launch. As dyld gets a chance to execute a bit, it will start
returning binaries -- it will be available at the point when libraries
start loading. (it won't be available yet when the binary & dyld are the
only two binaries loaded in the process)

I tested this by disabling lldb's scan of its own shared cache
pre-execution -- only loading the system shared cache when the inferior
process reports that it is using that. I got 6-7 additional testsuite
failures running lldb like that, because no system binaries were loaded
before exeuction start, and the tests assumed they would be.

rdar://148939795

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-02-09 16:22:25 -08:00
Alex Langford
55d75d2a1f
[lldb][NFC] Fix typo in memory read help text (#180301)
rdar://168081328
2026-02-09 12:44:33 -08:00
Aiden Grossman
74c8891c9a Revert "[lldb] Fix TSan report on Linux (#179115)"
This reverts commit cc7292056683f592c33055bb6456d509201654ec.

This patch causes two tests to unexpectedly pass:
1. lldb-api.functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py
2. lldb-api.functionalities/tsan/global_location/TestTsanGlobalLocation.py

Reverting to fix premerge. Not fixing forward so someone who is familiar
with LLDB can take a look and make sure those tests now should pass.
2026-02-09 18:50:17 +00:00
Ebuka Ezike
1d5884d7cf
[lldb-dap] Fix the breakpoint events test. (#180518)
Previously the test was written in a way that may be flaky, fixed with
the following changes.
- The breakpoint are placed on functions and set during the
configuration stage of the protocol.
 - Add the rpath to the test binary.
 - Check we also hit the breakpoint we set directly using lldb.
2026-02-09 18:37:35 +00:00
Charles Zablit
be711a08b3
[lldb][windows] remove unneeded DeleteProcThreadAttributeList call (#180579)
Remove an unneeded call to `DeleteProcThreadAttributeList`, which is
already done in the `ProcThreadAttributeList` destructor.
2026-02-09 19:34:43 +01:00
Charles Zablit
352932c1b4
[NFC][lldb][windows] extract the UpdateProcThreadAttribute logic (#180565)
This NFC patch extracts the `UpdateProcThreadAttribute` logic to a
dedicated method be able to reuse it in
https://github.com/llvm/llvm-project/pull/180561.
2026-02-09 19:20:10 +01:00
Sergei Druzhkov
cc72920566
[lldb] Fix TSan report on Linux (#179115)
Linux uses 0 for `RTLD_DEFAULT` opposite to macOS and BSD systems (they
use -2).
2026-02-09 20:03:46 +03:00
Charles Zablit
b13dc23622
[lldb] add cross platform test commands in Makefile.rules (#180224)
This patch adds cross platform (Darwin, Linux, Windows) commands in
`Makefile.rules` which is used to build lldb test targets.

This maps POSIX commands like `mkdir -p` to their Windows equivalent,
which allows to create cross platform `Makefile` for lldb's test
targets. This is currently not needed by any test but might become
useful later as we are working on enabling more lldb Windows tests.

This was originally done in the `swiftlang/llvm-project` fork
(https://github.com/swiftlang/llvm-project/pull/12127)
2026-02-09 14:56:50 +01:00
Charles Zablit
dbbea962c9
[lldb-dap][windows] fix invalid path substitution for lldb-dap (#180237)
https://github.com/llvm/llvm-project/pull/178642 added
`lldb/test/Shell/DAP/TestSTDINConsole.test` with an incorrect
`%lldb-dap` expansion. This patch fixes it.
2026-02-09 14:49:57 +01:00
Sergei Druzhkov
42d5e76b46
[lldb-dap] Bump vscode version (#177008)
VS Code and node versions should be synchronized. We use node >= 18.19,
so expected VS Code version is 1.90.0. I checked it using this
[info](https://github.com/ewanharris/vscode-versions).
2026-02-09 16:28:35 +03:00
David Spickett
1ff4b50380
[lldb] Quit automatically if --batch has no commands to run (#179969)
Fixes #179700

Simple fix, if we are in batch mode, don't go into an interactive
session after checking if there are commands to run.

Testing it is more tricky. I tried a shell test as I thought it would be
simplest. However to be able to FileCheck I had to pipe and the pipe
turns off the prompt because it's non-interactive. The prompt is the
thing that must not be printed.

So I've just spawned lldb as a subprocess. If it doesn't quit quickly
then something is wrong. The timeout is high not because it should
normally take that long, but because sometimes a process will get
stalled for a while and I don't want this to be flaky.

(though in theory it can get stalled for much longer than a minute)

If it does time out, the process will be cleaned up automatically. See
https://docs.python.org/3/library/subprocess.html#subprocess.run

> A timeout may be specified in seconds, it is internally
> passed on to Popen.communicate(). If the timeout expires,
> the child process will be killed and waited for.
2026-02-09 13:16:58 +00:00
Ebuka Ezike
695095fff6
[lldb-dap][NFC] Add new line to attach message (#180510) 2026-02-09 12:26:53 +00:00
puneeth_aditya_5656
936ec4ea66
[lldb] Handle STT_TLS symbol type in ELF parser (#178975)
Add handling for `STT_TLS` (thread-local storage) symbols in the ELF
symbol parsing code. Previously, TLS symbols like `errno` from glibc
were not recognized because `STT_TLS` was not handled in the symbol type
switch statement.

This treats TLS symbols as data symbols (`eSymbolTypeData`), similar to
`STT_OBJECT`. The actual TLS address resolution is already implemented
in `DynamicLoaderPOSIXDYLD::GetThreadLocalData()` which uses the DWARF
`DW_OP_form_tls_address` opcode to calculate thread-local addresses.
2026-02-09 10:02:44 +00:00
Michael Buch
a07347f609
[lldb][test] Rename/remove duplicate methods in API tests (#180250)
Ran my python script from
https://github.com/llvm/llvm-project/pull/97043 over the repo again and
there were 2 duplicate test-cases that have been introduced since I last
did this.

Also one of the WASM classes had a duplicate method which I just
removed.
2026-02-09 09:47:14 +00:00
Jason Molenda
3449207b7b [lldb][NFC] Fix the SPI prototypes in HostInfoMacOSX.mm
to unblock a CI bot building with a different set of headers.
rdar://148939795
2026-02-06 17:59:14 -08:00
jimingham
85d94e1714
Make StopInfoMachException return the right data. (#180088)
When I changed lldb so that the StopInfo's compute their own stop reason
data (before it was oddly done in SBThread::GetStopReasonData...) I
didn't notice that StopInfoMachException was relying on that routine's
default of returning the Value as the 0th exception data, and didn't
actually return its own data.
This fixes that, and makes us report the exception type, and the code
and subcode if the exception has them. I also added a test for this.

rdar://169755672
2026-02-06 11:27:33 -08:00
jimingham
6bdb7b0f00
Cleanup the use of m_is_secondary_thread from PR #179799. (#180255)
This ivar was passed to the thread function for the private state thread
- mostly because the equivalent variable was passed in in the original
version of the code. But it was never used, so I didn't notice that the
ivar equivalent wasn't being initialized. I'm going to keep the ivar
because it will be useful when debugging to easily see whether you are
on the main or secondary private state thread.

So in this change, I set m_is_secondary_thread properly in the
constructor, but remove passing it to the thread function since it
wasn't needed there.
2026-02-06 10:51:57 -08:00
Michael Buch
4a7e572a5c [lldb][test] TestTemplateDiagnosticHint.py: XFAIL on Windows
Fails on Windows with below error. Probably because we're not
constructing the AST from DWARF correctly for templates. Or perhaps
something to do with the DWARF index.

```
******************** TEST 'lldb-api :: lang/cpp/template-diagnostic-hint/TestTemplateDiagnosticHint.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type Release --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\lang\cpp\template-diagnostic-hint -p TestTemplateDiagnosticHint.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 23.0.0git (https://github.com/llvm/llvm-project.git revision 4afce0cb3de8e9a849b5150471672f4bb6ee591b)
  clang revision 4afce0cb3de8e9a849b5150471672f4bb6ee591b
  llvm revision 4afce0cb3de8e9a849b5150471672f4bb6ee591b
Skipping the following test categories: watchpoint, libc++, libstdcxx, dwo, dsym, gmodules, debugserver, objc, fork, pexpect
--
Command Output (stderr):
--
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_dsym (TestTemplateDiagnosticHint.TestCase.test_dsym) (test case does not fall in any category of interest for this run)
FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_dwarf (TestTemplateDiagnosticHint.TestCase.test_dwarf)
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_dwo (TestTemplateDiagnosticHint.TestCase.test_dwo) (test case does not fall in any category of interest for this run)
======================================================================

FAIL: test_dwarf (TestTemplateDiagnosticHint.TestCase.test_dwarf)

----------------------------------------------------------------------

Traceback (most recent call last):
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1844, in test_method
    return attrvalue(self)

           ^^^^^^^^^^^^^^^
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\lang\cpp\template-diagnostic-hint\TestTemplateDiagnosticHint.py", line 14, in test
    self.expect(
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 2569, in expect
    self.fail(log_msg)
AssertionError: Ran command:

"expression some_template_func<int, long>(5)"

Got output:

note: Ran expression as 'C++14'.

error: <user expression 0>:1:1: use of undeclared identifier 'some_template_func'

    1 | some_template_func<int, long>(5)

      | ^~~~~~~~~~~~~~~~~~

Expecting sub string: "does not name a template but is followed by template arguments" (was not found)

Config=aarch64-C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe

----------------------------------------------------------------------

Ran 3 tests in 0.601s
FAILED (failures=1, skipped=2)
```
2026-02-06 18:27:47 +00:00
Ebuka Ezike
8244528aee
[lldb-dap] Add validation for RunInTerminal client capability (#180213)
Check if the client supports RunInTerminal before attempting to run in
the preferred terminal.
One less unknown reason for failed to launch
2026-02-06 18:08:20 +00:00
John Harrison
69878f9fa1
[lldb] Refactor JSONTransport own MainLoop read handle. (#179564)
When working with a MainLoop, if the file reaches the EOF it will
immediately fire the read handle callback. We cannot readily determine
if the file is at EOF or if the file is pointing to a socket/pipe that
has consumed all the current data in the buffer but the remote end has
not yet hung up. This is causing JSONTransport to continuously fire the
OnRead callback trigging repeated calls to the
`MessageHandler::OnClose`.

Since MainLoop does not perform the actual read, we need to adjust the
behavior of JSONTransport to fully own the read handle.

This change moves the ownership of the `MainLoop::ReadHandleUP` and
additionally own a reference to the `MainLoop` itself to ensure the loop
outlives the JSONTransport object.

This allows us to remove the handle immediately when we detect an EOF /
hang up has occurred.
2026-02-06 10:07:09 -08:00
Charles Zablit
9f8f90143e
Revert "[lldb-dap] fix executable substitution in tests (#179685)" (#180241)
This reverts commit 082a47d8944da242993bf28980b07f2c8c3df4a6.

`ToolSubst` should only be used explicitely for passing `extra_args`.
2026-02-06 17:38:37 +00:00
Michael Buch
68d7048445
[lldb][ClangUserExpression] Emit workaround hint when trying to call function templates (#179916)
Before:
```
(lldb) expression some_template_func<int, long>(5)
                  ˄
                  ╰─ error: 'some_template_func' does not name a template but is followed by template arguments
note: Ran expression as 'C++14'.
note: note: non-template declaration found by name lookup
```

After:
```
(lldb) expression some_template_func<int, long>(5)
                  ˄
                  ╰─ error: 'some_template_func' does not name a template but is followed by template arguments
note: Ran expression as 'C++14'.
note: note: non-template declaration found by name lookup
note: Naming template instantiation not yet supported. Template functions can be invoked via their mangled name. E.g., expression _Z3fooIiEvi(5)
```

There isn't a great way to get to the actual function being named (and
its mangled name) since we're just dealing with raw text. So I just
print an example mangled name.

This doesn't work for all template instantiations. E.g.,:
```
(lldb) p f.method<long>(10)
           ˄          ˄
           │          ╰─ error: expected '(' for function-style cast or type construction
           ╰─ error: no member named 'method' in 'Foo<int>'
note: Ran expression as 'C++14'.
```
This is a consequence of how we construct the AST for template methods.
Once we fix that, this hint will get emitted there too.

Note this will also trigger in cases where no function is being called
(hence I used the defensive phrase "Template functions can be invoked").

rdar://135725807
2026-02-06 16:44:49 +00:00
David Spickett
383e771dff
[lldb][FreeBSD] Remove MIPS64 unit tests (#180207)
427bb1cc1b09ea68b8a13a667810681ba4074f6b removed FreeBSD on MIPS64
support. This test was missed because it only compiles on FreeBSD on
MIPS64.
2026-02-06 15:13:21 +00:00
Minsoo Choo
bc706338c1
[lldb] [Process/FreeBSD] Assume minimum is FreeBSD 14 (#179587)
Currently versions under 13 are EOLed (see [FreeBSD Release
Information](https://www.freebsd.org/releases/)).

FreeBSD 13 will be EOLed by April 30th (see [Supported FreeBSD
releases](https://www.freebsd.org/security/#sup)) while LLVM 23 is
expected to be released in August 25th according to the LLVM calendar.

Thus assumed that minimum supported FreeBSD version is 14.

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
2026-02-06 08:59:46 -05:00
Minsoo Choo
2791f42a04
[lldb][Process] Remove mips64 POSIX support (#179987)
Since ce03a862372a6f36d2fcf80dc80052aa155fcae8 and
427bb1cc1b09ea68b8a13a667810681ba4074f6b, mips64 support for POSIX is
orphaned. Remove any POSIX_mips64 code and other code we missed in those
commits.

---------

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
2026-02-06 08:39:27 -05:00
Ebuka Ezike
bde4754bc4
[lldb-dap] Remove end line and column from disassemble response (#180037)
The end line entry calculated from the instruction's end address is
unreliable and could produce incorrect source ranges. especially if the
instruction spans multiple lines.

We can end in situations where the current end line is the next start
line and the source line is show to the client twice. confusing users
what maps to what.

| With EndLine | 
| :------------: |
| <img width="892" height="486" alt="Screenshot 2026-02-05 at 21 37 08"
src="https://github.com/user-attachments/assets/f2fef592-5754-4168-bf93-2baba4742c5d"
/> |

| Without Endline |
| :---------------: |
| <img width="892" height="486" alt="Screenshot 2026-02-05 at 21 59 29"
src="https://github.com/user-attachments/assets/538dd462-9c7f-4483-804c-65fd83b5f2f2"
/>|

 Or the endline is smaller than the startline.
 ```json
 {
  "address": "0x5555555557B4",
  "column": 3,
  "endLine": 2,
  "instruction": "add     rsp, 0x20                ",
  "instructionBytes": "48 83 c4 20",
  "line": 17,
  "location": {
    "name": "test.cpp",
    "path": "/buildbot/test_process/test.cpp"
  }
},
```
2026-02-06 12:04:22 +00:00
David Spickett
b02a6363e8
[lldb] Remove --debug/-d option from lldb (#179978)
The functionality was removed in
d3173f4ab61c17337908eb7df3f1c515ddcd428c after being broken for a long
time.

There's a small risk someone is still passing the option, but I think
it's time to remove it and they can fix their scripts.
2026-02-06 09:22:31 +00:00
Jason Molenda
e3c72cf008
[lldb] Add a new way of loading files from a shared cache (#179881)
Taking advantage of a few new SPI in macOS 26.4 libdyld, it is possible
for lldb to load binaries out of a shared cache binary blob, instead of
needing discrete files on disk. lldb has had one special case where it
has done this for years -- if the debugee process and lldb itself are
using the same shared cache, it could create ObjectFiles based on its
own memory contents. This new method requires only the shared cache on
disk, not depending on it being mapped into lldb's address space
already.

In HostInfoMacOSX.mm, we create an array of binaries in lldb's shared
cache, by one of two methods depending on the availability of SPI/SDKs.
This PR adds a new third method for loading lldb's shared cache off disk
as a proof of concept. It will prefer this new method when the needed
SPI are available at runtime. There is also a user setting to disable
this new method in case we uncover a problem as it is deployed.

I did change the internal store of the shared cache files from a single
array, to being organized by shared cache UUIDs, so we can have multiple
shared caches indexed in the future.

In HostInfoBase.h's SharedCacheImageInfo class, you can now create an
ImageInfo with a DataExtractorSP or a void* baton. I added GetUUID and
GetExtractor methods, and the latter will use the libdyld SPI to map the
segments for a specific binary into lldb's memory and return a
DataExtractorSP.

The setting is currently called symbols.shared-cache-binary-loading.

In DynamicLoaderDarwin::FindTargetModuleForImageInfo there was an
ordering mistake where we would always consult the HostInfoMacOSX.mm
shared cache provider, instead of checking lldb's own global module
cache first when looking for a binary, resulting in creating a new
Module repeatedly for shared cache binaries with the new method, parsing
the symbol table repeatedly. I fixed the ordering so we look at existing
Modules before we check the shared cache for one.

In ObjectFileMachOTest, it tests a TEXT and a DATA symbol, checking that
the contents of the function/data object match the bytes we got from the
shared cache. The test was using a DATA_DIRTY symbol, which was fine
when using lldb's own shared cache memory, but when we worked on the
shared cache binary on-disk directly, we were seeing different values
for the bytes because of relocations in there. I changed this to a
constant DATA symbol.

rdar://148939795

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
Co-authored-by: Alex Langford <nirvashtzero@gmail.com>
2026-02-05 18:38:20 -08:00
jimingham
41cc71e9b1
Disable TestCancelAttach.py for linux -> linux remote (#180092)
This test was already disabled going from windows -> linux because it
was timing out there.

The PR: https://github.com/llvm/llvm-project/pull/179799 seems to have
exacerbated whatever this stall was, and now we're seeing it when
debugging from a linux host to a remote linux as well.

The native local host tests works correctly on all the bots that we
have, however. So I'm disabling the remote test till we can figure out
why this is problematic.
2026-02-05 17:27:42 -08:00
Jason Molenda
af3cc148c3
[lldb][NFC] Add some override methods to VirtualDataExtractor (#179858)
This changes VirtualDataExtractor's GetByteSize to return the virtual
byte size of the buffer (external users only understand the data
contents in terms of the virtual sizes & offsets). There are check
methods in DataExtractor that check they are not going off the end of a
buffer, they usually use the BytesLeft() method. There are a couple of
callers of BytesLeft() externally, but it is predominantly an internal
use API. I have BytesLeft() use the physical size of the buffer, not the
virtual size, for the benefit of the DataExtractor methods. (and to
avoid duplicating all of them down in VirtualDataExtractor)

Another problem is the we call SetData on DataExtractorSP's (e.g. see
the ObjectFile ctor) with the DataBuffer it already has, an offset of 0,
and the GetByteSize. A no-op for a DataExtractor that is already using
that DataBuffer. But SetData would try to use that length as a physical
size, and truncate the buffer that the DataExtractor would accept.

I added VirtualDataExtractor subclass methods for the SetData's, detect
(1) data being added to an uninitialized DataExtractor, (2) the same
data / offset / length as currently being used is added to the
DataExtractor (a no-op), or (3) we're genuinely changing the data source
or setting an offset / length that is different. This final case we're
not ready to handle today, I added asserts for them so we can catch it
in debug builds, and then I clear the LookupTable and add a no-op entry
so this extractor will behave like a plain DataExtractor -- because I
don't know better to do. If we genuinely need to handle this case, and
I'm pretty sure we don't need to, I'd have to assume that we're taking a
subset of the original data source (an offset & length), so we'd need to
update all of the LookupTable entries to reflect the new offsets, and
remove entries that are no longer referring to the subsetted range. I'll
leave that until there's any evidence it's actually needed.

rdar://148939795
2026-02-05 15:10:54 -08:00
jimingham
124c8b4054
Fix the modal private state thread we use for running expressions on the private state thread (#179799)
We have a problem when some code on the private state thread needs to
run an expression. The private state thread is the one that fetches
"raw" events from the Process Plugin and decides how to handle them. But
if the private state thread needs to fetch the processed events to drive
running an expression, it can't also be the thread processing the raw
events.

We solve this by swapping in a modal private state thread just to handle
the events from the expression evaluation. That worked until you could
cause the expression evaluation to happen from Python, because then it
wasn't just the fetching of events that matter, but also the state of
the process and the state of the runlocks. The modal private state
thread is really a modal version of the thread and its associated state.

This patch gathers all the relevant control parameters into a structure
which we can swap in and out when needed.

It also adds a test using the new "was_hit" breakpoint resolver
affordance, which, since it acts as an asynchronous breakpoint callback,
gets run on the private state thread, showing that with the change we
can call expressions in the `was_hit` callback without problems.
2026-02-05 15:03:52 -08:00
Ebuka Ezike
e3a09dd13b
[lldb-dap][NFC] Create helper function DAP::ProcessIsNotStopped (#180056)
From
https://github.com/llvm/llvm-project/pull/179202#discussion_r2757981118
2026-02-05 23:02:23 +00:00
Ebuka Ezike
0d020f14c9
[lldb-dap] Split the launch IO redirection tests. (#179974)
Tests in the same python file share the same build directory. 
Although they are the same binary. The logs produced are different.
2026-02-05 22:03:02 +00:00
Adrian Vogelsgesang
943782be5a
[lldb] Broadcast eBroadcastBitStackChanged when frame providers change (#171482)
We want to reload the call stack whenever the frame providers are
updated. To do so, we now emit a `eBroadcastBitStackChanged` on all
threads whenever any changes to the frame providers take place.

I found this very useful while iterating on a frame provider in
lldb-dap. So far, the new frame provider only took effect after
continuing execution. Now the backtrace in VS-Code gets refreshed
immediately upon running `target frame-provider add`.
2026-02-05 21:00:23 +01:00