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
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 *
78
80 const TypeSummaryOptions &options);
81
82/// Formatter for libc++ std::span<>.
84 const TypeSummaryOptions &options);
85
87public:
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:
105};
106
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:
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
160
164
166public:
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:
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:
204};
205
209
213
217
221
225
229
233
237
241
244
247
250 lldb::ValueObjectSP valobj_sp);
251
254 lldb::ValueObjectSP valobj_sp);
255
259
263
264} // namespace formatters
265} // namespace lldb_private
266
267#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
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:374
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:359
Formats libcxx's std::unordered_map iterators.
Definition: LibCxx.h:132
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:517
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:574
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:627
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: LibCxx.cpp:670
size_t GetIndexOfChildWithName(ConstString name) override
Definition: LibCxx.cpp:720
SyntheticChildrenFrontEnd * LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:538
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:37
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:656
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:1048
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1055
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:554
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:1062
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:901
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxTuple.cpp:88
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition: LibCxx.cpp:988
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:1069
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:995
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:1002
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:417
lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair)
Definition: LibCxx.cpp:63
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxMap.cpp:440
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:730
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxxList.cpp:423
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:639
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: LibCxx.cpp:389
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:458