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.
22lldb::ValueObjectSP
23GetChildMemberWithName(ValueObject &obj,
24 llvm::ArrayRef<ConstString> alternative_names);
25
27 ValueObject &valobj, Stream &stream,
28 const TypeSummaryOptions &summary_options); // libc++ std::string
29
31 ValueObject &valobj, Stream &stream,
32 const TypeSummaryOptions &summary_options); // libc++ std::u16string
33
35 ValueObject &valobj, Stream &stream,
36 const TypeSummaryOptions &summary_options); // libc++ std::u32string
37
39 ValueObject &valobj, Stream &stream,
40 const TypeSummaryOptions &options); // libc++ std::wstring
41
43 ValueObject &valueObj, Stream &stream,
44 const TypeSummaryOptions &summary_options); // libc++ std::string_view
45
47 ValueObject &valobj, Stream &stream,
48 const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
49
51 ValueObject &valobj, Stream &stream,
52 const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
53
55 ValueObject &valobj, Stream &stream,
56 const TypeSummaryOptions &options); // libc++ std::wstring_view
57
59 ValueObject &valobj, Stream &stream,
60 const TypeSummaryOptions &options); // libc++ std::optional<>
61
63 ValueObject &valobj, Stream &stream,
64 const TypeSummaryOptions
65 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
66
67// libc++ std::unique_ptr<>
68bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
69 const TypeSummaryOptions &options);
70
72 ValueObject &valobj, Stream &stream,
73 const TypeSummaryOptions &options); // libc++ std::function<>
74
75SyntheticChildrenFrontEnd *
77 lldb::ValueObjectSP);
78
80 const TypeSummaryOptions &options);
81
82/// Formatter for libc++ std::span<>.
84 const TypeSummaryOptions &options);
85
87public:
88 LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
89
90 size_t CalculateNumChildren() override;
91
92 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
93
94 bool Update() override;
95
96 bool MightHaveChildren() override;
97
98 size_t GetIndexOfChildWithName(ConstString name) override;
99
101
102private:
104 lldb::ValueObjectSP m_pair_sp;
105};
106
109 lldb::ValueObjectSP);
110
111/// Formats libcxx's std::unordered_map iterators
112///
113/// In raw form a std::unordered_map::iterator is represented as follows:
114///
115/// (lldb) var it --raw --ptr-depth 1
116/// (std::__1::__hash_map_iterator<
117/// std::__1::__hash_iterator<
118/// std::__1::__hash_node<
119/// std::__1::__hash_value_type<
120/// std::__1::basic_string<char, std::__1::char_traits<char>,
121/// std::__1::allocator<char> >, std::__1::basic_string<char,
122/// std::__1::char_traits<char>, std::__1::allocator<char> > >,
123/// void *> *> >)
124/// it = {
125/// __i_ = {
126/// __node_ = 0x0000600001700040 {
127/// __next_ = 0x0000600001704000
128/// }
129/// }
130/// }
133public:
134 LibCxxUnorderedMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
135
137
138 size_t CalculateNumChildren() override;
139
140 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
141
142 bool Update() override;
143
144 bool MightHaveChildren() override;
145
146 size_t GetIndexOfChildWithName(ConstString name) override;
147
148private:
149 ValueObject *m_iter_ptr = nullptr; ///< Held, not owned. Child of iterator
150 ///< ValueObject supplied at construction.
151
152 lldb::ValueObjectSP m_pair_sp; ///< ValueObject for the key/value pair
153 ///< that the iterator currently points
154 ///< to.
155};
156
159 lldb::ValueObjectSP);
160
163 lldb::ValueObjectSP);
164
166public:
167 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
168
169 size_t CalculateNumChildren() override;
170
171 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
172
173 bool Update() override;
174
175 bool MightHaveChildren() override;
176
177 size_t GetIndexOfChildWithName(ConstString name) override;
178
180
181private:
183};
184
186public:
187 LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
188
189 size_t CalculateNumChildren() override;
190
191 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
192
193 bool Update() override;
194
195 bool MightHaveChildren() override;
196
197 size_t GetIndexOfChildWithName(ConstString name) override;
198
200
201private:
202 lldb::ValueObjectSP m_value_ptr_sp;
203};
204
207 lldb::ValueObjectSP);
208
211 lldb::ValueObjectSP);
212
215 lldb::ValueObjectSP);
216
219 lldb::ValueObjectSP);
220
223 lldb::ValueObjectSP);
224
227 lldb::ValueObjectSP);
228
231 lldb::ValueObjectSP);
232
235 lldb::ValueObjectSP);
236
239 lldb::ValueObjectSP);
240
242 lldb::ValueObjectSP);
243
245 lldb::ValueObjectSP);
246
249 lldb::ValueObjectSP valobj_sp);
250
253 lldb::ValueObjectSP valobj_sp);
254
257 lldb::ValueObjectSP);
258
261 lldb::ValueObjectSP);
262
263} // namespace formatters
264} // namespace lldb_private
265
266#endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_LIBCXX_H
A uniqued constant string class.
Definition: ConstString.h:39
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:370
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:355
Formats libcxx's std::unordered_map iterators.
Definition: LibCxx.h:132
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:514
lldb::ValueObjectSP m_pair_sp
ValueObject for the key/value pair that the iterator currently points to.
Definition: LibCxx.h:152
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:571
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:624
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:665
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:705
SyntheticChildrenFrontEnd * LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:535
SyntheticChildrenFrontEnd * LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxSpan.cpp:141
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:38
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:653
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:162
bool LibcxxOptionalSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:49
bool LibcxxSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:119
bool LibcxxStringViewSummaryProviderASCII(ValueObject &valueObj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1041
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1048
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:551
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1055
SyntheticChildrenFrontEnd * LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxQueue.cpp:60
SyntheticChildrenFrontEnd * LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:894
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxTuple.cpp:88
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:981
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:1062
SyntheticChildrenFrontEnd * LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
bool LibcxxStringSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:988
bool LibcxxFunctionSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: LibCxx.cpp:71
bool LibcxxStringSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:995
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:424
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxMap.cpp:451
SyntheticChildrenFrontEnd * LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
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:713
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:430
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:636
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:385
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14