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