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, size_t anon_struct_idx,
42 llvm::StringRef child_name,
43 llvm::StringRef compressed_pair_name);
44bool isStdTemplate(ConstString type_name, llvm::StringRef type);
45
47 ValueObject &valobj, Stream &stream,
48 const TypeSummaryOptions &summary_options); // libc++ std::string
49
51 ValueObject &valobj, Stream &stream,
52 const TypeSummaryOptions &summary_options); // libc++ std::u16string
53
55 ValueObject &valobj, Stream &stream,
56 const TypeSummaryOptions &summary_options); // libc++ std::u32string
57
59 ValueObject &valobj, Stream &stream,
60 const TypeSummaryOptions &options); // libc++ std::wstring
61
63 ValueObject &valueObj, Stream &stream,
64 const TypeSummaryOptions &summary_options); // libc++ std::string_view
65
67 ValueObject &valobj, Stream &stream,
68 const TypeSummaryOptions &summary_options); // libc++ std::u16string_view
69
71 ValueObject &valobj, Stream &stream,
72 const TypeSummaryOptions &summary_options); // libc++ std::u32string_view
73
75 ValueObject &valobj, Stream &stream,
76 const TypeSummaryOptions &options); // libc++ std::wstring_view
77
79 ValueObject &valobj, Stream &stream,
80 const TypeSummaryOptions &options); // libc++ std::slice_array
81
83 ValueObject &valobj, Stream &stream,
84 const TypeSummaryOptions
85 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
86
87// libc++ std::unique_ptr<>
88bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream,
89 const TypeSummaryOptions &options);
90
92 ValueObject &valobj, Stream &stream,
93 const TypeSummaryOptions &options); // libc++ std::function<>
94
95SyntheticChildrenFrontEnd *
98
99/// Formatter for libc++ std::span<>.
101 const TypeSummaryOptions &options);
102
106
108public:
110
111 llvm::Expected<uint32_t> CalculateNumChildren() override;
112
113 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
114
115 lldb::ChildCacheState Update() override;
116
117 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
118
120
121private:
124};
125
127public:
129
130 llvm::Expected<uint32_t> CalculateNumChildren() override;
131
132 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
133
134 lldb::ChildCacheState Update() override;
135
136 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override;
137
139
140private:
143};
144
148
152
156
160
164
168
172
176
180
184
188
192
196
200
203
206
209 lldb::ValueObjectSP valobj_sp);
210
213 lldb::ValueObjectSP valobj_sp);
214
218
222
224 ValueObject &valobj, Stream &stream,
225 const TypeSummaryOptions &options); // libc++ std::chrono::sys_seconds
226
228 ValueObject &valobj, Stream &stream,
229 const TypeSummaryOptions &options); // libc++ std::chrono::sys_days
230
232 ValueObject &valobj, Stream &stream,
233 const TypeSummaryOptions &options); // libc++ std::chrono::local_seconds
234
236 ValueObject &valobj, Stream &stream,
237 const TypeSummaryOptions &options); // libc++ std::chrono::local_days
238
240 ValueObject &valobj, Stream &stream,
241 const TypeSummaryOptions &options); // libc++ std::chrono::month
242
244 ValueObject &valobj, Stream &stream,
245 const TypeSummaryOptions &options); // libc++ std::chrono::weekday
246
248 ValueObject &valobj, Stream &stream,
249 const TypeSummaryOptions &options); // libc++ std::chrono::year_month_day
250
251} // namespace formatters
252} // namespace lldb_private
253
254#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:290
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition LibCxx.cpp:285
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Definition LibCxx.cpp:344
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:313
LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition LibCxx.cpp:277
llvm::Expected< uint32_t > CalculateNumChildren() override
Definition LibCxx.cpp:383
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:413
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Definition LibCxx.cpp:447
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Definition LibCxx.cpp:390
LibcxxUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition LibCxx.cpp:366
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
SyntheticChildrenFrontEnd * LibcxxStdSliceArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoSysSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:777
bool LibcxxChronoMonthSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:843
SyntheticChildrenFrontEnd * LibcxxUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition LibCxx.cpp:376
bool LibcxxUniquePointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:237
bool LibcxxSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:191
bool LibcxxStringViewSummaryProviderASCII(ValueObject &valueObj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:680
bool LibcxxStringViewSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:687
SyntheticChildrenFrontEnd * LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition LibCxx.cpp:269
bool LibcxxStringViewSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:694
SyntheticChildrenFrontEnd * LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoYearMonthDaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:885
bool LibcxxWStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:563
SyntheticChildrenFrontEnd * LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxStringSummaryProviderASCII(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:620
bool LibcxxChronoLocalSecondsSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:783
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:701
bool LibcxxChronoWeekdaySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:864
bool isStdTemplate(ConstString type_name, llvm::StringRef type)
Definition LibCxx.cpp:54
SyntheticChildrenFrontEnd * LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
lldb::ValueObjectSP GetFirstValueOfLibCXXCompressedPair(ValueObject &pair)
Definition LibCxx.cpp:75
SyntheticChildrenFrontEnd * LibcxxOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp)
bool LibcxxStringSummaryProviderUTF16(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:627
bool LibcxxStdSliceArraySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
bool LibcxxFunctionSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:143
bool LibcxxStringSummaryProviderUTF32(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &summary_options)
Definition LibCxx.cpp:634
SyntheticChildrenFrontEnd * LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoLocalDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:837
lldb::ValueObjectSP GetSecondValueOfLibCXXCompressedPair(ValueObject &pair)
Definition LibCxx.cpp:89
SyntheticChildrenFrontEnd * LibcxxStdValarraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
std::pair< lldb::ValueObjectSP, bool > GetValueOrOldCompressedPair(ValueObject &obj, size_t anon_struct_idx, llvm::StringRef child_name, llvm::StringRef compressed_pair_name)
Returns the ValueObjectSP of the child of obj.
Definition LibCxx.cpp:106
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)
SyntheticChildrenFrontEnd * LibcxxStdForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
SyntheticChildrenFrontEnd * LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition LibCxx.cpp:359
SyntheticChildrenFrontEnd * LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
bool LibcxxChronoSysDaysSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition LibCxx.cpp:831
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