1 //===-- LibCxx.h ---------------------------------------------------*- C++ 2 //-*-===// 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 { 20 namespace formatters { 21 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 lldb::ValueObjectSP m_pair_sp; 85 }; 86 87 SyntheticChildrenFrontEnd * 88 LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 89 lldb::ValueObjectSP); 90 91 SyntheticChildrenFrontEnd * 92 LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 93 lldb::ValueObjectSP); 94 95 class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 96 public: 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 111 private: 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 119 SyntheticChildrenFrontEnd * 120 LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, 121 lldb::ValueObjectSP); 122 123 SyntheticChildrenFrontEnd * 124 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, 125 lldb::ValueObjectSP); 126 127 SyntheticChildrenFrontEnd * 128 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, 129 lldb::ValueObjectSP); 130 131 SyntheticChildrenFrontEnd * 132 LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, 133 lldb::ValueObjectSP); 134 135 SyntheticChildrenFrontEnd * 136 LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, 137 lldb::ValueObjectSP); 138 139 SyntheticChildrenFrontEnd * 140 LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, 141 lldb::ValueObjectSP); 142 143 SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *, 144 lldb::ValueObjectSP); 145 146 } // namespace formatters 147 } // namespace lldb_private 148 149 #endif // liblldb_LibCxx_h_ 150