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 LibcxxStringSummaryProviderASCII( 23 ValueObject &valobj, Stream &stream, 24 const TypeSummaryOptions &summary_options); // libc++ std::string 25 26 bool LibcxxStringSummaryProviderUTF16( 27 ValueObject &valobj, Stream &stream, 28 const TypeSummaryOptions &summary_options); // libc++ std::u16string 29 30 bool LibcxxStringSummaryProviderUTF32( 31 ValueObject &valobj, Stream &stream, 32 const TypeSummaryOptions &summary_options); // libc++ std::u32string 33 34 bool LibcxxWStringSummaryProvider( 35 ValueObject &valobj, Stream &stream, 36 const TypeSummaryOptions &options); // libc++ std::wstring 37 38 bool LibcxxOptionalSummaryProvider( 39 ValueObject &valobj, Stream &stream, 40 const TypeSummaryOptions &options); // libc++ std::optional<> 41 42 bool LibcxxSmartPointerSummaryProvider( 43 ValueObject &valobj, Stream &stream, 44 const TypeSummaryOptions 45 &options); // libc++ std::shared_ptr<> and std::weak_ptr<> 46 47 bool LibcxxFunctionSummaryProvider( 48 ValueObject &valobj, Stream &stream, 49 const TypeSummaryOptions &options); // libc++ std::function<> 50 51 SyntheticChildrenFrontEnd * 52 LibcxxVectorBoolSyntheticFrontEndCreator(CXXSyntheticChildren *, 53 lldb::ValueObjectSP); 54 55 bool LibcxxContainerSummaryProvider(ValueObject &valobj, Stream &stream, 56 const TypeSummaryOptions &options); 57 58 class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 59 public: 60 LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); 61 62 size_t CalculateNumChildren() override; 63 64 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; 65 66 bool Update() override; 67 68 bool MightHaveChildren() override; 69 70 size_t GetIndexOfChildWithName(const ConstString &name) override; 71 72 ~LibCxxMapIteratorSyntheticFrontEnd() override; 73 74 private: 75 ValueObject *m_pair_ptr; 76 lldb::ValueObjectSP m_pair_sp; 77 }; 78 79 SyntheticChildrenFrontEnd * 80 LibCxxMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 81 lldb::ValueObjectSP); 82 83 SyntheticChildrenFrontEnd * 84 LibCxxVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *, 85 lldb::ValueObjectSP); 86 87 class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 88 public: 89 LibcxxSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); 90 91 size_t CalculateNumChildren() override; 92 93 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; 94 95 bool Update() override; 96 97 bool MightHaveChildren() override; 98 99 size_t GetIndexOfChildWithName(const ConstString &name) override; 100 101 ~LibcxxSharedPtrSyntheticFrontEnd() override; 102 103 private: 104 ValueObject *m_cntrl; 105 lldb::ValueObjectSP m_count_sp; 106 lldb::ValueObjectSP m_weak_count_sp; 107 uint8_t m_ptr_size; 108 lldb::ByteOrder m_byte_order; 109 }; 110 111 SyntheticChildrenFrontEnd * 112 LibcxxBitsetSyntheticFrontEndCreator(CXXSyntheticChildren *, 113 lldb::ValueObjectSP); 114 115 SyntheticChildrenFrontEnd * 116 LibcxxSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *, 117 lldb::ValueObjectSP); 118 119 SyntheticChildrenFrontEnd * 120 LibcxxStdVectorSyntheticFrontEndCreator(CXXSyntheticChildren *, 121 lldb::ValueObjectSP); 122 123 SyntheticChildrenFrontEnd * 124 LibcxxStdListSyntheticFrontEndCreator(CXXSyntheticChildren *, 125 lldb::ValueObjectSP); 126 127 SyntheticChildrenFrontEnd * 128 LibcxxStdForwardListSyntheticFrontEndCreator(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 *LibcxxQueueFrontEndCreator(CXXSyntheticChildren *, 144 lldb::ValueObjectSP); 145 146 SyntheticChildrenFrontEnd *LibcxxTupleFrontEndCreator(CXXSyntheticChildren *, 147 lldb::ValueObjectSP); 148 149 SyntheticChildrenFrontEnd * 150 LibcxxOptionalFrontEndCreator(CXXSyntheticChildren *, 151 lldb::ValueObjectSP valobj_sp); 152 153 SyntheticChildrenFrontEnd * 154 LibcxxVariantFrontEndCreator(CXXSyntheticChildren *, 155 lldb::ValueObjectSP valobj_sp); 156 157 } // namespace formatters 158 } // namespace lldb_private 159 160 #endif // liblldb_LibCxx_h_ 161