aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API
AgeCommit message (Collapse)AuthorFilesLines
3 days[lldb] Use std::make_shared where possible (NFC) (#150714)Jonas Devlieghere5-42/+41
This is a continuation of 68fd102, which did the same thing but only for StopInfo. Using make_shared is both safer and more efficient: - With make_shared, the object and the control block are allocated together, which is more efficient. - With make_shared, the enable_shared_from_this base class is properly linked to the control block before the constructor finishes, so shared_from_this() will be safe to use (though still not recommended during construction).
5 days[lldb][headers] Fix header staging target for RPC (#150355)Chelsea Cassanova1-1/+3
This commit fixes the target that stages headers in the build dir's include directory so that the headers are staged correctly so that the target for liblldbrpc-headers can depend on it properly
10 days[lldb][framework] Glob headers from source for framework (#148736)Chelsea Cassanova1-2/+22
When gathering the headers to fix up and place in LLDB.framework, we were previously globbing the header files from a location in the build directory. This commit changes this to glob from the source directory instead, as we were globbing from the build directory without ensuring that the necessary files were actually in that location before globbing.
10 days[LLDB] Fix Memory64 BaseRVA, move all non-stack memory to Mem64. (#146777)Jacob Lalonde2-1/+35
### Context Over a year ago, I landed support for 64b Memory ranges in Minidump (#95312). In this patch we added the Memory64 list stream, which is effectively a Linked List on disk. The layout is a sixteen byte header and then however many Memory descriptors. ### The Bug This is a classic off-by one error, where I added 8 bytes instead of 16 for the header. This caused the first region to start 8 bytes before the correct RVA, thus shifting all memory reads by 8 bytes. We are correctly writing all the regions to disk correctly, with no physical corruption but the RVA is defined wrong, meaning we were incorrectly reading memory ![image](https://github.com/user-attachments/assets/049ef55d-856c-4f3c-9376-aeaa3fe8c0e1) ### Why wasn't this caught? One problem we've had is forcing Minidump to actually use the 64b mode, it would be a massive waste of resources to have a test that actually wrote >4.2gb of IO to validate the 64b regions, and so almost all validation has been manual. As a weakness of manual testing, this issue is psuedo non-deterministic, as what regions end up in 64b or 32b is handled greedily and iterated in the order it's laid out in /proc/pid/maps. We often validated 64b was written correctly by hexdumping the Minidump itself, which was not corrupted (other than the BaseRVA) ![image](https://github.com/user-attachments/assets/b599e3be-2d59-47e2-8a2d-75f182bb0b1d) ### Why is this showing up now? During internal usage, we had a bug report that the Minidump wasn't displaying values. I was unable to repro the issue, but during my investigation I saw the variables were in the 64b regions which resulted in me identifying the bug. ### How do we prevent future regressions? To prevent regressions, and honestly to save my sanity for figuring out where 8 bytes magically came from, I've added a new API to SBSaveCoreOptions. ```SBSaveCoreOptions::GetMemoryRegionsToSave()``` The ability to get the memory regions that we intend to include in the Coredump. I added this so we can compare what we intended to include versus what was actually included. Traditionally we've always had issues comparing regions because Minidump includes `/proc/pid/maps` and it can be difficult to know what memoryregion read failure was a genuine error or just a page that wasn't meant to be included. We are also leveraging this API to choose the memory regions to be generated, as well as for testing what regions should be bytewise 1:1. After much debate with @clayborg, I've moved all non-stack memory to the Memory64 List. This list doesn't incur us any meaningful overhead and Greg originally suggested doing this in the original 64b PR. This also means we're exercising the 64b path every single time we save a Minidump, preventing regressions on this feature from slipping through testing in the future. Snippet produced by [minidump.py](https://github.com/clayborg/scripts) ``` MINIDUMP_MEMORY_LIST: NumberOfMemoryRanges = 0x00000002 MemoryRanges[0] = [0x00007f61085ff9f0 - 0x00007f6108601000) @ 0x0003f655 MemoryRanges[1] = [0x00007ffe47e50910 - 0x00007ffe47e52000) @ 0x00040c65 MINIDUMP_MEMORY64_LIST: NumberOfMemoryRanges = 0x000000000000002e BaseRva = 0x0000000000042669 MemoryRanges[0] = [0x00005584162d8000 - 0x00005584162d9000) MemoryRanges[1] = [0x00005584162d9000 - 0x00005584162db000) MemoryRanges[2] = [0x00005584162db000 - 0x00005584162dd000) MemoryRanges[3] = [0x00005584162dd000 - 0x00005584162ff000) MemoryRanges[4] = [0x00007f6100000000 - 0x00007f6100021000) MemoryRanges[5] = [0x00007f6108800000 - 0x00007f6108828000) MemoryRanges[6] = [0x00007f6108828000 - 0x00007f610899d000) MemoryRanges[7] = [0x00007f610899d000 - 0x00007f61089f9000) MemoryRanges[8] = [0x00007f61089f9000 - 0x00007f6108a08000) MemoryRanges[9] = [0x00007f6108bf5000 - 0x00007f6108bf7000) ``` ### Misc As a part of this fix I had to look at LLDB logs a lot, you'll notice I added `0x` to many of the PRIx64 `LLDB_LOGF`. This is so the user (or I) can directly copy paste the address in the logs instead of adding the hex prefix themselves. Added some SBSaveCore tests for the new GetMemoryAPI, and Docstrings. CC: @DavidSpickett, @da-viper @labath because we've been working together on save-core plugins, review it optional and I didn't tag you but figured you'd want to know
2025-07-10[lldb] Support specifying a language for breakpoint conditions (#147603)Jonas Devlieghere3-6/+7
LLDB breakpoint conditions take an expression that's evaluated using the language of the code where the breakpoint is located. Users have asked to have an option to tell it to evaluate the expression in a specific language. This is feature is especially helpful for Swift, for example for a condition based on the value in memory at an offset from a register. Such a condition is pretty difficult to write in Swift, but easy in C. This PR adds a new argument (-Y) to specify the language of the condition expression. We can't reuse the current -L option, since you might want to break on only Swift symbols, but run a C expression there as per the example above. rdar://146119507
2025-07-09[lldb] Change breakpoint interfaces for error handling (#146972)Jonas Devlieghere1-1/+1
This RP changes some Breakpoint-related interfaces to return errors. On its own these improvements are small, but they encourage better error handling going forward. There are a bunch of other candidates, but these were the functions that I touched while working on #146602.
2025-07-03[lldb] Add SB API to make a breakpoint a hardware breakpoint (#146602)Jonas Devlieghere1-0/+12
This adds SBBreakpoint::SetIsHardware, allowing clients to mark an existing breakpoint as a hardware breakpoint purely through the API. This is safe to do after creation, as the hardware/software distinction doesn't affect how breakpoint locations are selected. In some cases (e.g. when writing a trap instruction would alter program behavior), it's important to use hardware breakpoints. Ideally, we’d extend the various `Create` methods to support this, but given their number, this patch limits the scope to the post-creation API. As a workaround, users can also rely on target.require-hardware-breakpoint or use the `breakpoint set` command. rdar://153528045
2025-06-26[lldb][scripts] Use named args in versioning script (#145993)Chelsea Cassanova1-1/+1
Using named args means that you don't need to keep track of 5 positional args.
2025-06-20[LLDB] Explicitly use python for version fixup (#144217)nerix1-1/+1
On Windows, the post build command would open the script in the default editor, since it doesn't know about shebangs. This effectively adds `python3` in front of the command. Amends https://github.com/llvm/llvm-project/pull/142871 / https://github.com/llvm/llvm-project/pull/141116
2025-06-10Reland "[lldb][headers] Create script to fix up versioning" (#142864)" (#142871)Chelsea Cassanova1-0/+39
This relands the original commit for the versioning script in LLDB. This commit uses '>' for output from `unifdef` for platforms that have that executable but do not have the `-o` option. It also fixes the Xcode build by adding a dependency between the liblldb-header-staging target in the source/API/CMakeLists.txt the `liblldb-resource-headers` target in LLDBFramework.cmake. Original patch: https://github.com/llvm/llvm-project/pull/141116
2025-06-10[lldb/cmake] Use ADDITIONAL_HEADER(_DIR)?S (#142587)Pavel Labath1-0/+2
Replace (questionable) header globs with an explicit argument supported by llvm_add_library.
2025-06-04Revert "[lldb][headers] Create script to fix up versioning" (#142864)Chelsea Cassanova1-39/+0
Reverts llvm/llvm-project#141116. It's breaking the Xcode build as well as the build on AIX.
2025-06-04[lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)Pavel Labath1-2/+2
If we're not touching them, we don't need to do anything special to pass them along -- with one important caveat: due to how cmake arguments work, the implicitly passed arguments need to be specified before arguments that we handle. This isn't particularly nice, but the alternative is enumerating all arguments that can be used by llvm_add_library and the macros it calls (it also relies on implicit passing of some arguments to llvm_process_sources).
2025-06-03[lldb][headers] Create script to fix up versioning (#141116)Chelsea Cassanova1-0/+39
This commit creates a Python script that fixes up the versioning information in lldb-defines.h. It also moves the build logic for fixing up the lldb headers from being in the framework only to being in the same location that we create the liblldb target.
2025-06-02[lldb] Refactor away UB in SBValue::GetLoadAddress (#141799)Pavel Labath1-4/+2
The problem was in calling GetLoadAddress on a value in the error state, where `ValueObject::GetLoadAddress` could end up accessing the uninitialized "address type" by-ref return value from `GetAddressOf`. This probably happened because each function expected the other to initialize it. We can guarantee initialization by turning this into a proper return value. I've added a test, but it only (reliably) crashes if lldb is built with ubsan.
2025-05-31[lldb-dap] Reuse source object logics (#141426)Ely Ronnen1-4/+7
Refactor code revolving source objects such that most logics will be reused. The main change is to expose a single `CreateSource(addr, target)` that can return either a normal or an assembly source object, and call `ShouldDisplayAssemblySource()` only from this function instead of multiple places across the code. Other functions can use `source.IsAssemblySource()` in order to check which type the source is.
2025-05-30[lldb][lldb-dap] Use the default disassembly flavour if none is provided. ↵Ebuka Ezike1-1/+20
(#141424) This is the currently the default for `SBTarget::ReadInstructions(SBAddress, uint32_t)`. But not for others, to make it consistent used the user assigned instruction flavour.
2025-05-29[LLDB] [NFC] - Remove duplicate #include headers from the files of lldb dir ↵Akash Agrawal2-2/+0
& few other files (#141478) A few files of lldb dir & few other files had duplicate headers included. This patch removes those redundancies. --------- Co-authored-by: Akash Agrawal <akashag@qti.qualcomm.com>
2025-05-28[lldb] Use if-with-initializer pattern in SBTarget (NFC) (#141284)Jonas Devlieghere1-336/+238
Use the if statement with an initializer pattern that's very common in LLVM in SBTarget. Every time someone adds a new method to SBTarget, I want to encourage using this pattern, but I don't because it would be inconsistent with the rest of the file. This solves that problem by switching over the whole file.
2025-05-28[lldb][Formatters] Add --pointer-match-depth option to `type summary add` ↵Zequan Wu1-0/+16
command. (#138209) Currently, the type `T`'s summary formatter will be matched for `T`, `T*`, `T**` and so on. This is unexpected in many data formatters. Such unhandled cases could cause the data formatter to crash. An example would be the lldb's built-in data formatter for `std::optional`: ``` $ cat main.cpp #include <optional> int main() { std::optional<int> o_null; auto po_null = &o_null; auto ppo_null = &po_null; auto pppo_null = &ppo_null; return 0; } $ clang++ -g main.cpp && lldb -o "b 8" -o "r" -o "v pppo_null" [lldb crash] ``` This change adds an options `--pointer-match-depth` to `type summary add` command to allow users to specify how many layer of pointers can be dereferenced at most when matching a summary formatter of type `T`, as Jim suggested [here](https://github.com/llvm/llvm-project/pull/124048/#issuecomment-2611164133). By default, this option has value 1 which means summary formatter for `T` could also be used for `T*` but not `T**` nor beyond. This option is no-op when `--skip-pointers` is set as well. I didn't add such option for `type synthetic add`, `type format add`, `type filter add`, because it useful for those command. Instead, they all have the pointer match depth of 1. When printing a type `T*`, lldb never print the children of `T` even if there is a synthetic formatter registered for `T`.
2025-05-21[lldb-dap] fix disassembly request instruction offset handling (#140486)Ely Ronnen1-0/+20
Fix the handling of the `instructionOffset` parameter, which resulted in always returning the wrong disassembly because VSCode always uses `instructionOffset = -50` and expects 50 instructions before the given address, instead of 50 bytes before
2025-05-20[lldb] Retcon SBValue::GetChildAtIndex(synthetic=true) (#140065)Pavel Labath1-10/+9
The motivation here is being (un)able to treat pointer values as an array consistently. This works for pointers to simple/scalar values, but for aggregates, we get a very surprising result: - GetChildAtIndex(x, ??, true) returns the `x` child of the zeroth array member (the one you get by dereferencing the pointer/array) for all `x` which are smaller than the number of children of that value. - for other values of `x`, we get `v[x]`, where `v` is treated like a (C) pointer This patch reimagines this interface so that the value of `true` always treats (pointer and array) values as pointers. For `false`, we always dereference pointers, while in the case of arrays, we only return the values as far as the array bounds will allow. This has the potential to break existing code, but I have a suspicion that code was already broken to begin with, which is why I think this would be better than introducing a new API and keeping the old (and surprising) behavior. If our own test coverage is any indication, breakage should be minimal.
2025-05-10[lldb] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#139395)Kazu Hirata1-1/+1
2025-05-09[LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in ↵Jacob Lalonde1-0/+14
bytes (#138169) My current internal work requires some sensitivity to IO usage. I had a work around to calculate the expected size of a Minidump, but I've added this PR so an automated system could look at the expected size of an LLDB generated Minidump and then choose if it has the space or wants to generate it. There are some prerequisites to calculating the correct size, so I have the API take a reference for an SBError, I originally tried to return an SBError and instead take a uint64_t reference, but this made the API very difficult to use in python. Added a test case as well.
2025-05-08[lldb] Expose QueueThreadPlanForStepSingleInstruction function to ↵Ely Ronnen1-0/+23
SBThreadPlan (#137904) Expose `QueueThreadPlanForStepSingleInstruction` function to SBThreadPlan
2025-04-30[lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (#136693)Charles Zablit1-3/+5
This patch replaces the use of `UINT32_MAX` as the error return value of `GetIndexOfChildWithName` with `llvm::Expected`. # Tasks to do in another PR 1. Replace `CalculateNumChildrenIgnoringErrors` with `CalculateNumChildren`. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2056319358). 2. Update `lldb_private::formatters::ExtractIndexFromString` to use `llvm::Expected`. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2054217536). 3. Create a new class which carries both user and internal errors. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2056439608).
2025-04-29[lldb] Remove "error:" prefix from reverse execute error messagesDavid Spickett1-1/+1
Errors will get "error:" prefixes automatically so this is not needed.
2025-04-26[LLDB][Telemetry] Collect telemetry from client when allowed. (#129728)Vy Nguyen1-0/+11
This patch is slightly different from other impl in that we dispatch client-telemetry via a different helper method. This is to make it easier for vendor to opt-out (simply by overriding the method to do nothing). There is also a configuration option to disallow collecting client telemetry. --------- Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-04-23[lldb] returning command completions up to a maximum (#135565)Ely Ronnen1-1/+14
- Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. Fixes #135553
2025-04-23[lldb-dap] Show load addresses in disassembly (#136755)Ely Ronnen1-3/+13
Improves the lldb-dap disassembly by showing load addresses in disassembly, same as in a regular LLDB `disassemble` command by default. Before: ![Screenshot From 2025-04-22 21-33-56](https://github.com/user-attachments/assets/c3febd48-8335-4932-a270-5a87f48122fe) After: ![Screenshot From 2025-04-22 21-54-51](https://github.com/user-attachments/assets/b2f44595-8ab2-4f28-aded-9233c53a589b)
2025-04-15[lldb] Make SBProcess thread related actions listen to StopLocker (#134339)Wanyi1-9/+11
# Summary This PR updates `SBProcess::GetNumThreads()` and `SBProcess::GetThreadAtIndex()` to listen to the stop locker. `SBProcess::GetNumThreads()` will return 0 if the process is running. ## Problem Description Recently upon debugging a program with thousands of threads in VS Code, lldb-dap would hang at a `threads` request sent right after receiving the `configurationDone` response. Soon after it will end the debug session with the following error ``` Process <pid> exited with status = -1 (0xffffffff) lost connection ``` This is because LLDB is still in the middle of resuming all the threads. And requesting threads will end up interrupt the process on Linux. From the gdb-remote log it ended up getting `lldb::StateType::eStateInvalid` and just exit with status -1. I don't think it's reasonable to allow getting threads from a running process. There are a few approaches to fix this: 1) Send the stopped event to IDE after `configurationDone`. This aligns with the CLI behavior. 2) However, the above approach will break the existing user facing behavior. The alternative will be reject the `threads` request if the process is not stopped. 3) Improve the run lock. This is a synchronize issue where process was in the middle of resuming while lldb-dap attempts to interrupt it. **This PR implements the option 3** ## HOWEVER This fixed the "lost connection" issue below but new issue has surfaced. From testing, and also from checking the [VSCode source code](https://github.com/microsoft/vscode/blob/174af221c9ea2ccdb64abe4aab8e1a805e77beae/src/vs/workbench/contrib/debug/browser/debugSession.ts#L791), it expects having threadID to perform `pause`. So after attaching, without any threads reported to the client, the user will not be able to pause the attached process. `setBreakpoint` will still work and once we make a stop at the bp (or any stop that will report threads, client can perform pause again. ## NEXT 1) Made an attempt to return initial thread list so that VSCode can pause (second commit in the PR) 2) Investigate why threads will trigger unwinding the second frame of a thread, which leads to sending the interrupt 3) Decided if we want to support `stopOnEntry` for attaching, given i. This is not an official specification ii. If enable stopOnEntry, we need to fix attaching on Linux, to send only one stopped event. Currently, all threads upon attaching will have stop reason `SIGSTOP` and lldb-dap will send `stopped` event for each one of them. Every `stopped` will trigger the client request for threads. iii. Alternatively, we can support auto continue correspond to `(lldb) process attach --continue`. This require the ii above. ### Additionally lldb-dap will not send a `continued` event after `configurationDone` because it checks `dap.focus_tid == LLDB_INVALID_THREAD_ID` (so that we don't send it for `launch` request). Notice `dap.focus_tid` will only get assigned when handling stop or stepping. According to DAP > Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. launch or continue. It is only necessary to send a continued event if there was no previous request that implied this. So I guess we are not violating DAP if we don't send `continued` event. But I'd like to get some sense about this. ## Test Plan Used following program for testing: https://gist.github.com/kusmour/1729d2e07b7b1063897db77de194e47d **NOTE: Utilize stdin to get pid and attach AFTER hitting enter. Attach should happen when all the threads start running.** DAP messages before the change <img width="1165" alt="image" src="https://github.com/user-attachments/assets/a9ad85fb-81ce-419c-95e5-612639905c66" /> DAP message after the change - report zero threads after attaching <img width="1165" alt="image" src="https://github.com/user-attachments/assets/a1179e18-6844-437a-938c-0383702294cd" /> --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-04-13[lldb] Remove vestigial remnants of reproducers (#135361)Pavel Labath1-18/+2
Not touching the SB API.
2025-04-11[lldb] Fix SBTarget::ReadInstruction with flavor (#134626)Ebuka Ezike1-3/+3
When you call the `SBTarget::ReadInstructions` with flavor from lldb crashes. This is because the wrong order of the `DisassemblyBytes` constructor this fixes that --------- Signed-off-by: Ebuka Ezike <yerimyah1@gmail.com>
2025-04-08[LLDB][NFC] Remove Debugger dependency in SystemLifetimeManager (#134383)Dmitry Vasilyev2-40/+45
It reduces the memory usage in lldb-server.
2025-04-03Revert "[LLDB] Expose checking if the symbol file exists/is loaded via ↵Jacob Lalonde1-12/+0
SBModule" (#134341) Reverts llvm/llvm-project#134163 Reverting while @clayborg and I come up with a better API
2025-04-02[LLDB] Expose checking if the symbol file exists/is loaded via SBModule ↵Jacob Lalonde1-0/+12
(#134163) The motivation for this patch is that in Statistics.cpp we [check to see if the module symfile is loaded](https://github.com/llvm/llvm-project/blob/990a086d9da0bc2fd53a6a4c95ecbbe23a297a83/lldb/source/Target/Statistics.cpp#L353C60-L353C75) to calculate how much debug info has been loaded. I have an external utility that only wants to look at the loaded debug info, which isn't exposed by the SBAPI.
2025-03-31[lldb] Expose the Target API mutex through the SB API (#133295)Jonas Devlieghere3-4/+73
Expose u target API mutex through the SB API. This is motivated by lldb-dap, which is built on top of the SB API and needs a way to execute a series of SB API calls in an atomic manner (see #131242). We can solve this problem by either introducing an additional layer of locking at the DAP level or by exposing the existing locking at the SB API level. This patch implements the second approach. This was discussed in an RFC on Discourse [0]. The original implementation exposed a move-only lock rather than a mutex [1] which doesn't work well with SWIG 4.0 [2]. This implement the alternative solution of exposing the mutex rather than the lock. The SBMutex conforms to the BasicLockable requirement [3] (which is why the methods are called `lock` and `unlock` rather than Lock and Unlock) so it can be used as `std::lock_guard<lldb::SBMutex>` and `std::unique_lock<lldb::SBMutex>`. [0]: https://discourse.llvm.org/t/rfc-exposing-the-target-api-lock-through-the-sb-api/85215/6 [1]: https://github.com/llvm/llvm-project/pull/131404 [2]: https://discourse.llvm.org/t/rfc-bumping-the-minimum-swig-version-to-4-1-0/85377/9 [3]: https://en.cppreference.com/w/cpp/named_req/BasicLockable
2025-03-18[lldb] Fix double free in CommandPluginInterfaceImplementation (#131658)Jonas Devlieghere1-1/+1
The class was taking ownership of the SBCommandPluginInterface pointer it was passed in, by wrapping it in a shared pointer. This causes a double free in the unit test when the object is destroyed and the same pointer gets freed once when the SBCommandPluginInterface goes away and then again when the shared pointer hits a zero refcount.
2025-03-17Reapply "[lldb] Implement basic support for reverse-continue (#125242)" ↵Pavel Labath2-0/+14
(again) (#128156) This reverts commit https://github.com/llvm/llvm-project/commit/87b7f63a117c340a6d9ca47959335fd7ef6c7ad2, reapplying https://github.com/llvm/llvm-project/commit/7e66cf74fb4e6a103f923e34700a7b6f20ac2a9b with a small (and probably temporary) change to generate more debug info to help with diagnosing buildbot issues.
2025-03-14[lldb] Sort source files alphabetically in API/CMakeLists.txt (NFC)Jonas Devlieghere1-4/+4
2025-03-10[lldb] fix set SBLineEntryColumn (#130435)Ebuka Ezike1-1/+1
Calling the public API `SBLineEntry::SetColumn()` sets the row instead of the column. This probably should be backported as it has been since version 3.4. --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-03-08[lldb] Remove progress report coalescing (#130329)Jonas Devlieghere1-6/+0
Remove support for coalescing progress reports in LLDB. This functionality was motivated by Xcode, which wanted to listen for less frequent, aggregated progress events at the cost of losing some detail. See the original RFC [1] for more details. Since then, they've reevaluated this trade-off and opted to listen for the regular, full fidelity progress events and do any post processing on their end. rdar://146425487
2025-03-05[lldb] Upgrade CompilerType::GetBitSize to return llvm::Expected (#129601)Adrian Prantl2-3/+3
This patch pushes the error handling boundary for the GetBitSize() methods from Runtime into the Type and CompilerType APIs. This makes it easier to diagnose problems thanks to more meaningful error messages being available. GetBitSize() is often the first thing LLDB asks about a type, so this method is particularly important for a better user experience. rdar://145667239
2025-03-03[LLDB][SBProgress] Add a finalize method (#128966)Jacob Lalonde1-0/+12
This patch adds a finalize method which destroys the underlying RAII SBProgress. My primary motivation for this is so I can write better tests that are non-flaky, but after discussing with @clayborg in my DAP message improvement patch (#124648) this is probably an essential API despite that I originally argued it wasn't.
2025-02-27[LLDB][SBProgress] Fix bad optional in sbprogress (#128971)Jacob Lalonde1-1/+4
This fixes the obvious, but untested case of sending None/Null to SBProgress.
2025-02-24[lldb] do not show misleading error when there is no frame (#119103)oltolm1-17/+10
I am using VSCode with the official vscode-lldb extension. When I try to list the breakpoints in the debug console get the message: ``` br list can't evaluate expressions when the process is running. ``` I know that this is wrong and you need to use ``` `br list (lldb) br list No breakpoints currently set. ``` but the error message is misleading. I cleaned up the code and now the error message is ``` br list sbframe object is not valid. ``` which is still not perfect, but at least it's not misleading.
2025-02-21[lldb][cmake] Use STATUS instead of explicit '--' in message logging (#128196)foxtran1-6/+6
Currently, configuring lldb with cmake with separated stdout and stderr gives some unnecessary output in stderr which happens since message statement is used without `[mode]` (See https://cmake.org/cmake/help/v3.31/command/message.html). This patch adds mode `STATUS` instead of explicit `--` at the beginning of messages.
2025-02-19[lldb] Store the return SBValueList in the CommandReturnObject (#127566)Jonas Devlieghere1-0/+18
There are a lot of lldb commands whose result is really one or more ValueObjects that we then print with the ValueObjectPrinter. Now that we have the ability to access the SBCommandReturnObject through a callback (#125006), we can store the resultant ValueObjects in the return object, allowing an IDE to access the SBValues and do its own rich formatting. rdar://143965453
2025-02-19[lldb] Make GetOutputStreamSP and GetErrorStreamSP protected (#127682)Jonas Devlieghere1-6/+6
This makes GetOutputStreamSP and GetErrorStreamSP protected members of Debugger. Users who want to print to the debugger's stream should use GetAsyncOutputStreamSP and GetAsyncErrorStreamSP instead and the few remaining stragglers have been migrated.
2025-02-17[lldb][TypeSystemClang] Add support for floating point template argument ↵Michael Buch1-2/+2
constants (#127206) This patch adds support for template arguments of `clang::TemplateArgument::ArgKind::StructuralValue` kind (added in https://github.com/llvm/llvm-project/pull/78041). These are used for non-type template parameters such as floating point constants. When LLDB created `clang::NonTypeTemplateParmDecl`s, it previously assumed integral values, this patch accounts for structural values too. Anywhere LLDB assumed a `DW_TAG_template_value_parameter` was `Integral`, it will now also check for `StructuralValue`, and will unpack the `TemplateArgument` value and type accordingly. We can rely on the fact that any `TemplateArgument` of `StructuralValue` kind that the `DWARFASTParserClang` creates will have a valid value, because it gets those from `DW_AT_const_value`.