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/ValueObject.h" 15 #include "lldb/DataFormatters/TypeSummary.h" 16 #include "lldb/DataFormatters/TypeSynthetic.h" 17 #include "lldb/Utility/Stream.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 SyntheticChildrenFrontEnd * 36 LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, 37 lldb::ValueObjectSP); 38 39 bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, 40 const TypeSummaryOptions &options); 41 42 class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 43 public: 44 LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); 45 46 size_t CalculateNumChildren() override; 47 48 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; 49 50 bool Update() override; 51 52 bool MightHaveChildren() override; 53 54 size_t GetIndexOfChildWithName(const ConstString &name) override; 55 56 ~LibCxxMapIteratorSyntheticFrontEnd() override; 57 58 private: 59 ValueObject *m_pair_ptr; 60 lldb::ValueObjectSP m_pair_sp; 61 }; 62 63 SyntheticChildrenFrontEnd * 64 LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 65 lldb::ValueObjectSP); 66 67 SyntheticChildrenFrontEnd * 68 LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 69 lldb::ValueObjectSP); 70 71 class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 72 public: 73 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); 74 75 size_t CalculateNumChildren() override; 76 77 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; 78 79 bool Update() override; 80 81 bool MightHaveChildren() override; 82 83 size_t GetIndexOfChildWithName(const ConstString &name) override; 84 85 ~LibcxxSharedPtrSyntheticFrontEnd() override; 86 87 private: 88 ValueObject *m_cntrl; 89 lldb::ValueObjectSP m_count_sp; 90 lldb::ValueObjectSP m_weak_count_sp; 91 uint8_t m_ptr_size; 92 lldb::ByteOrder m_byte_order; 93 }; 94 95 SyntheticChildrenFrontEnd * 96 LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, 97 lldb::ValueObjectSP); 98 99 SyntheticChildrenFrontEnd * 100 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, 101 lldb::ValueObjectSP); 102 103 SyntheticChildrenFrontEnd * 104 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, 105 lldb::ValueObjectSP); 106 107 SyntheticChildrenFrontEnd * 108 LibcxxStdMapSyntheticFrontEndCreator(CXXSyntheticChildren *, 109 lldb::ValueObjectSP); 110 111 SyntheticChildrenFrontEnd * 112 LibcxxStdUnorderedMapSyntheticFrontEndCreator(CXXSyntheticChildren *, 113 lldb::ValueObjectSP); 114 115 SyntheticChildrenFrontEnd * 116 LibcxxInitializerListSyntheticFrontEndCreator(CXXSyntheticChildren *, 117 lldb::ValueObjectSP); 118 119 SyntheticChildrenFrontEnd *LibcxxFunctionFrontEndCreator(CXXSyntheticChildren *, 120 lldb::ValueObjectSP); 121 122 } // namespace formatters 123 } // namespace lldb_private 124 125 #endif // liblldb_LibCxx_h_ 126