aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities
AgeCommit message (Collapse)AuthorFilesLines
40 hoursRevert "[lldb] Fix TSan report on Linux (#179115)"Aiden Grossman2-0/+8
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.
42 hours[lldb] Fix TSan report on Linux (#179115)Sergei Druzhkov2-8/+0
Linux uses 0 for `RTLD_DEFAULT` opposite to macOS and BSD systems (they use -2).
2 days[lldb][test] Rename/remove duplicate methods in API tests (#180250)Michael Buch3-5/+2
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.
5 daysFix the modal private state thread we use for running expressions on the ↵jimingham3-0/+27
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.
6 days[lldb] Broadcast `eBroadcastBitStackChanged` when frame providers change ↵Adrian Vogelsgesang1-0/+77
(#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`.
8 days[lldb] Fix variable access in old SBFrames after inferior function calls ↵Med Ismail Bennani2-4/+361
(#178823) When a user holds an SBFrame reference and then triggers an inferior function call (via expression evaluation or GetExtendedBacktraceThread), variables in that frame become inaccessible with "register fp is not available" errors. This happens because inferior function calls execute through ThreadPlanCallFunction, which calls ClearStackFrames() during cleanup to invalidate the unwinder state. ExecutionContextRef objects in the old SBFrames were tracking StackFrameLists via weak_ptr, which became stale when ClearStackFrames() created new instances. The fix uses stable StackFrameList identifiers that persist across ClearStackFrames(): - ID = 0: Normal unwinder frames (constant across all instances) - ID = sequential counter: Scripted frame provider instances ExecutionContextRef now stores the frame list ID instead of a weak_ptr, allowing it to resolve to the current StackFrameList with fresh unwinder state after an inferior function call completes. The Thread object preserves the provider chain configuration (m_provider_chain_ids and m_next_provider_id) across ClearStackFrames() so that recreated StackFrameLists get the same IDs. When providers need to be recreated, GetStackFrameList() rebuilds them from the persisted configuration. This commit also fixes a deadlock when Python scripted frame providers call back into LLDB during frame fetching. The m_list_mutex is now released before calling GetFrameAtIndex() on the Python scripted frame provider to prevent same-thread deadlock. A dedicated m_unwinder_frames_sp member ensures GetFrameListByIdentifier(0) always returns the current unwinder frames, and proper cleanup in DestroyThread() and ClearStackFrames() to prevent modules from lingering after a Thread (and its StackFrameLists) gets destroyed. Added test validates that variables remain accessible after GetExtendedBacktraceThread triggers an inferior function call to fetch libdispatch Queue Info. rdar://167027676 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
12 days[lldb] Fix SBBreakpointName::SetEnabled to propagate changes to breakpoints ↵Ebuka Ezike1-2/+66
(#178734) When setting the enabled state of a breakpoint name via the API, the change was not being propagated to breakpoints using that name. This was inconsistent with the CLI behaviour where `breakpoint name configure --enable/--disable` correctly updates all associated breakpoints.
12 days[lldb] Add support for ScriptedFrame to provide values/variables. (#178575)Aman LaChapelle3-0/+139
This patch adds plumbing to support the implementations of StackFrame::Get{*}Variable{*} on ScriptedFrame. The major pieces required are: - A modification to ScriptedFrameInterface, so that we can actually call the python methods. - A corresponding update to the python implementation to call the python methods. - An implementation in ScriptedFrame that can get the variable list on construction inside ScriptedFrame::Create, and pass that list into the ScriptedFrame so it can get those values on request. There is a major caveat, which is that if the values from the python side don't have variables attached, right now, they won't be passed into the scripted frame to be stored in the variable list. Future discussions around adding support for 'extended variables' when printing frame variables may create a reason to change the VariableListSP into a ValueObjectListSP, and generate the VariableListSP on the fly, but that should be addressed at a later time. This patch also adds tests to the frame provider test suite to prove these changes all plumb together correctly. Related radar: rdar://165708771
13 days[lldb] [disassembler] chore: add GetVariableAnnotations to SBInstruction api ↵n2h91-0/+97
(#177676) ## Description Contribution to this topic [Rich Disassembler for LLDB](https://discourse.llvm.org/t/rich-disassembler-for-lldb/76952), this part. ``` The rich disassembler output should be exposed as structured data and made available through LLDB’s scripting API so more tooling could be built on top of this ``` ---- This pr replaces #174847 As was suggested in [this comment](https://github.com/llvm/llvm-project/pull/174847#issuecomment-3757015552), implement access to variable annotations from `SBInstruction` class itself. Notes: - :white_check_mark: did run black formatter on the python file; ## Testing Run test with ```sh ./build/bin/lldb-dotest -v -p TestVariableAnnotationsDisassembler.py lldb/test/API/functionalities/disassembler-variables ``` all tests (9 existing + 1 newly added) are passing <details> <summary>screenshot 2026-01-23</summary> build from the latest commit 08f00730b5768a8e3f7039d810084fabaaa24470 <img width="1506" height="562" alt="image" src="https://github.com/user-attachments/assets/69516353-3432-47df-ae45-c40b51ec14c4" /> </details> <details> <summary>screenshot 2026-01-29</summary> build from the latest commit f48a1a2c10f96a457ca6844be2ccc9406d3d57a0 <img width="1232" height="740" alt="image" src="https://github.com/user-attachments/assets/9d104ce6-36c3-430b-98fe-f028f83a6b6d" /> </details> --------- Signed-off-by: Nikita B <n2h9z4@gmail.com>
13 days[LLDB][Statistics] Add coreFile to Target stats (#161448)Jacob Lalonde2-0/+60
This patch adds the coreFilePath, if applicable, to the target statistics for LLDB. My primary motivation here is sanity check user reports when they say I had an issue with a specific corefile and then validating it was in fact that specifies corefile, as right now there is no guaruntee the filename and the process/target name will be the same.
13 days[lldb] Fix UbSan decorator (#177964)Ebuka Ezike1-2/+2
the ubsan decorator previously assumes the platform is macOS. macOS has an extra underscore in symbols names match two or more. uses the llvm-nm that is built instead of the system's nm.
13 days[lldb] Add the ability to load ELF core file executables and shared ↵Greg Clayton2-0/+75
libraries from memory (#177289) This patch enables ELF core files to be loaded and still show executables and shared libraries. Functionality includes: - Load executable and shared libraries from memory if ELF headers are available - Create placeholder for missing shared libraries and executable. Previously you just wouldn't get anything in the "image list" if no executable was provided.
2026-01-26[lldb] Add MSVC STL std::*_ordering summary providers (#175070)Sergei Druzhkov1-0/+7
Added summary providers for std::*_ordering from MSVC STL
2026-01-26[lldb][windows] fix ↵Charles Zablit1-3/+15
ProcessSaveCoreTestCase.test_save_core_to_nonwritable_dir (#178016) This patch fixes the `ProcessSaveCoreTestCase.test_save_core_to_nonwritable_dir` test on Windows. This test fails on Windows because `os.chmod` does not work on Windows. It was used to make the directory unwritable. [`icacls`](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls) can be used instead to block the directory. This is a followup to https://github.com/llvm/llvm-project/pull/177496.
2026-01-26[lldb] Add libcxx std::*_ordering summary providers (#174227)Sergei Druzhkov1-0/+5
Added libcxx std::*_ordering summary providers similar to #174195.
2026-01-26[lldb] Improve error and docs for repeating "memory region" (#177559)David Spickett1-1/+1
"memory region" can be given an address once and then when repeated, it will try to find a region just beyond the last one it printed. This continues until the end of the address space. Then it gives you an error showing the usage, which is odd because you just saw a bunch of "memory region" with no options work. So I've improved the error a bit to imply its to do with the repetition. Then described the repeating behaviour in the help text.
2026-01-23Revert "[lldb] Fix setting CanJIT if memory cannot be allocated (#176099)"Augusto Noronha1-55/+0
This reverts commit b5d8fc553d8e03f4d325458d29ac2c9e46a464e3.
2026-01-23[lldb] Fix setting CanJIT if memory cannot be allocated (#176099)Igor Kudrin1-0/+55
When a server is unable to allocate memory for the `_M` packet, it may respond with an error code. In this case, `GDBRemoteCommunicationClient::AllocateMemory()` sets `m_supports_alloc_dealloc_memory` to `eLazyBoolYes`; `eLazyBoolNo` is only used if the server cannot handle the packet at all. Before this patch, `ProcessGDBRemote::DoAllocateMemory()` checked this flag and returned `LLDB_INVALID_ADDRESS` without setting an error, which caused `Process::CanJIT()` to set `m_can_jit = eCanJITYes`, resulting in `IRMemoryMap::FindSpace()` attempting to allocate memory in the inferior process and failing. With the patch, `ProcessGDBRemote::DoAllocateMemory()` returns an error and `m_can_jit` is set to `eCanJITNo`. Example debug session: ``` (lldb) platform connect... (lldb) file test (lldb) br set... (lldb) run Process 100 launched:... Process 100 stopped * thread #1,... (lldb) expr $x0 error: Couldn't allocate space for materialized struct: Couldn't malloc: address space is full error: errored out in virtual lldb_private::LLVMUserExpression::DoExecute, couldn't PrepareToExecuteJITExpression ```
2026-01-23[lldb] Fix test_chained_frame_providers on 32-bit Arm (#177668)Leandro Lupori2-4/+4
PC addresses must always be 16-bit aligned on 32-bit Arm CPUs. Fixes #177666
2026-01-22[lldb] Improve error message when we can't save core (#177496)Jonas Devlieghere1-0/+29
When you specify a filename to `process save core`, we'll write it in the current working directory. In Xcode the CWD is `/` and you can't generally write there. ``` (lldb) process save-core --style full foo error: failed to save core file for process: Read-only file system ``` This PR improves the error message by including the output file when we can't save core. However, just printing the filename isn't that much more helpful, because FileSystem::Resolve only makes a path absolute if it exists. ``` error: failed to save core file for process to 'foo': Read-only file system ``` Therefore I also modified the interface to add a flag to force resolve a potentially non-exist path. ``` error: failed to save core file for process to '/foo': Read-only file system ```
2026-01-22[lldb][test] TestDataFormatterLibcxxOptionalSimulator.py: skip on older ↵Michael Buch1-8/+1
Clang versions
2026-01-22[lldb][test] Re-enable and fix TestUbsanBasic.pyMichael Buch3-3/+5
UBSAN stopped reporting the misaligned load since https://github.com/llvm/llvm-project/commit/5569bf26f0097c2d8b088f0a7cf46451da752dea so this test started failing. We skipped it to unblock CI. There's been discussion on making UBSAN stricter and still trigger on the one-line version of this. But for now, to get the test running again, change it to a form which *does* trigger UBSAN. Fixes https://github.com/llvm/llvm-project/issues/177064
2026-01-21[lldb] Skip TestUbsanBasic (#177263)Augusto Noronha1-0/+1
The fix for this is being discussed in https://github.com/llvm/llvm-project/issues/177064. Skip the test for now to get the bots green.
2026-01-21[lldb] Check multiword command in `UserCommandExists` (#176998)Ebuka Ezike1-1/+3
User created multiword command is not reported when querying `SBCommandInterpreter::UserCommandExists`
2026-01-17[lldb] Enable chaining multiple scripted frame providers per thread (#172849)Med Ismail Bennani2-0/+170
This patch allows threads to have multiple SyntheticFrameProviderSP instances that chain together sequentially. Each provider receives the output of the previous provider as input, creating a transformation pipeline. It changes `Thread::m_frame_provider_sp` to a vector, adds provider parameter to SyntheticStackFrameList to avoid calling back into `Thread::GetFrameProvider()` during frame fetching, updated `LoadScriptedFrameProvider()` to chain providers by wrapping each previous provider's output in a `SyntheticStackFrameList` for the next provider and finally, loads ALL matching providers in priority order instead of just the first one. The chaining works as follows: ``` Real Unwinder Frames ↓ Provider 1 (priority 10) → adds/transforms frames ↓ Provider 2 (priority 20) → transforms Provider 1's output ↓ Provider 3 (priority 30) → transforms Provider 2's output ↓ Final frame list shown to user ``` This patch also adds a test for this (test_chained_frame_providers) to verify that 3 providers chain correctly: `AddFooFrameProvider`, `AddBarFrameProvider`, `AddBazFrameProvider`. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-01-15Reland [LLDB] Fix MS STL variant with non-trivial types and PDB (#176189)Nerixyz2-0/+30
Relands #171489 which was reverted due to a test failure on GreenDragon. As suggested in https://github.com/llvm/llvm-project/pull/171489#issuecomment-3754098800, I'm checking for `std::string` on Darwin and `std::basic_string<char>` otherwise, however I can't test that locally.
2026-01-14Revert "[LLDB] Fix MS STL `variant` with non-trivial types" (#176059)Jonas Devlieghere2-26/+0
Reverts llvm/llvm-project#171489 because it causes `TestDataFormatterStdVariant.py` to fail on Darwin. Affected bots: - https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/ - https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake/
2026-01-14[NFC] Exactly one kind typo fixes, change defintions to definitions. (#174333)willmafh1-1/+1
2026-01-12[LLDB] Fix MS STL `variant` with non-trivial types (#171489)Nerixyz2-0/+26
When using `std::variant` with non-trivial types, we need to go through multiple bases to find the `_Which` member. The MSVC STL implements this in `xsmf_control.h` which conditionally adds/deletes copy/move constructors/operators. We now go to `_Variant_base` (the holder of `_Which`). This inherits from `_Variant_storage`, which is our entry point to finding the n-th storage (going through `_Tail`).
2026-01-09[lldb] Honor the process plugin name in the attach/launch info (#175195)Jonas Devlieghere1-0/+2
When connected to a GDB remote platform, we always use "gdb-remote" as the process plugin when attaching. This means that the `--plugin` argument to `process attach` is effectively ignored. This patch makes it so that "gdb-remote" remains the default, while still honoring the process plugin name specified in the attach info. The same thing applies to launching a process. rdar://167845923
2026-01-08[lldb] Add std::*_ordering summary providers (#174195)Sergei Druzhkov3-0/+70
I want to propose adding summary providers for `std::*_ordering` types introduced in `C++20`. GDB already has pretty-printers for [them](https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/python/libstdcxx/v6/printers.py#L1788), so I think it will be useful.
2026-01-08[LLDB] Run MSVC STL deque tests with PDB (#172360)Nerixyz1-0/+2
Similar to the other PRs, this looks up the type from a member variable. Here, we can use the type of `_Mapptr`. On its own, that's enough to pass the test with clang-cl.
2026-01-07[LLDB] Add MSVC STL span formatter (#173053)Nerixyz1-5/+24
`std::span` didn't have a formatter for MSVC's STL yet. The type is quite useful in C++ 20, so this PR adds a formatter for it. Since the formatter is new, I made it work with both DWARF and PDB from the start.
2026-01-06[lldb] Add libstdcpp string view summary provider (#171854)Sergei Druzhkov2-1/+5
This patch adds libstdcpp string view summary provider.
2026-01-06[lldb][Format] Unwrap references to C-strings when printing C-string ↵Michael Buch1-2/+4
summaries (#174398) Depends on: * https://github.com/llvm/llvm-project/pull/174385 (only last commit is relevant for this review) The `${var%s}` format isn't capable of formatting references to C-strings. So the summary for those becomes `<no value available>`. This patch prevents the system C-string formatter from applying to references, which means the summary for such types will be empty. This prompts LLDB to instead print the child, which is the referenced C-string. Before: ``` (lldb) v ref (const char *&) ref = 0x000000016fdfe960 <no value available> ``` After: ``` (lldb) v ref (const char *&) ref = 0x000000016fdfec40 (&ref = "hi") ``` An alternative would be to support references in the `ValueObject` dump methods. We assume C-string are pointers/arrays in a lot of places, so such a fix would be a more intrusive undertaking, and I'm not sure we would want to support references there in the first place. So for now I went with the fallback logic in this PR.
2026-01-05[lldb][test] Add tests for printing references to C-stringsMichael Buch2-0/+17
Printing references to C-strings doesn't work properly at the moment. This patch provides coverage for those cases and should fail once the underlying issue gets fixed (see https://github.com/llvm/llvm-project/pull/174398).
2026-01-05[lldb][test] Rewrite TestStringPrinter.py in a non-inline API test style ↵Michael Buch3-64/+109
(#174385) Motivation here is that I'm planning to add more test cases to this and it's easier to read/maintain as an API test. Drive-by: * I also removed the `std::string` checks since those belong in the STL formatter tests.
2025-12-19[LLDB] Run MSVC STL unordered tests with PDB (#172731)nerix1-6/+38
The unordered containers re-use the formatters for `std::list` which were fixed for PDB with #166953. This should be the last fix for PDB in MSVC STL tests. Unfortunately, the type names here are very long, because the types of keys/values are repeated in the template (for hash/eq/allocator).
2025-12-18[lldb/test] Fix failure caused by leading zero in TestScriptedFrameProvider.pyMed Ismail Bennani1-5/+5
This should fix a test failure in TestScriptedFrameProvider.py: https://lab.llvm.org/buildbot/#/builders/18/builds/23398/steps/6/logs/stdio This is a happening because on 32bit system, addresses don't have the leading zeroes. This patch removes them to satisfy the checks. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-18[lldb] Fix frame-format string missing space when module is invalid (#172767)Med Ismail Bennani2-0/+152
This patch is a follow-up to 96c733e to fix a missing space in the frame.pc format entity. This space was intended to be prepended to the module format entity scope but if the module is not valid, which is often the case for python pc-less scripted frames, the space between the pc and the function name is missing. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-18[LLDB] Run MSVC STL vector tests with PDB (#172726)nerix1-4/+16
2025-12-17Revert "Make result variables obey their dynamic values in subsequent ↵Dave Lee3-231/+0
expressions (#168611)" (#172780) [Green Dragon's lldb incremental tests (x86_64)](https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/) are failing beginning with https://github.com/llvm/llvm-project/pull/168611. This commit reverts that change. If the job continues to fail after committing this revert, then I will recommit the original. rdar://166741668 This reverts commit 6344e3aa8106dfdfb30cac36c8ca02bc4c52ce24.
2025-12-16[LLDB] Run MSVC STL atomic tests with PDB (#172349)nerix1-0/+2
Because PDB doesn't know about templates, we need to get to `T` of `std::atomic<T>` differently. The type includes the `value_type` typedef, which is always equal to `T`. The native PDB plugin includes this since #169248. Then we can run the `std::atomic` test with (native) PDB.
2025-12-15[lldb][test] Xfail 3 backtrace related tests on Windows on Arm (#172300)David Spickett1-0/+1
Since we updated our buildbot setup, these have been failing. Ignore them until we have time to find the real problem, which is something to do with failing to backtrace, or missing debug info when we do.
2025-12-14[NFCI][lldb][test][asm] Enable AT&T syntax explicitly (#166770)Raul Tambre8-5/+12
Implementation files using the Intel syntax typically explicitly specify it. Do the same for the few files using AT&T syntax. This enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's Clang config files (i.e. a global preference for Intel syntax).
2025-12-13Revert "[lldb/test] Enable debug info for ↵Med Ismail Bennani1-0/+3
TestFrameProviderCircularDependency.py" This reverts commit 13b4eb9452d37106b1143723e658010a9b58d344 since it doesn't fix the test failure. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-12[lldb/test] Enable debug info for TestFrameProviderCircularDependency.pyMed Ismail Bennani1-2/+0
This is necessary to get the function name in the test, following 20a6c59d8311d92bd8553b22b82a3874e0016edb. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-12[lldb] Add arm32/thumb register layout to Scripted{Frame,Thread} (#172005)Med Ismail Bennani2-2/+0
2025-12-11The C++ dynamic typing tests are failing on Windows, skip for now. (#171922)jimingham1-0/+2
This is a follow-on to: https://github.com/llvm/llvm-project/pull/168611 which added a bunch of tests for detecting dynamic types of C++ result variables. I don't actually know how well dynamic type detection works on Windows if at all. It would require Windows support, since the Linux/Darwin version is specific to the Itanium ABI.
2025-12-11Make result variables obey their dynamic values in subsequent expressions ↵jimingham3-0/+229
(#168611) When you run an expression and the result has a dynamic type that is different from the expression's static result type, we print the result variable using the dynamic type, but at present when you use the result variable in an expression later on, we only give you access to the static type. For instance: ``` (lldb) expr MakeADerivedReportABase() (Derived *) $0 = 0x00000001007e93e0 (lldb) expr $0->method_from_derived() ^ error: no member named 'method_from_derived' in 'Base' (lldb) ``` The static return type of that function is `Base *`, but we printed that the result was a `Derived *` and then only used the `Base *` part of it in subsequent expressions. That's not very helpful, and forces you to guess and then cast the result types to their dynamic type in order to be able to access the full type you were returned, which is inconvenient. This patch makes lldb retain the dynamic type of the result variable (and ditto for persistent result variables). It also adds more testing of expression result variables with various types of dynamic values, to ensure we can access both the ivars and methods of the type we print the result as.