blob: d34efafa7c68d06bd7a5f53e8ddda1f769131339 [file] [log] [blame]
Kate Stoneb9c1b512016-09-06 20:57:50 +00001//===-- LibCxx.h ---------------------------------------------------*- C++
2//-*-===//
Enrico Granata419d7912015-09-04 00:33:51 +00003//
4// The LLVM Compiler Infrastructure
5//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef liblldb_LibCxx_h_
12#define liblldb_LibCxx_h_
13
14#include "lldb/Core/Stream.h"
15#include "lldb/Core/ValueObject.h"
16#include "lldb/DataFormatters/TypeSummary.h"
17#include "lldb/DataFormatters/TypeSynthetic.h"
18
19namespace lldb_private {
Kate Stoneb9c1b512016-09-06 20:57:50 +000020namespace formatters {
Enrico Granata419d7912015-09-04 00:33:51 +000021
Kate Stoneb9c1b512016-09-06 20:57:50 +000022bool LibcxxStringSummaryProvider(
23 ValueObject &valobj, Stream &stream,
24 const TypeSummaryOptions &options); // libc++ std::string
25
26bool LibcxxWStringSummaryProvider(
27 ValueObject &valobj, Stream &stream,
28 const TypeSummaryOptions &options); // libc++ std::wstring
29
30bool LibcxxSmartPointerSummaryProvider(
31 ValueObject &valobj, Stream &stream,
32 const TypeSummaryOptions
33 &options); // libc++ std::shared_ptr<> and std::weak_ptr<>
34
35class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
36public:
37 LibcxxVectorBoolSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
38
39 size_t CalculateNumChildren() override;
40
41 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
42
43 bool Update() override;
44
45 bool MightHaveChildren() override;
46
47 size_t GetIndexOfChildWithName(const ConstString &name) override;
48
49 ~LibcxxVectorBoolSyntheticFrontEnd() override;
50
51private:
52 CompilerType m_bool_type;
53 ExecutionContextRef m_exe_ctx_ref;
54 uint64_t m_count;
55 lldb::addr_t m_base_data_address;
56 std::map<size_t, lldb::ValueObjectSP> m_children;
57};
58
59SyntheticChildrenFrontEnd *
60LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *,
61 lldb::ValueObjectSP);
62
63bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream,
64 const TypeSummaryOptions &options);
65
66class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
67public:
68 LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
69
70 size_t CalculateNumChildren() override;
71
72 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
73
74 bool Update() override;
75
76 bool MightHaveChildren() override;
77
78 size_t GetIndexOfChildWithName(const ConstString &name) override;
79
80 ~LibCxxMapIteratorSyntheticFrontEnd() override;
81
82private:
83 ValueObject *m_pair_ptr;
84};
85
86SyntheticChildrenFrontEnd *
87LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
88 lldb::ValueObjectSP);
89
90SyntheticChildrenFrontEnd *
91LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
92 lldb::ValueObjectSP);
93
94class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
95public:
96 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
97
98 size_t CalculateNumChildren() override;
99
100 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
101
102 bool Update() override;
103
104 bool MightHaveChildren() override;
105
106 size_t GetIndexOfChildWithName(const ConstString &name) override;
107
108 ~LibcxxSharedPtrSyntheticFrontEnd() override;
109
110private:
111 ValueObject *m_cntrl;
112 lldb::ValueObjectSP m_count_sp;
113 lldb::ValueObjectSP m_weak_count_sp;
114 uint8_t m_ptr_size;
115 lldb::ByteOrder m_byte_order;
116};
117
118SyntheticChildrenFrontEnd *
119LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
120 lldb::ValueObjectSP);
121
122SyntheticChildrenFrontEnd *
123LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
124 lldb::ValueObjectSP);
125
126SyntheticChildrenFrontEnd *
127LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
128 lldb::ValueObjectSP);
129
130SyntheticChildrenFrontEnd *
131LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
132 lldb::ValueObjectSP);
133
134SyntheticChildrenFrontEnd *
135LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
136 lldb::ValueObjectSP);
137
138SyntheticChildrenFrontEnd *
139LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
140 lldb::ValueObjectSP);
141
142SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *,
143 lldb::ValueObjectSP);
144
145} // namespace formatters
Enrico Granata419d7912015-09-04 00:33:51 +0000146} // namespace lldb_private
147
148#endif // liblldb_LibCxx_h_