LLDB mainline
LibCxx.h
Go to the documentation of this file.
1//===-- LibCxx.h ---------------------------------------------------*- C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
11#define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
12
16#include "lldb/Utility/Stream.h"
17
18namespace lldb_private {
19namespace formatters {
20
21/// Find a child member of \c obj_sp, trying all alternative names in order.
23GetChildMemberWithName(ValueObject &obj,
24 llvm::ArrayRef<ConstString> alternative_names);
25
28
29
31 ValueObject &valobj, Stream &stream,
32 const TypeSummaryOptions &summary_options); // libc++ std::string
33
35 ValueObject &valobj, Stream &stream,
36 const TypeSummaryOptions &summary_options); // libc++ std::u16string
37
39 ValueObject &valobj, Stream &stream,
40 const TypeSummaryOptions &summary_options); // libc++ std::u32string
41
43 ValueObject &valobj, Stream &stream,
44 const TypeSummaryOptions &options); // libc++ std::wstring
45
47 ValueObject &valueObj, Stream &stream,
48 const TypeSummaryOptions &summary_options); // libc++ std::string_view
49
51 ValueObject &valobj, Stream &stream,
52 const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
53
55 ValueObject &valobj, Stream &stream,
56 const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
57
59 ValueObject &valobj, Stream &stream,
60 const TypeSummaryOptions &options); // libc++ std::wstring_view
61
63 ValueObject &valobj, Stream &stream,
64 const TypeSummaryOptions &options); // libc++ std::slice_array
65
67 ValueObject &valobj, Stream &stream,
68 const TypeSummaryOptions
69 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
70
71// libc++ std::unique_ptr<>
72bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
73 const TypeSummaryOptions &options);
74
76 ValueObject &valobj, Stream &stream,
77 const TypeSummaryOptions &options); // libc++ std::function<>
78
79SyntheticChildrenFrontEnd *
82
84 const TypeSummaryOptions &options);
85
86/// Formatter for libc++ std::span<>.
88 const TypeSummaryOptions &options);
89
91public:
93
94 llvm::Expected<uint32_t> CalculateNumChildren() override;
95
96 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
97
99
100 bool MightHaveChildren() override;
101
102 size_t GetIndexOfChildWithName(ConstString name) override;
103
105
106private:
109};
110
114
115/// Formats libcxx's std::unordered_map iterators
116///
117/// In raw form a std::unordered_map::iterator is represented as follows:
118///
119/// (lldb) var it --raw --ptr-depth 1
120/// (std::__1::__hash_map_iterator<
121/// std::__1::__hash_iterator<
122/// std::__1::__hash_node<
123/// std::__1::__hash_value_type<
124/// std::__1::basic_string<char, std::__1::char_traits<char>,
125/// std::__1::allocator<char> >, std::__1::basic_string<char,
126/// std::__1::char_traits<char>, std::__1::allocator<char> > >,
127/// void *> *> >)
128/// it = {
129/// __i_ = {
130/// __node_ = 0x0000600001700040 {
131/// __next_ = 0x0000600001704000
132/// }
133/// }
134/// }
137public:
139
141
142 llvm::Expected<uint32_t> CalculateNumChildren() override;
143
144 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
145
146 lldb::ChildCacheState Update() override;
147
148 bool MightHaveChildren() override;
149
150 size_t GetIndexOfChildWithName(ConstString name) override;
151
152private:
153 ValueObject *m_iter_ptr = nullptr; ///< Held, not owned. Child of iterator
154 ///< ValueObject supplied at construction.
155
156 lldb::ValueObjectSP m_pair_sp; ///< ValueObject for the key/value pair
157 ///< that the iterator currently points
158 ///< to.
159};
160
164
168
170public:
172
173 llvm::Expected<uint32_t> CalculateNumChildren() override;
174
175 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
176
177 lldb::ChildCacheState Update() override;
178
179 bool MightHaveChildren() override;
180
181 size_t GetIndexOfChildWithName(ConstString name) override;
182
184
185private:
187};
188
190public:
192
193 llvm::Expected<uint32_t> CalculateNumChildren() override;
194
195 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
196
197 lldb::ChildCacheState Update() override;
198
199 bool MightHaveChildren() override;
200
201 size_t GetIndexOfChildWithName(ConstString name) override;
202
204
205private:
208};
209
213
217
221
225
229
233
237
241
245
249
253
257
260
263
266 lldb::ValueObjectSP valobj_sp);
267
270 lldb::ValueObjectSP valobj_sp);
271
275
279
281 ValueObject &valobj, Stream &stream,
282 const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
283
285 ValueObject &valobj, Stream &stream,
286 const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
287
289 ValueObject &valobj, Stream &stream,
290 const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds
291
293 ValueObject &valobj, Stream &stream,
294 const TypeSummaryOptions &options); // libc++ std::chrono::local_days
295
297 ValueObject &valobj, Stream &stream,
298 const TypeSummaryOptions &options); // libc++ std::chrono::month
299
301 ValueObject &valobj, Stream &stream,
302 const TypeSummaryOptions &options); // libc++ std::chrono::weekday
303
305 ValueObject &valobj, Stream &stream,
306 const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
307
308} // namespace formatters
309} // namespace lldb_private
310
311#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
A uniqued constant string class.
Definition: ConstString.h:40
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition: LibCxx.cpp:355
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition: LibCxx.cpp:360
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:375
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
Definition: LibCxx.cpp:235
Formats libcxx's std::unordered_map iterators.
Definition: LibCxx.h:136
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition: LibCxx.cpp:513
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
Definition: LibCxx.cpp:404
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition: LibCxx.cpp:518
lldb::ValueObjectSP m_pair_sp
ValueObject for the key/value pair that the iterator currently points to.
Definition: LibCxx.h:156
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition: LibCxx.cpp:575
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition: LibCxx.cpp:570
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
Definition: LibCxx.cpp:605
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:629
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition: LibCxx.cpp:665
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
Definition: LibCxx.cpp:695
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition: LibCxx.cpp:672
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:723
SyntheticChildrenFrontEnd * LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:539
SyntheticChildrenFrontEnd * LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxSpan.cpp:142
lldb::ValueObjectSP GetChildMemberWithName(ValueObject &obj, llvm::ArrayRef< ConstString > alternative_names)
Find a child member of obj_sp, trying all alternative names in order.
Definition: LibCxx.cpp:37
SyntheticChildrenFrontEnd * LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoSysSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1128
bool LibcxxChronoMonthSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1189
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:658
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:169
bool LibcxxSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:127
bool LibcxxStringViewSummaryProviderASCII(ValueObject &valueObj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1051
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1058
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:555
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1065
SyntheticChildrenFrontEnd * LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxQueue.cpp:60
SyntheticChildrenFrontEnd * LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoYearMonthDaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1231
bool LibcxxWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:904
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxTuple.cpp:90
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:991
bool LibcxxChronoLocalSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1134
SyntheticChildrenFrontEnd * LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxSpanSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Formatter for libc++ std::span<>.
bool LibcxxWStringViewSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1072
bool LibcxxChronoWeekdaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1210
SyntheticChildrenFrontEnd * LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
lldb::ValueObjectSP GetFirstValueOfLibCXXCompressedPair(ValueObject &pair)
Definition: LibCxx.cpp:49
SyntheticChildrenFrontEnd * LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
bool LibcxxStringSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:998
bool LibcxxStdSliceArraySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
bool LibcxxFunctionSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:79
bool LibcxxStringSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1005
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:417
bool LibcxxChronoLocalDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1183
lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair)
Definition: LibCxx.cpp:63
SyntheticChildrenFrontEnd * LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxMap.cpp:431
SyntheticChildrenFrontEnd * LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
SyntheticChildrenFrontEnd * LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:733
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:423
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:641
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:390
bool LibcxxChronoSysDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:1177
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:472