blob: e47019081726eb612cad249aab698d639a880d87 [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
Enrico Granata419d7912015-09-04 00:33:51 +000014#include "lldb/Core/ValueObject.h"
15#include "lldb/DataFormatters/TypeSummary.h"
16#include "lldb/DataFormatters/TypeSynthetic.h"
Zachary Turnerbf9a7732017-02-02 21:39:50 +000017#include "lldb/Utility/Stream.h"
Enrico Granata419d7912015-09-04 00:33:51 +000018
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;
Enrico Granataae1ba732016-09-28 22:53:16 +000084 lldb::ValueObjectSP m_pair_sp;
Kate Stoneb9c1b512016-09-06 20:57:50 +000085};
86
87SyntheticChildrenFrontEnd *
88LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
89 lldb::ValueObjectSP);
90
91SyntheticChildrenFrontEnd *
92LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
93 lldb::ValueObjectSP);
94
95class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
96public:
97 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
98
99 size_t CalculateNumChildren() override;
100
101 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
102
103 bool Update() override;
104
105 bool MightHaveChildren() override;
106
107 size_t GetIndexOfChildWithName(const ConstString &name) override;
108
109 ~LibcxxSharedPtrSyntheticFrontEnd() override;
110
111private:
112 ValueObject *m_cntrl;
113 lldb::ValueObjectSP m_count_sp;
114 lldb::ValueObjectSP m_weak_count_sp;
115 uint8_t m_ptr_size;
116 lldb::ByteOrder m_byte_order;
117};
118
119SyntheticChildrenFrontEnd *
120LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
121 lldb::ValueObjectSP);
122
123SyntheticChildrenFrontEnd *
124LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *,
125 lldb::ValueObjectSP);
126
127SyntheticChildrenFrontEnd *
128LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *,
129 lldb::ValueObjectSP);
130
131SyntheticChildrenFrontEnd *
132LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
133 lldb::ValueObjectSP);
134
135SyntheticChildrenFrontEnd *
136LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *,
137 lldb::ValueObjectSP);
138
139SyntheticChildrenFrontEnd *
140LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *,
141 lldb::ValueObjectSP);
142
143SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *,
144 lldb::ValueObjectSP);
145
146} // namespace formatters
Enrico Granata419d7912015-09-04 00:33:51 +0000147} // namespace lldb_private
148
149#endif // liblldb_LibCxx_h_