Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1 | //===-- LibCxx.h ---------------------------------------------------*- C++ |
| 2 | //-*-===// |
Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 3 | // |
| 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 | |
| 19 | namespace lldb_private { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 20 | namespace formatters { |
Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 21 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 22 | bool LibcxxStringSummaryProvider( |
| 23 | ValueObject &valobj, Stream &stream, |
| 24 | const TypeSummaryOptions &options); // libc++ std::string |
| 25 | |
| 26 | bool LibcxxWStringSummaryProvider( |
| 27 | ValueObject &valobj, Stream &stream, |
| 28 | const TypeSummaryOptions &options); // libc++ std::wstring |
| 29 | |
| 30 | bool LibcxxSmartPointerSummaryProvider( |
| 31 | ValueObject &valobj, Stream &stream, |
| 32 | const TypeSummaryOptions |
| 33 | &options); // libc++ std::shared_ptr<> and std::weak_ptr<> |
| 34 | |
| 35 | class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
| 36 | public: |
| 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 | |
| 51 | private: |
| 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 | |
| 59 | SyntheticChildrenFrontEnd * |
| 60 | LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 61 | lldb::ValueObjectSP); |
| 62 | |
| 63 | bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, |
| 64 | const TypeSummaryOptions &options); |
| 65 | |
| 66 | class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
| 67 | public: |
| 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 | |
| 82 | private: |
| 83 | ValueObject *m_pair_ptr; |
| 84 | }; |
| 85 | |
| 86 | SyntheticChildrenFrontEnd * |
| 87 | LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 88 | lldb::ValueObjectSP); |
| 89 | |
| 90 | SyntheticChildrenFrontEnd * |
| 91 | LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 92 | lldb::ValueObjectSP); |
| 93 | |
| 94 | class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { |
| 95 | public: |
| 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 | |
| 110 | private: |
| 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 | |
| 118 | SyntheticChildrenFrontEnd * |
| 119 | LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 120 | lldb::ValueObjectSP); |
| 121 | |
| 122 | SyntheticChildrenFrontEnd * |
| 123 | LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 124 | lldb::ValueObjectSP); |
| 125 | |
| 126 | SyntheticChildrenFrontEnd * |
| 127 | LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 128 | lldb::ValueObjectSP); |
| 129 | |
| 130 | SyntheticChildrenFrontEnd * |
| 131 | LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 132 | lldb::ValueObjectSP); |
| 133 | |
| 134 | SyntheticChildrenFrontEnd * |
| 135 | LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 136 | lldb::ValueObjectSP); |
| 137 | |
| 138 | SyntheticChildrenFrontEnd * |
| 139 | LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, |
| 140 | lldb::ValueObjectSP); |
| 141 | |
| 142 | SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *, |
| 143 | lldb::ValueObjectSP); |
| 144 | |
| 145 | } // namespace formatters |
Enrico Granata | 419d791 | 2015-09-04 00:33:51 +0000 | [diff] [blame] | 146 | } // namespace lldb_private |
| 147 | |
| 148 | #endif // liblldb_LibCxx_h_ |