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
15#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/// Returns the ValueObjectSP of the child of \c obj. If \c obj has no
30/// child named \c child_name, returns the __compressed_pair child instead
31/// with \c compressed_pair_name, if one exists.
32///
33/// Latest libc++ wrap the compressed children in an anonymous structure.
34/// The \c anon_struct_idx indicates the location of this struct.
35///
36/// The returned boolean is \c true if the returned child was has an old-style
37/// libc++ __compressed_pair layout.
38///
39/// If no child was found returns a nullptr.
40std::pair<lldb::ValueObjectSP, bool>
41GetValueOrOldCompressedPair(ValueObject &obj, llvm::StringRef child_name,
42 llvm::StringRef compressed_pair_name);
43bool isStdTemplate(ConstString type_name, llvm::StringRef type);
44
46 ValueObject &valobj, Stream &stream,
47 const TypeSummaryOptions &summary_options); // libc++ std::string
48
50 ValueObject &valobj, Stream &stream,
51 const TypeSummaryOptions &summary_options); // libc++ std::u16string
52
54 ValueObject &valobj, Stream &stream,
55 const TypeSummaryOptions &summary_options); // libc++ std::u32string
56
58 ValueObject &valobj, Stream &stream,
59 const TypeSummaryOptions &options); // libc++ std::wstring
60
62 ValueObject &valueObj, Stream &stream,
63 const TypeSummaryOptions &summary_options); // libc++ std::string_view
64
66 ValueObject &valobj, Stream &stream,
67 const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
68
70 ValueObject &valobj, Stream &stream,
71 const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
72
74 ValueObject &valobj, Stream &stream,
75 const TypeSummaryOptions &options); // libc++ std::wstring_view
76
78 ValueObject &valobj, Stream &stream,
79 const TypeSummaryOptions &options); // libc++ std::slice_array
80
82 ValueObject &valobj, Stream &stream,
83 const TypeSummaryOptions
84 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
85
86// libc++ std::unique_ptr<>
87bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
88 const TypeSummaryOptions &options);
89
91 ValueObject &valobj, Stream &stream,
92 const TypeSummaryOptions &options); // libc++ std::function<>
93
95 ValueObject &valobj, Stream &stream,
96 const TypeSummaryOptions &options); // libc++ std::partial_ordering
97
99 ValueObject &valobj, Stream &stream,
100 const TypeSummaryOptions &options); // libc++ std::weak_ordering
101
103 ValueObject &valobj, Stream &stream,
104 const TypeSummaryOptions &options); // libc++ std::strong_ordering
105
106SyntheticChildrenFrontEnd *
109
110/// Formatter for libc++ std::span<>.
112 const TypeSummaryOptions &options);
113
117
119public:
121
122 llvm::Expected<uint32_t> CalculateNumChildren() override;
123
124 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
125
126 lldb::ChildCacheState Update() override;
127
128 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
129
131
132private:
135};
136
138public:
140
141 llvm::Expected<uint32_t> CalculateNumChildren() override;
142
143 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
144
145 lldb::ChildCacheState Update() override;
146
147 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
148
150
151private:
154};
155
159
163
167
171
175
179
183
187
191
195
199
203
207
210
213
216 lldb::ValueObjectSP valobj_sp);
217
220 lldb::ValueObjectSP valobj_sp);
221
225
229
231 ValueObject &valobj, Stream &stream,
232 const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
233
235 ValueObject &valobj, Stream &stream,
236 const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
237
239 ValueObject &valobj, Stream &stream,
240 const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds
241
243 ValueObject &valobj, Stream &stream,
244 const TypeSummaryOptions &options); // libc++ std::chrono::local_days
245
247 ValueObject &valobj, Stream &stream,
248 const TypeSummaryOptions &options); // libc++ std::chrono::month
249
251 ValueObject &valobj, Stream &stream,
252 const TypeSummaryOptions &options); // libc++ std::chrono::weekday
253
255 ValueObject &valobj, Stream &stream,
256 const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
257
258} // namespace formatters
259} // namespace lldb_private
260
261#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
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition LibCxx.cpp:358
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition LibCxx.cpp:353
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Definition LibCxx.cpp:412
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:381
LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition LibCxx.cpp:345
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition LibCxx.cpp:451
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:481
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Definition LibCxx.cpp:515
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition LibCxx.cpp:458
LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition LibCxx.cpp:434
SyntheticChildrenFrontEnd * LibCxxUnorderedMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdSpanSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
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:63
bool LibcxxChronoSysSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:845
bool LibcxxChronoMonthSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:911
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:228
bool LibcxxPartialOrderingSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:261
bool LibcxxSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:182
bool LibcxxStringViewSummaryProviderASCII(ValueObject &valueObj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:748
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:755
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:762
SyntheticChildrenFrontEnd * LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxWeakOrderingSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:285
SyntheticChildrenFrontEnd * LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoYearMonthDaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:953
bool LibcxxWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:631
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:688
bool LibcxxChronoLocalSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:851
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:769
bool LibcxxChronoWeekdaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:932
bool isStdTemplate(ConstString type_name, llvm::StringRef type)
Definition LibCxx.cpp:54
lldb::ValueObjectSP GetFirstValueOfLibCXXCompressedPair(ValueObject &pair)
Definition LibCxx.cpp:75
SyntheticChildrenFrontEnd * LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
SyntheticChildrenFrontEnd * LibcxxStdProxyArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxStringSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:695
bool LibcxxStdSliceArraySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
bool LibcxxFunctionSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:134
bool LibcxxStringSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:702
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
std::pair< lldb::ValueObjectSP, bool > GetValueOrOldCompressedPair(ValueObject &obj, llvm::StringRef child_name, llvm::StringRef compressed_pair_name)
Returns the ValueObjectSP of the child of obj.
Definition LibCxx.cpp:106
bool LibcxxStrongOrderingSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:306
bool LibcxxChronoLocalDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:905
lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair)
Definition LibCxx.cpp:89
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
SyntheticChildrenFrontEnd * LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoSysDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:899
SyntheticChildrenFrontEnd * LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
A class that represents a running process on the host machine.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP