4146 Commits

Author SHA1 Message Date
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
cmtice
3a16cbe787
[LLDB] Skip linker symbols test on Windows and MacOS. (#184690)
The test was only intended to run on linux.

Currently it's failing on the lldb-x86_64-win builder:
https://lab.llvm.org/buildbot/#/builders/211/builds/6741
2026-03-04 23:03:57 +00:00
cmtice
f26ff8d86f
[LLDB] Allow symbols added by linker scripts to be examined. (#184679)
Symbols added by linker scripts do not have debug information or types,
but they do have addresses. Sometimes users need to see the addresses of
these symbols. Currently these symbols end up being assigned
'eSymbolTypeInvalid', so any attempt to look at them fails. This fixes
that issue.
2026-03-04 12:38:26 -08:00
Ilia Kuklin
14af5be5da
[lldb] Add arithmetic binary subtraction to DIL (#184017) 2026-03-04 15:12:48 +05:00
John Harrison
5e5f7efd77
[lldb] Expose block equality with SBBlock. (#184222)
Adding the `operator==` and `operator!=` for SBBlock. This should allow
us to compare blocks within a frame, like:

```python
block = frame.GetBlock()
while True:
  if block == frame.GetFrameBlock():
    # we're at the top function scope.
  else:
    # we're at an inner block scope.
```
2026-03-03 16:19:58 -08:00
Felipe de Azevedo Piovezan
09217ba904
[lldb] Disable shared build for TestTemplateArgs,TestEvents,TestTypeList (#184304)
See https://github.com/llvm/llvm-project/pull/181720
2026-03-03 09:34:39 +00:00
Jim Ingham
c433ae7e2e Revert "Add a test that we recover from a crashing breakpoint condition."
This reverts commit 49c3cd15e8b4c21dd86eefdc76754ddfc2a7a65e.

I was going back and forth between llvm.org and my fork to prepare
this PR, but mistakenly pushed it from the wrong checkout.
Let's revert this and do it right...
2026-03-02 14:16:04 -08:00
Jim Ingham
49c3cd15e8 Add a test that we recover from a crashing breakpoint condition. 2026-03-02 14:06:54 -08:00
Igor Kudrin
a4d786630c
[lldb][ARM] Support thread local variables on ARM Linux (#181315)
Currently, `DynamicLoaderPOSIXDYLD::GetThreadLocalData()` only supports
the TLS memory layout where the thread pointer register points to the
start of the `pthread` structure, and the address of the DTV pointer can
be calculated by adding the offset of the `dtv` field to `tp`. On ARM
(and AArch64), the thread pointer points directly to `dtv`. The patch
improves the detection of the actual memory layout in the method and
adjusts the calculations for the new case, thus adding support for
thread-local variables on ARM Linux.
2026-03-02 12:50:43 -08:00
Bar Soloveychik
b3c4d44c44
[lldb] Batch breakpoint step-over for threads stopped at the same BP (#183412)
When multiple threads are stopped at the same breakpoint, LLDB currently
steps each thread over the breakpoint one at a time. Each step requires
disabling the breakpoint, single-stepping one thread, and re-enabling
it, resulting in N disable/enable cycles and N individual vCont packets
for N threads. This is a common scenario for hot breakpoints in
multithreaded programs and scales poorly.

This patch batches the step-over so that all threads at the same
breakpoint site are stepped together in a single vCont packet, with the
breakpoint disabled once at the start and re-enabled once after the last
thread finishes.

At the top of WillResume, any leftover StepOverBreakpoint plans from a
previous cycle are popped with their re-enable side effect suppressed
via SetReenabledBreakpointSite, giving a clean slate.
SetupToStepOverBreakpointIfNeeded then creates fresh plans for all
threads that still need to step over a breakpoint, and these are grouped
by breakpoint address.

For groups with multiple threads, each plan is set to defer its
re-enable through SetDeferReenableBreakpointSite. Instead of re-enabling
the breakpoint directly when a plan completes, it calls
ThreadFinishedSteppingOverBreakpoint, which decrements a per-address
tracking count. The breakpoint is only re-enabled when the count reaches
zero.

All threads in the largest group are resumed together in a single
batched vCont packet. If some threads don't complete their step in one
cycle, the pop-and-recreate logic naturally re-batches the remaining
threads on the next WillResume call.

For 10 threads at the same breakpoint, this reduces the operation from
10 z0/Z0 pairs and 10 vCont packets to 1 z0 + 1 Z0 and a few
progressively smaller batched vCont packets.

EDIT:
Tried to merge this PR twice, the first time the test was flaky so we
had to revert. The second time, we broke 2 tests on windows machine:
https://lab.llvm.org/buildbot/#/builders/141/builds/15798

The tests that were failing were failing because the cleanup code in
`WillResume` was popping **ALL** `StepOverBreakpoint` plans, including
non-deferred ones from incomplete single-steps.
The issue was: 
1) Multiple threads hit the same breakpoint. One thread's breakpoint
condition evaluates to false, so it needs to auto-continue.
2) A `StepOverBreakpoint` plan is created for that thread
(non-deferred).
3) On the next WillResume, the cleanup pops that non-deferred plan.
4) Now the `StopOthers` scan finds no thread with a StopOthers() plan,
so thread_to_run stays null.
5) The else branch runs, calling `SetupToStepOverBreakpointIfNeeded` on
**ALL** threads, including the thread that legitimately hit the
breakpoint with a true condition.
6) That thread gets a new `StepOverBreakpoint` plan pushed, which
overwrites its breakpoint stop reason with trace when the step
completes.

The error `trace (2) != breakpoint (3)` confirms this, the thread that
should have reported breakpoint as its stop reason instead reports
trace, because an unwanted `StepOverBreakpoint` plan was pushed on it
and completed.

The newly added code fixes it by only popping plans that have
`GetDeferReenableBreakpointSite() == true`

Co-authored-by: Bar Soloveychik <barsolo@fb.com>
2026-03-02 10:46:23 -08:00
Ebuka Ezike
919ae1cd2f
[lldb-dap] Skip return_variable_with_children on arm64 (#184132)
In lldb arm64 does not support scalar return types that is larger than
the register size. skip the test on that architecture.

Unblocks CI.
2026-03-02 14:42:19 +00:00
Ilia Kuklin
e3b01e1329
[lldb] Fix wchar addition tests in DIL (#184082)
This patch fixes tests on systems where `wchar`'s underlying type is
`unsigned long`, or `long` and `int` types have the same width, so
`unsigned int` gets promoted to `unsigned long` during binary addition.
These tests check that `wchar` types get promoted to regular integer
types at all.
2026-03-02 15:35:44 +05:00
David Spickett
900f70258b
[lldb] Indent option help with ANSI cursor codes when possible. (#183558)
This avoids formatting empty space when a range of text formatted by
ANSI codes is split across lines.

This is not currently done in any option, but the `${...}` syntax we
have does support marking any range of text, so it could be done in
future, and fixing it is simple.

As an example, if I change a breakpoint option:
```
             "${S}et the breakpoint only in this shared library.  Can repeat "
-            "this option multiple times to specify multiple shared libraries.">;
+            "this option multiple ${times to specify multiple} shared libraries.">;
```
This applies the underline to words that will be split across lines. In
the outputs below, `^` represents an underlined character.

With spaces:
```
       -s <shlib-name> ( --shlib <shlib-name> )
            Set the breakpoint only in this shared library.  Can repeat this option multiple times to
                                                                                             ^^^^^^^^
            specify multiple shared libraries.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
The indent and the text are underlined, this is not what we want.

With cursor movement:
```
       -s <shlib-name> ( --shlib <shlib-name> )
            Set the breakpoint only in this shared library.  Can repeat this option multiple times to
                                                                                             ^^^^^^^^
            specify multiple shared libraries.
            ^^^^^^^^^^^^^^^^
```
Only the text is underlined, which is correct.

If we are not allowed to use ANSI (use-color is off), then the
descriptions will be stripped of ANSI anyway, so this is not a problem.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-03-02 09:58:26 +00:00
Med Ismail Bennani
702e4ec5f7
[lldb/test] Skip TestDelayInitDependency on remote platforms (#183885)
This test exercises macOS-specific linker functionality (-delay_library)
and uses a hardcoded local working directory for the launch info. It
should not run against a remote platform where neither condition holds.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-02-28 06:53:36 +00:00
Jason Molenda
c5588becb8 [lldb] Add skip shared build to more API tests
Fixing test failures on my local desktop with incremental
building.
2026-02-27 14:37:54 -08:00
John Harrison
48eb40bee0
[lldb-dap] Adjust VariableReferenceStorage lifetime management. (#183176)
Adjusting `VariableReferenceStorage` to only need to track permanent vs
temporary storage by making `VariableStore` the common base class.

Moved the subclasses of `VariableStore` into the Variables.cpp file,
since they're no long referenced externally.

Expanding on the tests by adding an updated core dump with variables in
the argument scope we can use to validate variable storage.
2026-02-27 10:47:11 -08:00
Ilia Kuklin
55d62abadb
[lldb] Add arithmetic binary addition to DIL (#177208) 2026-02-27 22:59:03 +05:00
John Harrison
a703d91091
[lldb-dap] Improve test performance for 'cancel' request. (#183632)
Update the test to more cleanly handle making a 'blocking' call using a
custom command instead of python `time.sleep`, which we cannot easily
interrupt.

This should improve the overall performance of the tests, locally they
took around 30s and now finish in around 6s.
2026-02-27 09:20:48 -08:00
Igor Kudrin
5e30ff9e70
[lldb][test] Re-enable TestDyldLaunchLinux.py for Linux/Arm (#181221)
The test was disabled in c55e021d, but it now passes, with both remote
and local runs.
2026-02-27 10:35:44 +00:00
Alex Langford
3490d28c8c
[lldb] Remove last references to fbsdvm (#183418)
Support was removed in #181283
(a8cd1ac7058efdf7a9be823182da884243ca6c0b)
2026-02-26 10:48:21 -08:00
David Spickett
23dffff410
[lldb] Fix issues handling ANSI codes and Unicode in option help (#183314)
Fixes #177570, and a bunch of FIXMEs for other tests known to be
incorrect.

To do this, I have adapted code from the existing ansi::TrimAndPad. At
first I tried a wrapper function, but there's a few things we need to
handle that cannot be done with a simple wrapper.

We must only split at word boundaries. This requires knowing whether the
last adjustment, which may be the final adjustment, was made at, or just
before, a word boundary. Also it must check for single words wider than
the requested width (though this you could do with a wrapper).

For this reason, the new TrimAtWordBoundary has more special case checks
and a more complex inner loop. Though the core is the same split into
left, ansi escape code and right that TrimAndPad uses.

It is that splitting that implements the "bias" we need to print
correctly formatted characters. When you have a preceeding ANSI code,
this must be included in the printed range, same for proceeding.
TrimAndPad already handled this, and I've copied that logic over.

TrimAndPad also used Unicode aware functions, which fixes the known
issues with Unicode (though no command option actually uses Unicode at
the moment).

This PR replaces PR #181860, where I tried to implement all this using a
strategy that used "visible indexes" to decide where to cut the lines,
and then converted those into "actual indexes" to know what to print.

This worked for most cases, but adding the "bias" was very complex. The
preceeding codes were quite easy to do, but proceeding proved to be too
complex.

I also had the feeling I was revinventing TrimAndPad and though it
didn't turn out to be that simple, it wasn't far off.

As the majority of the work is now done in TrimAtWordBoundary, I have
reused some existing OutputWordWrappedLines tests for the new function.
2026-02-26 11:00:53 +00:00
Med Ismail Bennani
564f433083
[lldb/test] Use filecheck_log to read log files from the host platform (#183422)
Some tests were using `self.filecheck` with `platform shell cat {log}`
to validate test behavior through log inspection.

This doesn't work when running the testsuite against a remote platform
since the logs are saved on the host's filesystem.

This patch refactors those call sites to use the new `filecheck_log`
helper, which ensures the log file is always read from the host
platform.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-02-25 17:07:58 -08:00
Med Ismail Bennani
2f46255485
Revert "[lldb/test] Fix tests reading log from remote platform instead of host" (#183419)
Reverts llvm/llvm-project#183413 because this is still fragile.
2026-02-25 16:18:18 -08:00
Med Ismail Bennani
b3ec476c70
[lldb/test] Fix tests reading log from remote platform instead of host (#183413)
Some tests are using logs to validate that a test behaves correctly
however they used `platform shell cat {log}` to read the logfile.

This doesn't work when running the testsuite against a remote platform
since the logs are saved on the host's filesystem.

This patch addresses those failures by making sure we read the log file
from the host platform.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-02-25 23:46:40 +00:00
Alex Langford
30969cc644
[lldb] Fix logic issue in TestDAP_stopped_events.py (#183382)
The subset should actually be the expected data because the real thread
data may have additional information.
2026-02-25 14:09:14 -08:00
satyanarayana reddy janga
7be9d66c29
Revert "[lldb] Batch breakpoint step-over for threads stopped at the … (#183378)
…same site (re-land) (#182944)"

This reverts commit 94d9f1b3cbb02700d9cd3339c1dbf44c0d13b550.
2026-02-25 14:46:13 -06:00
barsolo2000
94d9f1b3cb
[lldb] Batch breakpoint step-over for threads stopped at the same site (re-land) (#182944)
Re-land https://github.com/llvm/llvm-project/pull/180101 since it was
reverted here https://github.com/llvm/llvm-project/pull/182431 because
of a flaky test. This PR include the modified test that should pass from
https://github.com/llvm/llvm-project/pull/182415 :

When multiple threads are stopped at the same breakpoint, LLDB currently
steps each thread over the breakpoint one at a time. Each step requires
disabling the breakpoint, single-stepping one thread, and re-enabling
it, resulting in N disable/enable cycles and N individual vCont packets
for N threads. This is a common scenario for hot breakpoints in
multithreaded programs and scales poorly.

This patch batches the step-over so that all threads at the same
breakpoint site are stepped together in a single vCont packet, with the
breakpoint disabled once at the start and re-enabled once after the last
thread finishes.

At the top of WillResume, any leftover StepOverBreakpoint plans from a
previous cycle are popped with their re-enable side effect suppressed
via SetReenabledBreakpointSite, giving a clean slate.
SetupToStepOverBreakpointIfNeeded then creates fresh plans for all
threads that still need to step over a breakpoint, and these are grouped
by breakpoint address.

For groups with multiple threads, each plan is set to defer its
re-enable through SetDeferReenableBreakpointSite. Instead of re-enabling
the breakpoint directly when a plan completes, it calls
ThreadFinishedSteppingOverBreakpoint, which decrements a per-address
tracking count. The breakpoint is only re-enabled when the count reaches
zero.

All threads in the largest group are resumed together in a single
batched vCont packet. If some threads don't complete their step in one
cycle, the pop-and-recreate logic naturally re-batches the remaining
threads on the next WillResume call.

For 10 threads at the same breakpoint, this reduces the operation from
10 z0/Z0 pairs and 10 vCont packets to 1 z0 + 1 Z0 and a few
progressively smaller batched vCont packets.

Co-authored-by: Bar Soloveychik <barsolo@fb.com>
2026-02-25 11:53:23 -06:00
Alex Langford
8e43a5a39c
[lldb] Disable shared build for TestHiddenIvars.py and TestObjCIvarStripped.py (#183188)
These tests sporadically fail on Green Dragon. My hypothesis is that one
test is rebuilding while another is trying to load a dSYM leading to a
mismatch.
2026-02-24 22:37:47 +00:00
Priyanshu Kumar
07053e4d2e
[LLDB]Fix logic in matches method for thread comparison (#179873)
The method claims to check if a is a subset of b, but the implementation
`a | b ==a` actually checks if b is a subset of a. This patch updated
the docstring.
2026-02-24 14:00:54 -08:00
Alex Langford
a41cedaa73
[lldb] Make TestProcessAttach.py more reliable (#183141)
This test occasionally fails on GreenDragon. When the directory already
exists and we enter the exception block, the `os.errno` symbol is not
found because it was deprecated in Python 3.7.

Instead, replace `os.mkdir` with `os.makedirs` because it can handle a
directory already existing.
2026-02-24 11:50:25 -08:00
Charles Zablit
334aa966ec
Revert "[lldb] fix Makefile.rules cross platform macros (#183090)" (#183142) 2026-02-24 19:45:06 +00:00
Charles Zablit
544e75ebd9
Revert "Merge commit '74ad4baef073' from llvm.org/main into next (#183126)" (#183135) 2026-02-24 19:30:20 +00:00
Charles Zablit
f4577641d1
Merge commit '74ad4baef073' from llvm.org/main into next (#183126) 2026-02-24 19:02:51 +00:00
Charles Zablit
980c24897e
[lldb] fix Makefile.rules cross platform macros (#183090)
This patch fixes cross platform Makefile.rules macros and adds the
`ECHO_TO_EXISTING_FILE` macros.

Using `echo` in a macro to write to a file had quoting issues.
2026-02-24 18:47:36 +00:00
Minsoo Choo
1c11f94550
[lldb][Process/FreeBSDKernel] Rename to FreeBSDKernelCore (#182878)
There are two different ways to debug FreeBSD's kernel: core and remote
debugging. Remote debugging is done through `gdb-remote` plugin while
kernel dump and live core debugging is done through `freebsd-kernel`.
The name `freebsd-kernel` is vague for this reason, and following
`elf-core` and `mach-core`'s example, it would be clearer if this plugin
is renamed to `freebsd-kernel-core`.

---------

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
2026-02-24 11:37:04 -05:00
William Tran-Viet
33025a267d
[libc++] Make __wrap_iter comparison operators hidden friends (#179590)
Prelude to #179389
2026-02-24 09:18:15 +01:00
Igor Kudrin
5d3c4511f2
[lldb][ARM] Support reading the thread pointer register on ARM Linux (#182438)
This implements reading the TPIDRURO register, which serves as the
thread pointer register on ARM Linux. Note that the register is not
displayed for core files because it is not included in the dump.
2026-02-23 09:39:27 -08:00
Michael Buch
b9143faf46 [lldb][test] TestDataFormatterStdValarray: relax expected error message check
After https://github.com/llvm/llvm-project/pull/182297, we started generated `-gsimple-template-names` debug-info by default on macOS. The test was expecting template parameters in the error message. But with `simple-template-names` typenames would not contain template parameters (unless LLDB reconstructs them to do so). This formatter test was expecting template parameters, which would fail on macOS > 26.

Because the test is just concerned with checking that the `std::valarray` formatter works as expected (not that LLDB can retrieve typenames with/without template names), this patch relaxes the assertion.

In a follow-up we should fix up any type-name printing that would break with `simple-template-names`.
2026-02-23 16:26:30 +00:00
Sergei Druzhkov
459acd1426
Reland "[lldb] Fix TSan report" (#181004)
Reland "[lldb] Fix TSan report".
2026-02-20 14:57:32 +03:00
Aiden Grossman
9569e57deb
Revert "[lldb] Batch breakpoint step-over for threads stopped at the … (#182431) 2026-02-20 04:08:19 +00:00