aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/CPlusPlus
AgeCommit message (Collapse)AuthorFilesLines
14 days[lldb] Add unreachable after fully covered switches, avoid GCC warnings. ↵Martin Storsjö1-0/+1
NFC. (#159327) This avoids the following kind of warning with GCC: warning: control reaches end of non-void function [-Wreturn-type]
2025-09-15[lldb] Fix unordered-map data formatter for const types (#156033)Ebuka Ezike1-4/+5
The test was failing because the const qualifier is not removed when checking if the type is an `unordered_map`
2025-09-12[lldb] Fixed UB in CPlusPlusLanguage plug-in (#158304)Dmitry Vasilyev2-4/+8
C++11 allows the use of Universal Character Names (UCNs) in identifiers, including function names. According to the spec the behavior of std::isalpha(ch) and std::isalnum(ch) is undefined if the argument's value is neither representable as unsigned char nor equal to EOF. To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char.
2025-09-05[lldb][DataFormatter] Allow std::string formatters to match against custom ↵Michael Buch1-33/+17
allocators (#156050) This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`.
2025-09-04[lldb] Correct style of error messages (#156774)Jonas Devlieghere2-10/+10
The LLVM Style Guide says the following about error and warning messages [1]: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. I often provide this feedback during code review, but we still have a bunch of places where we have inconsistent error message, which bothers me as a user. This PR identifies a handful of those places and updates the messages to be consistent. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages
2025-08-27[lldb][CPlusPlusLanguage] Expose ManglingSubstitutor as static helpers (#155483)Michael Buch2-134/+258
Part of https://github.com/llvm/llvm-project/pull/149827 Allows us to use the mangling substitution facilities in CPlusPlusLanguage but also SymbolFileDWARF. Added tests now that they're "public".
2025-08-25[lldb][DataFormatters] Support newer _LIBCPP_COMPRESSED_PAIR layout (#155153)Michael Buch6-90/+118
Starting with https://github.com/llvm/llvm-project/pull/154686 the compressed_pair children are now wrapped in an anonymous structure. This patch adjusts the LLDB data-formatters to support that. Outstanding questions: 1. Should GetChildMemberWithName look through anonymous structures? That will break users most likely. But maybe introducing a new API is worth it? Then we wouldnt have to do this awkward passing around of `anon_struct_index` 2. Do we support the layout without the anonymous structure? It's not too much added complexity. And we did release that version of libc++, so there is code out there compiled against it. But there is no great way of testing it (some of our macOS matrix bots do test it i suppose, but not in a targeted way). We have the layout "simulator" tests for some of the STL types which I will adjust.
2025-08-15[lldb] Fix CXX's SymbolNameFitsToLanguage matching other languages (#153685)Augusto Noronha1-1/+3
The current implementation of CPlusPlusLanguage::SymbolNameFitsToLanguage will return true if the symbol is mangled for any language that lldb knows about.
2025-08-11[lldb] Fix libstdc++ std::string formatter after #147835 (#152993)David Spickett1-3/+4
https://github.com/llvm/llvm-project/pull/147835 made changes that caused libstdc++ std::string tests to fail: ``` ====================================================================== FAIL: test_unavailable_summary_libstdcxx_dwo (TestDataFormatterStdString.StdStringDataFormatterTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1805, in test_method return attrvalue(self) File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py", line 223, in test_unavailable_summary_libstdcxx self.do_test_summary_unavailable() File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py", line 213, in do_test_summary_unavailable self.assertEqual(summary, "Summary Unavailable", "No summary for bad value") AssertionError: '(null)' != 'Summary Unavailable' - (null) + Summary Unavailable : No summary for bad value Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang ---------------------------------------------------------------------- ``` This test constructs an invalid std::string by starting with a null pointer. Somehow this improvement in Clang uncovered a bug in the formatter. Perhaps because we now know the type of the field we tried to access is char *, so fall back to a C string formatter that produces `(null)`. The formatter tries to access `_M_p` and checked whether the resulting ValueObjectSP was null, but not that it did not contain an error value. I think that error value can be there if you are able to access one part of the path, `_M_dataplus`, but another part fails. Since the layout looks like this: ``` struct _Alloc_hider : { pointer _M_p; // The actual data. }; _Alloc_hider _M_dataplus; void _M_data(pointer __p) { _M_dataplus._M_p = __p; } ``` So I think we were able to read `_M_dataplus` just by offset, but then failed because it contains, or points to something containing nulls or a null pointer. Or perhaps an error value means we know what the class member is, but could not read from it. I found this by comparing with the libcxx formatter, so I've copied the same handling from there to fix the issue.
2025-08-07[lldb][Mangled] Move SuffixRange computation into TrackingOutputBuffer (#152483)Michael Buch2-13/+16
This way all the tracking is self-contained in `TrackingOutputBuffer` and we can test the `SuffixRange` properly.
2025-08-05[lldb][CPlusPlusLanguage] Create public accessors for getting ↵Michael Buch2-37/+121
DemangledNameInfo components and use them in tests (#152134) This way we make sure that the logic to reconstruct demangled names in the tests is the same as the logic when reconstructing the actual frame-format variable. `DemangledNameInfo::SuffixRange` is currently the only one which we can't test in the same way until we set it from inside the `TrackingOutputBuffer`. I added TODOs to track this.
2025-08-05[lldb] add TemplateRange and NameQualifiersRange to DemangledNameInfo (#150999)Charles Zablit1-5/+5
This patch adds 2 new attributes to `DemangledNameInfo`: `TemplateRange` and `NameQualifiersRange`. It also introduces the `function.name-qualifiers` entity formatter which allows tracking qualifiers between the name of a function and its arguments/template. This will be used downstream in Swift but may have applications in C++: https://github.com/swiftlang/llvm-project/pull/11068.
2025-07-25[LLDB] Add formatters for MSVC STL std::string_view and friends (#150318)nerix3-0/+124
Adds summaries for `std::{,w,u8,u16,u32}string_view`s from MSVC's STL. A few functions from the string formatting can be reused. Towards #24834.
2025-07-23[LLDB] Add formatters for MSVC STL std::deque (#150097)nerix4-5/+204
This PR adds synthetic children for std::deque from MSVC's STL. Similar to libstdc++ and libc++, the elements are in a `T**`, so we need to "subscript" twice. The [NatVis for deque](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L1103-L1112) uses `_EEN_DS` which contains the block size. We can't access this, but we can access the [constexpr `_Block_size`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/deque#L641). Towards #24834.
2025-07-23[LLDB] Add formatters for MSVC STL map-like types (#148385)nerix4-16/+463
This PR adds formatters for `std::map`, `std::set`, `std::multimap`, `std::multiset` as well as their iterators. It's done in one PR because the types are essentially the same (a tree) except for their value type. The iterators are required because of the tests. `MsvcStlTreeIterSyntheticFrontEnd` is based on the libc++ equivalent. As opposed to `std::list`, there aren't that many duplicates, so I didn't create a generic type. For reference, the tree is implemented in https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/xtree. Towards #24834.
2025-07-22[LLDB] Add formatters for MSVC STL unordered containers (#149519)nerix4-4/+100
Adds formatters for MSVC STL's unordered containers. This one is relatively simple, because it can reuse the `std::list` synthetic children. The unordered containers (aka [`_Hash`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/xhash#L327)) contain a [`_List`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/xhash#L2012) which contains all elements (and is used for iterating through the container). Towards https://github.com/llvm/llvm-project/issues/24834.
2025-07-22[LLDB] Add formatters for MSVC STL std::atomic (#149801)nerix4-0/+123
Adds synthetic children and a summary provider for `std::atomic` on MSVC's STL. This currently only supports DWARF because it relies on the template argument. Once there are PDB tests, this will probably use the return type of some method like `value()` because template types aren't available there. Towards #24834.
2025-07-21[LLDB] Add formatters for MSVC STL std::variant (#148554)nerix5-8/+225
Adds a summary and synthetic children for MSVC STL's `std::variant`. This one is a bit complicated because of DWARF vs PDB differences. I put the representations in comments. Being able to `GetChildMemberWithName` a member in an anonymous union would make this a lot simpler (`std::optional` will have something similar iirc). Towards #24834.
2025-07-21[LLDB] Add formatters for MSVC STL std::optional (#149545)nerix3-12/+50
Adds synthetic children for `std::optional` from MSVC's STL. Most of the machinery for `std::optional` is already there. Towards #24834.
2025-07-16[LLDB] Add formatters for MSVC STL std::(forward_)list (#148285)nerix4-61/+301
Adds synthetic providers for MSVC's `std::forward_list` and `std::list`. It refactors `LibCxxList` to be generic over the STL type (currently libc++ or MSVC STL). The libstdc++ synthetic providers use something similar in Python [here](https://github.com/llvm/llvm-project/blob/3092b765ba0b2d20bd716944dda86ea8e4ad12e3/lldb/examples/synthetic/gnu_libstdcpp.py#L134). Eventually, this could be ported to C++ as well. Towards #24834.
2025-07-16[LLDB] Convert libstdc++ std::variant summary to C++ (#148929)nerix3-5/+53
This PR converts the `std::variant` summary from Python to C++. Split from #148554. MSVC's STL and libstdc++ use the same type name for `std::variant`, thus they need one "dispatcher" function that checks the type and calls the appropriate summary. For summaries, both need to be implemented in C++. This is mostly a 1:1 translation. The main difference is that in C++, the summary returns `false` if it can't inspect the object properly (e.g. a member could not be found). In Python, this wasn't possible.
2025-07-16[LLDB] Add formatters for MSVC STL std::vector (#147538)nerix4-5/+336
This adds synthetic child providers for `std::vector<T>` and `std::vector<bool>` for MSVC's STL. The structure of a `std::vector<T>` is relatively similar to libc++'s implementation that uses `__begin` and `__end`. `std::vector<bool>` is different. It's a `std::vector<unsigned int>` wrapper instead of `std::vector<uint8_t>`. This makes the calculation slightly less simple. I put a comment in the `GetChildAtIndex` to make this clear. - [NatVis for `std::vector<T>`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L1193-L1205) - [NatVis for `std::vector<bool>`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L1167-L1179) Towards #24834.
2025-07-15[LLDB] Add formatters for MSVC STL std::tuple (#148548)nerix4-9/+129
Adds synthetic children for MSVC STL's [`std::tuple`](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/inc/tuple). A `tuple` is a chain of base classes: ```cpp template <> class tuple<> {}; template <class _This, class... _Rest> class tuple<_This, _Rest...> : private tuple<_Rest...> { _Tuple_val<_This> _Myfirst; }; ``` So the provider walks the base classes to the desired one. The implementation makes it hard to detect if the empty tuple is from this STL. Fortunately, libstdc++'s synthetic children provider works for empty MSVC STL tuples as well. Towards #24834.
2025-07-14[LLDB] Add formatters for MSVC STL std::unique_ptr (#148248)nerix3-4/+150
This PR adds a summary and synthetic children for `std::unique_ptr` from MSVC's STL ([NatVis](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L285-L303)). As with libc++, the deleter is only shown if it's non-empty. Tested both the shared_ptr and unique_ptr tests on Windows. Towards #24834.
2025-07-11[LLDB] Use non synthetic value for MSVC smart ptr check (#148176)nerix1-1/+4
I forgot to use the non-synthetic value to check for the `_Ptr` member. Fixes the test failure from #147575. --------- Co-authored-by: Michael Buch <michaelbuch12@gmail.com>
2025-07-11[LLDB] Add formatters for MSVC STL std::shared_ptr (#147575)nerix5-19/+212
This PR adds formatters for `std::shared_ptr` and `std::weak_ptr`. They are similar to the ones from libc++ and libstdc++. [Section from MSVC STL NatVis](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L512-L578). To support debugging with PDB debug info, I had to add an early exit in `GetDesugaredSmartPointerValue`, because with PDB, LLDB doesn't know about template types. This isn't an issue here, since the typedef type is already resolved there, so no casting is needed. The tests don't check for PDB - maybe this should be changed? I don't know a good way to do this. PDB has the downside that it resolves typedefs. Here in particular, the test for `element_type` would need to be replaced with `User` and `std::string` with `std::basic_string<char,std::char_traits<char>,std::allocator<char> >`. Towards #24834.
2025-07-08[lldb][Formatters] Consistently unwrap pointer element_type in ↵Michael Buch5-13/+43
std::shared_ptr formatters (#147340) Follow-up to https://github.com/llvm/llvm-project/pull/147165#pullrequestreview-2992585513 Currently when we explicitly dereference a std::shared_ptr, both the libstdc++ and libc++ formatters will cast the type of the synthetic pointer child to whatever the `std::shared_ptr::element_type` is aliased to. E.g., ``` (lldb) v p (std::shared_ptr<int>) p = 10 strong=1 weak=0 { pointer = 0x000000010016c6a0 } (lldb) v *p (int) *p = 10 ``` However, when we print (or dereference) `p.pointer`, the type devolves to something less user-friendly: ``` (lldb) v p.pointer (std::shared_ptr<int>::element_type *) p.pointer = 0x000000010016c6a0 (lldb) v *p.pointer (std::shared_ptr<int>::element_type) *p.pointer = 10 ``` This patch changes both formatters to store the casted type. Then `GetChildAtIndex` will consistently use the unwrapped type.
2025-07-08[LLDB] Add type summaries for MSVC STL strings (#143177)nerix4-29/+300
This PR adds type summaries for `std::{string,wstring,u8string,u16string,u32string}` from the MSVC STL. See https://github.com/llvm/llvm-project/issues/24834 for the MSVC STL issue. The following changes were made: - `dotest.py` now detects if the MSVC STL is available. It does so by looking at the target triple, which is an additional argument passed from Lit. It specifically checks for `windows-msvc` to not match on `windows-gnu` (i.e. MinGW/Cygwin). - (The main part): Added support for summarizing `std::(w)string` from MSVC's STL. Because the type names from the libstdc++ (pre C++ 11) string types are the same as on MSVC's STL, `CXXCompositeSummaryFormat` is used with two entries, one for MSVC's STL and one for libstdc++. With MSVC's STL, `std::u{8,16,32}string` is also handled. These aren't handled for libstdc++, so I put them in `LoadMsvcStlFormatters`.
2025-07-08[lldb][test] Combine libstdc++ and libc++ tuple tests into generic test ↵Michael Buch1-1/+5
(#147139) This combines the libc++ and libstdc++ test cases. The main difference was that the libstdcpp tests had some tuple indexing tests that libc++ didn't have. The libstdc++ formatter didn't support size summaries for std::tuple. So I added a `ContainerSizeSummaryProvider` for it (like we do for libc++). Additionally, the synthetic frontend would only apply to non-empty tuples, so I adjusted the regex to match empty ones too. We do this for libc++ already. Split out from https://github.com/llvm/llvm-project/pull/146740
2025-07-07[lldb][Formatters] Add shared/weak count to libstdc++ std::shared_ptr ↵Michael Buch1-17/+26
summary (#147166) Depends on https://github.com/llvm/llvm-project/pull/147165 This adds weak/strong counts to the std::shared_ptr summary of the libstdcxx formatters. We already do this for libcxx. This will make it easier to consolidate the tests into a generic one (see https://github.com/llvm/llvm-project/pull/147141).
2025-07-07[lldb][Formatter] Consolidate libstdc++ and libc++ unique_ptr formatter ↵Michael Buch2-11/+7
tests into generic test (#147031) The libc++ test was a subset of the tests in libstdc++. This test moves the libc++ test into `generic` and somne additional test-cases from `libstdc++` (specifically the recursive unique_ptr case). It turns out the libstdc++ formatter supports dereferencing using the "object" or "obj" names. We could either drop those from the tests or support the same for libc++. I took the latter approach but don't have strong opinions on this. Split out from https://github.com/llvm/llvm-project/pull/146740
2025-07-07[lldb][test] Combine libstdc++ and libc++ std::map tests into generic test ↵Michael Buch1-2/+2
(#147174) This combines the libc++ and libstdc++ test cases. The libstdcpp tests were a subset of the libc++ test, so this patch moves the libcxx test into generic and removes the libstdcpp test entirely. Split out from https://github.com/llvm/llvm-project/pull/146740
2025-07-07[lldb][Formatters] Make libc++ and libstdc++ std::shared_ptr formatters ↵Michael Buch3-27/+40
consistent with each other (#147165) This patch adjusts the libcxx and libstdcxx std::shared_ptr formatters to look the same. Changes to libcxx: * Now creates a synthetic child called `pointer` (like we already do for `std::unique_ptr`) Changes to libstdcxx: * When asked to dereference the pointer, cast the type of the result ValueObject to the element type (which we get from the template argument to std::shared_ptr). Before: ``` (std::__shared_ptr<int, __gnu_cxx::_S_atomic>::element_type) *foo = 123 ``` After: ``` (int) *foo = 123 ``` Tested in https://github.com/llvm/llvm-project/pull/147141
2025-07-07[lldb][Formatters] Use container summary helper for libstdc++ formatters ↵Michael Buch3-62/+63
(#147140) This re-uses the `LibcxxContainerSummaryProvider` for the libstdc++ formatters. There's a couple of containers that aren't making use of it for libstdc++. This patch will make it easier to review when adding those in the future.
2025-07-04[lldb][Formatters] Fix weak reference count for ↵Michael Buch1-1/+6
std::shared_ptr/std::weak_ptr (#147033) For the `__shared_owners_` we need to add `+1` to the count, but for `__shared_weak_owners_` the value reflects the exact number of weak references.
2025-07-04[lldb][DataFormatter] Format libstdc++ unique_ptr like we do libc++ (#146909)Michael Buch2-52/+28
The only difference is that with libc++ the summary string contains the derefernced pointer value. With libstdc++ we currently display the pointer itself, which seems redundant. E.g., ``` (std::unique_ptr<int>) iup = 0x55555556d2b0 { pointer = 0x000055555556d2b0 } (std::unique_ptr<std::basic_string<char> >) sup = 0x55555556d2d0 { pointer = "foobar" } ``` This patch moves the logic into a common helper that's shared between the libc++ and libstdc++ formatters. After this patch we can combine the libc++ and libstdc++ API tests (see https://github.com/llvm/llvm-project/pull/146740).
2025-07-03[lldb] fix incorrect logging message (#146903)Charles Zablit1-3/+3
Fix an error message which incorrectly says that we failed to handle a `basename`. It should say `formatted-arguments` instead.
2025-07-02[LLDB] Simplify libstdc++ string summaries (#146562)nerix3-138/+17
From #143177. This combines the summaries for the pre- and post C++ 11 `std::string` as well as `std::wstring`. In all cases, the data pointer is reachable through `_M_dataplus._M_p`. It has the correct type (i.e. `char*`/`wchar_t*`) and it's null terminated, so LLDB knows how to format it as expected when using `GetSummaryAsCString`.
2025-06-26[lldb][DataFormatter] Unwrap reference type when formatting ↵Michael Buch1-2/+4
std::unordered_map (#145872) Desugar any potential references/typedefs before checking `isStdTemplate`. Previously, the typename might've been: ``` const std::unordered_map<...> & ``` for references. This patch gets the pointee type before grabbing the canonical type. `GetNonReferenceType` will unwrap typedefs too, so we should always end up with a non-reference before we get to `GetCanonicalType`. https://github.com/llvm/llvm-project/issues/145847
2025-06-23[lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (#144731)Charles Zablit1-155/+142
Upgrade the callees of `HandleFrameFormatVariable` (`GetDemangledTemplateArguments`, etc), to return a `llvm::Expected` instead of an `std::optional`. This patch also bundles the logic of validating the demangled name and information into a single reusable function to reduce code duplication.
2025-06-17[LLDB] Consolidate C++ string buffer summaries (#144258)nerix3-137/+141
As part of https://github.com/llvm/llvm-project/pull/143177, I moved the non-libc++ specific formatting of `std::string`s out to `CxxStringTypes` as MSVC's STL `std::string` can also be thought of a pointer+size pair. I named this kind of string "string buffer". This PR picks that change, so the MSVC PR can be smaller. Unfortunately, libstdc++'s `std::string` does not fit this (it also uses a different string printer function). This resolves two FIXMEs in the libc++ tests, where empty u16 and u32 strings didn't have any prefix (u/U).
2025-06-17[lldb][Formatter] Get element type for unordered_maps from ↵Michael Buch1-6/+12
__hash_table::value_type (#144517) https://github.com/llvm/llvm-project/pull/143501 changes usage of `__hash_value_type` in libcxx to an empty tag type. This type will no longer have a definition in DWARF. Currently the LLDB unordered_map formatter deduces the map's `element_type` by looking at the `__cc_` member of `__hash_value_type`. But that will no longer work because we only have its forward declaration. Since what we're really after is the type that `__hash_value_type` is wrapping, we can just look at the `__hash_table::value_type` typedef. With https://github.com/llvm/llvm-project/pull/143501 that will now point to the `std::pair` element type (which used to be what we got from `__cc_`). TBD: need to double-check this works for older layouts. Quick glance at the code makes me suspicious of cases like `unordered_map<std::pair<int, int>, int>`
2025-06-11[lldb] Show coro_frame in `std::coroutine_handle` pretty printer (#141516)Adrian Vogelsgesang2-81/+68
This commit adjusts the pretty printer for `std::coroutine_handle` based on recent personal experiences with debugging C++20 coroutines: 1. It adds the `coro_frame` member. This member exposes the complete coroutine frame contents, including the suspension point id and all internal variables which the compiler decided to persist into the coroutine frame. While this data is highly compiler-specific, inspecting it can help identify the internal state of suspended coroutines. 2. It includes the `promise` and `coro_frame` members, even if devirtualization failed and we could not infer the promise type / the coro_frame type. Having them available as `void*` pointers can still be useful to identify, e.g., which two coroutine handles have the same frame / promise pointers.
2025-06-04[lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)Pavel Labath1-3/+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] Fix data race in statusline format handling (#142489)Jonas Devlieghere2-7/+7
This fixes a data race between the main thread and the default event handler thread. The statusline format option value was protected by a mutex, but it was returned as a pointer, allowing one thread to access it while another was modifying it. Avoid the data race by returning format values by value instead of by pointer.
2025-06-03[lldb][TypeSystem][NFC] CreateFunctionType to take parameters by ↵Michael Buch1-1/+2
llvm::ArrayRef (#142620)
2025-06-02[lldb] Refactor away UB in SBValue::GetLoadAddress (#141799)Pavel Labath3-16/+7
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-30[LLDB] Avoid crashes when inspecting MSVC STL types (#140761)nerix2-3/+7
When inspecting/printing types from MSVC's STL, LLDB would crash because it assumes these types were from libstdc++. Specifically, `std::shared_ptr` and `std::optional` would crash because of a null pointer dereference. I added a minimal test that tests the types with C++ helpers for libstdc++ (only tests for crashes). - Fixes #115216 - Fixes #120310 This still has one unresolved discussion: What about MS STL types? This is https://github.com/llvm/llvm-project/issues/24834, but there was a bit of discussion in #120310 as well. The main issue is that MSVC's STL uses the same type names as libstdc++ (i.e. neither uses an inline namespace like libc++ for some types).
2025-05-28[Demangling] Refactor Demangler range tracking (#140762)Charles Zablit1-2/+2
This PR is a subset of the commits made in https://github.com/swiftlang/llvm-project/pull/10710. The most notable change is the addition of `PrefixRange` and `SuffixRange` which are a catch-all to track anything after or before a function's demangled name. In the case of Swift, this allows to add support for name highlighting without having to track the range of the scope and specifiers of a function (this will come in another PR).
2025-05-27[lldb] optionally match the `__debug` namespace for libstdc++ containers. ↵Ebuka Ezike1-29/+39
(#140727) If libstdc++ is compiled with `_GLIBCXX_DEBUG` flag it puts the containers in the namespace `std::__debug`. this causes the summary and synthetic formatters not to match the types. The formatters is updated to optionally match the `__debug::`. The formatters now clashed with the libc++ containers namespace regex which uses `std::__1` namespace The libc++ formatter is loaded first, then the libstdc++ since the priority of the formatters in lldb is the last one added. Fixes #60841