diff options
Diffstat (limited to 'lldb/include')
23 files changed, 579 insertions, 101 deletions
diff --git a/lldb/include/lldb/API/LLDB.h b/lldb/include/lldb/API/LLDB.h index 632f7aabfa2..d2eb79b0371 100644 --- a/lldb/include/lldb/API/LLDB.h +++ b/lldb/include/lldb/API/LLDB.h @@ -24,6 +24,7 @@ #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBCommunication.h" #include "lldb/API/SBCompileUnit.h" +#include "lldb/API/SBData.h" #include "lldb/API/SBDebugger.h" #include "lldb/API/SBError.h" #include "lldb/API/SBEvent.h" diff --git a/lldb/include/lldb/API/SBAddress.h b/lldb/include/lldb/API/SBAddress.h index fbe1f6a5832..e8a32a654ed 100644 --- a/lldb/include/lldb/API/SBAddress.h +++ b/lldb/include/lldb/API/SBAddress.h @@ -106,6 +106,7 @@ protected: friend class SBSymbolContext; friend class SBTarget; friend class SBThread; + friend class SBValue; #ifndef SWIG diff --git a/lldb/include/lldb/API/SBData.h b/lldb/include/lldb/API/SBData.h new file mode 100644 index 00000000000..63673153460 --- /dev/null +++ b/lldb/include/lldb/API/SBData.h @@ -0,0 +1,136 @@ +//===-- SBData.h -----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SBData_h_ +#define LLDB_SBData_h_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class SBData +{ +public: + + SBData (); + + SBData (const SBData &rhs); + +#ifndef SWIG + const SBData & + operator = (const SBData &rhs); +#endif + + ~SBData (); + + uint8_t + GetAddressByteSize (); + + void + Clear (); + + bool + IsValid(); + + size_t + GetByteSize (); + + lldb::ByteOrder + GetByteOrder(); + + float + GetFloat (lldb::SBError& error, uint32_t offset); + + double + GetDouble (lldb::SBError& error, uint32_t offset); + + long double + GetLongDouble (lldb::SBError& error, uint32_t offset); + + lldb::addr_t + GetAddress (lldb::SBError& error, uint32_t offset); + + uint8_t + GetUnsignedInt8 (lldb::SBError& error, uint32_t offset); + + uint16_t + GetUnsignedInt16 (lldb::SBError& error, uint32_t offset); + + uint32_t + GetUnsignedInt32 (lldb::SBError& error, uint32_t offset); + + uint64_t + GetUnsignedInt64 (lldb::SBError& error, uint32_t offset); + + int8_t + GetSignedInt8 (lldb::SBError& error, uint32_t offset); + + int16_t + GetSignedInt16 (lldb::SBError& error, uint32_t offset); + + int32_t + GetSignedInt32 (lldb::SBError& error, uint32_t offset); + + int64_t + GetSignedInt64 (lldb::SBError& error, uint32_t offset); + + const char* + GetString (lldb::SBError& error, uint32_t offset); + + size_t + ReadRawData (lldb::SBError& error, + uint32_t offset, + void *buf, + size_t size); + + bool + GetDescription (lldb::SBStream &description); + + // it would be nice to have SetData(SBError, const void*, size_t) when endianness and address size can be + // inferred from the existing DataExtractor, but having two SetData() signatures triggers a SWIG bug where + // the typemap isn't applied before resolving the overload, and thus the right function never gets called + void + SetData(lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size); + + // see SetData() for why we don't have Append(const void* buf, size_t size) + bool + Append(const SBData& rhs); + +protected: + +#ifndef SWIG + // Mimic shared pointer... + lldb_private::DataExtractor * + get() const; + + lldb_private::DataExtractor * + operator->() const; + + lldb::DataExtractorSP & + operator*(); + + const lldb::DataExtractorSP & + operator*() const; +#endif + + SBData (const lldb::DataExtractorSP &data_sp); + + void + SetOpaque (const lldb::DataExtractorSP &data_sp); + +private: + friend class SBValue; + + lldb::DataExtractorSP m_opaque_sp; +}; + + +} // namespace lldb + +#endif // LLDB_SBData_h_ diff --git a/lldb/include/lldb/API/SBDefines.h b/lldb/include/lldb/API/SBDefines.h index 72e6785ed58..553462c621c 100644 --- a/lldb/include/lldb/API/SBDefines.h +++ b/lldb/include/lldb/API/SBDefines.h @@ -34,6 +34,7 @@ class SBCommandInterpreter; class SBCommandReturnObject; class SBCommunication; class SBCompileUnit; +class SBData; class SBDebugger; class SBError; class SBEvent; diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index df26704e29a..8b91f28941a 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/include/lldb/API/SBError.h @@ -72,6 +72,7 @@ protected: #ifndef SWIG friend class SBArguments; + friend class SBData; friend class SBDebugger; friend class SBCommunication; friend class SBHostOS; diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h index ba533f8436a..5b912a7ca6c 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -62,6 +62,7 @@ protected: friend class SBBreakpoint; friend class SBBreakpointLocation; friend class SBCompileUnit; + friend class SBData; friend class SBEvent; friend class SBFrame; friend class SBFunction; diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 4851e43b418..44ec2cdb8a3 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -10,14 +10,10 @@ #ifndef LLDB_SBValue_h_ #define LLDB_SBValue_h_ +#include "lldb/API/SBData.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBType.h" -#include <stdio.h> - -#ifndef SWIG -class lldb_private::SyntheticScriptProvider; -#endif namespace lldb { @@ -130,6 +126,13 @@ public: lldb::SBValue CreateValueFromAddress(const char* name, lldb::addr_t address, const SBType& type); + + // this has no address! GetAddress() and GetLoadAddress() as well as AddressOf() + // on the return of this call all return invalid + lldb::SBValue + CreateValueFromData (const char* name, + const SBData& data, + const SBType& type); //------------------------------------------------------------------ /// Get a child value by index from a value. @@ -207,7 +210,51 @@ public: lldb::SBValue AddressOf(); + + lldb::addr_t + GetLoadAddress(); + + lldb::SBAddress + GetAddress(); + //------------------------------------------------------------------ + /// Get an SBData wrapping what this SBValue points to. + /// + /// This method will dereference the current SBValue, if its + /// data type is a T* or T[], and extract item_count elements + /// of type T from it, copying their contents in an SBData. + /// + /// @param[in] item_idx + /// The index of the first item to retrieve. For an array + /// this is equivalent to array[item_idx], for a pointer + /// to *(pointer + item_idx). In either case, the measurement + /// unit for item_idx is the sizeof(T) rather than the byte + /// + /// @param[in] item_count + /// How many items should be copied into the output. By default + /// only one item is copied, but more can be asked for. + /// + /// @return + /// An SBData with the contents of the copied items, on success. + /// An empty SBData otherwise. + //------------------------------------------------------------------ + lldb::SBData + GetPointeeData (uint32_t item_idx = 0, + uint32_t item_count = 1); + + //------------------------------------------------------------------ + /// Get an SBData wrapping the contents of this SBValue. + /// + /// This method will read the contents of this object in memory + /// and copy them into an SBData for future use. + /// + /// @return + /// An SBData with the contents of this SBValue, on success. + /// An empty SBData otherwise. + //------------------------------------------------------------------ + lldb::SBData + GetData (); + uint32_t GetNumChildren (); @@ -245,15 +292,24 @@ public: GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes); SBValue (const lldb::ValueObjectSP &value_sp); - + +#ifndef SWIG + // this must be defined in the .h file because synthetic children as implemented in the core + // currently rely on being able to extract the SharedPointer out of an SBValue. if the implementation + // is deferred to the .cpp file instead of being inlined here, the platform will fail to link + // correctly. however, this is temporary till a better general solution is found. FIXME + const lldb::ValueObjectSP& + get_sp() const + { + return m_opaque_sp; + } +#endif + protected: friend class SBValueList; friend class SBFrame; #ifndef SWIG - // need this to decapsulate the SP from here - friend class lldb_private::SyntheticScriptProvider; - // Mimic shared pointer... lldb_private::ValueObject * get() const; diff --git a/lldb/include/lldb/Core/DataExtractor.h b/lldb/include/lldb/Core/DataExtractor.h index e33ee46d11b..8a5b8aeeb3f 100644 --- a/lldb/include/lldb/Core/DataExtractor.h +++ b/lldb/include/lldb/Core/DataExtractor.h @@ -364,7 +364,10 @@ public: /// The size in bytes of address values that will be extracted. //------------------------------------------------------------------ uint8_t - GetAddressByteSize () const; + GetAddressByteSize () const + { + return m_addr_size; + } //------------------------------------------------------------------ /// Get the number of bytes contained in this object. @@ -373,7 +376,10 @@ public: /// The total number of bytes of data this object refers to. //------------------------------------------------------------------ size_t - GetByteSize () const; + GetByteSize () const + { + return m_end - m_start; + } //------------------------------------------------------------------ /// Extract a C string from \a *offset_ptr. @@ -480,7 +486,10 @@ public: /// object's data, or NULL of there is no data in this object. //------------------------------------------------------------------ const uint8_t * - GetDataEnd () const; + GetDataEnd () const + { + return m_end; + } //------------------------------------------------------------------ /// Get the shared data offset. @@ -503,7 +512,10 @@ public: /// object's data, or NULL of there is no data in this object. //------------------------------------------------------------------ const uint8_t * - GetDataStart () const; + GetDataStart () const + { + return m_start; + } //------------------------------------------------------------------ @@ -519,7 +531,7 @@ public: /// unmodified. /// /// @return - /// The integer value that was extracted, or zero on failure. + /// The floating value that was extracted, or zero on failure. //------------------------------------------------------------------ float GetFloat (uint32_t *offset_ptr) const; @@ -751,7 +763,10 @@ public: /// state. //------------------------------------------------------------------ lldb::ByteOrder - GetByteOrder() const; + GetByteOrder() const + { + return m_byte_order; + } //------------------------------------------------------------------ /// Extract a uint8_t value from \a *offset_ptr. @@ -1046,7 +1061,10 @@ public: /// The size in bytes to use when extracting addresses. //------------------------------------------------------------------ void - SetAddressByteSize (uint8_t addr_size); + SetAddressByteSize (uint8_t addr_size) + { + m_addr_size = addr_size; + } //------------------------------------------------------------------ /// Set data with a buffer that is caller owned. @@ -1139,7 +1157,10 @@ public: /// The byte order value to use when extracting data. //------------------------------------------------------------------ void - SetByteOrder (lldb::ByteOrder byte_order); + SetByteOrder (lldb::ByteOrder byte_order) + { + m_byte_order = byte_order; + } //------------------------------------------------------------------ /// Skip an LEB128 number at \a *offset_ptr. @@ -1170,7 +1191,10 @@ public: /// object, \b false otherwise. //------------------------------------------------------------------ bool - ValidOffset (uint32_t offset) const; + ValidOffset (uint32_t offset) const + { + return offset < GetByteSize(); + } //------------------------------------------------------------------ /// Test the availability of \a length bytes of data from \a offset. @@ -1182,6 +1206,15 @@ public: bool ValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const; + size_t + Copy (DataExtractor& dest_data) const; + + bool + Append (DataExtractor& rhs); + + bool + Append (void* bytes, uint32_t length); + protected: //------------------------------------------------------------------ // Member variables diff --git a/lldb/include/lldb/Core/FormatClasses.h b/lldb/include/lldb/Core/FormatClasses.h index d29ba7ff2af..59906f1626f 100644 --- a/lldb/include/lldb/Core/FormatClasses.h +++ b/lldb/include/lldb/Core/FormatClasses.h @@ -76,10 +76,7 @@ struct ValueFormat { return m_format; } - - std::string - FormatObject(lldb::ValueObjectSP object); - + }; class SyntheticChildrenFrontEnd diff --git a/lldb/include/lldb/Core/FormatManager.h b/lldb/include/lldb/Core/FormatManager.h index 2f58aecaf54..afe587a15b2 100644 --- a/lldb/include/lldb/Core/FormatManager.h +++ b/lldb/include/lldb/Core/FormatManager.h @@ -410,17 +410,17 @@ public: } lldb::FormatCategorySP - Category (const char* category_name = NULL, - bool can_create = true) + GetCategory (const char* category_name = NULL, + bool can_create = true) { if (!category_name) - return Category(m_default_category_name); - return Category(ConstString(category_name)); + return GetCategory(m_default_category_name); + return GetCategory(ConstString(category_name)); } lldb::FormatCategorySP - Category (const ConstString& category_name, - bool can_create = true); + GetCategory (const ConstString& category_name, + bool can_create = true); bool Get (ValueObject& valobj, diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 17960563fc9..afdb0e7f19e 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -679,23 +679,25 @@ public: bool UpdateValueIfNeeded (lldb::DynamicValueType use_dynamic, bool update_format = true); - void + bool UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic = lldb::eNoDynamicValues); - DataExtractor & - GetDataExtractor (); - lldb::ValueObjectSP GetSP () { return m_manager->GetSharedPointer(this); } -protected: void - AddSyntheticChild (const ConstString &key, - ValueObject *valobj); -public: + SetName (const ConstString &name); + + lldb::addr_t + GetAddressOf (bool scalar_is_load_address = true, + AddressType *address_type = NULL); + + lldb::addr_t + GetPointerValue (AddressType *address_type = NULL); + lldb::ValueObjectSP GetSyntheticChild (const ConstString &key) const; @@ -762,6 +764,9 @@ public: return false; } + virtual SymbolContextScope * + GetSymbolContextScope(); + static void DumpValueObject (Stream &s, ValueObject *valobj) @@ -864,14 +869,22 @@ public: // if it is a char* and check_pointer is true, // it also checks that the pointer is valid bool - IsCStringContainer(bool check_pointer = false); + IsCStringContainer (bool check_pointer = false); void - ReadPointedString(Stream& s, - Error& error, - uint32_t max_length = 0, - bool honor_array = true, - lldb::Format item_format = lldb::eFormatCharArray); + ReadPointedString (Stream& s, + Error& error, + uint32_t max_length = 0, + bool honor_array = true, + lldb::Format item_format = lldb::eFormatCharArray); + + virtual size_t + GetPointeeData (DataExtractor& data, + uint32_t item_idx = 0, + uint32_t item_count = 1); + + virtual size_t + GetData (DataExtractor& data); bool GetIsConstant () const @@ -894,18 +907,6 @@ public: } void - SetIsExpressionResult(bool expr) - { - m_is_expression_result = expr; - } - - bool - GetIsExpressionResult() - { - return m_is_expression_result; - } - - void SetFormat (lldb::Format format) { if (format != m_format) @@ -968,11 +969,22 @@ public: GetNonBaseClassParent(); void - SetPointersPointToLoadAddrs (bool b) + SetAddressTypeOfChildren(AddressType at) { - m_pointers_point_to_load_addrs = b; + m_address_type_of_ptr_or_ref_children = at; } - + + AddressType + GetAddressTypeOfChildren() + { + if (m_address_type_of_ptr_or_ref_children == eAddressTypeInvalid) + { + if (m_parent) + return m_parent->GetAddressTypeOfChildren(); + } + return m_address_type_of_ptr_or_ref_children; + } + protected: typedef ClusterManager<ValueObject> ValueObjectManager; @@ -1021,19 +1033,21 @@ protected: m_value_did_change:1, m_children_count_valid:1, m_old_value_valid:1, - m_pointers_point_to_load_addrs:1, m_is_deref_of_parent:1, m_is_array_item_for_pointer:1, m_is_bitfield_for_scalar:1, m_is_expression_path_child:1, - m_is_child_at_offset:1, - m_is_expression_result:1; + m_is_child_at_offset:1; - // used to prevent endless looping into GetpPrintableRepresentation() + // used to prevent endless looping into GetPrintableRepresentation() uint32_t m_dump_printable_counter; + + AddressType m_address_type_of_ptr_or_ref_children; + friend class ClangExpressionDeclMap; // For GetValue friend class ClangExpressionVariable; // For SetName friend class Target; // For SetName + friend class ValueObjectConstResultImpl; //------------------------------------------------------------------ // Constructors and Destructors @@ -1046,7 +1060,8 @@ protected: // Use this constructor to create a "root variable object". The ValueObject will be locked to this context // through-out its lifespan. - ValueObject (ExecutionContextScope *exe_scope); + ValueObject (ExecutionContextScope *exe_scope, + AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad); // Use this constructor to create a ValueObject owned by another ValueObject. It will inherit the ExecutionContext // of its parent. @@ -1088,19 +1103,14 @@ protected: void ClearUserVisibleData(); - -public: void - SetName (const ConstString &name); + AddSyntheticChild (const ConstString &key, + ValueObject *valobj); + + DataExtractor & + GetDataExtractor (); - lldb::addr_t - GetPointerValue (AddressType &address_type, - bool scalar_is_load_address); - - lldb::addr_t - GetAddressOf (AddressType &address_type, - bool scalar_is_load_address); private: //------------------------------------------------------------------ // For ValueObject only diff --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h index a6c9a36b7eb..df8012226c3 100644 --- a/lldb/include/lldb/Core/ValueObjectChild.h +++ b/lldb/include/lldb/Core/ValueObjectChild.h @@ -104,8 +104,9 @@ protected: // void // ReadValueFromMemory (ValueObject* parent, lldb::addr_t address); -private: +protected: friend class ValueObject; + friend class ValueObjectConstResult; ValueObjectChild (ValueObject &parent, clang::ASTContext *clang_ast, void *clang_type, @@ -115,7 +116,8 @@ private: uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool is_base_class, - bool is_deref_of_parent); + bool is_deref_of_parent, + AddressType child_ptr_or_ref_addr_type); DISALLOW_COPY_AND_ASSIGN (ValueObjectChild); }; diff --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h index e82f28c7136..d82390ee291 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/lldb/include/lldb/Core/ValueObjectConstResult.h @@ -16,10 +16,12 @@ // Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Core/ValueObjectConstResultImpl.h" + namespace lldb_private { //---------------------------------------------------------------------- -// A child of another ValueObject. +// A frozen ValueObject copied into host memory //---------------------------------------------------------------------- class ValueObjectConstResult : public ValueObject { @@ -27,14 +29,16 @@ public: static lldb::ValueObjectSP Create (ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, - uint32_t addr_byte_size); + uint32_t addr_byte_size, + lldb::addr_t address = LLDB_INVALID_ADDRESS); static lldb::ValueObjectSP Create (ExecutionContextScope *exe_scope, clang::ASTContext *clang_ast, void *clang_type, const ConstString &name, - const DataExtractor &data); + const DataExtractor &data, + lldb::addr_t address = LLDB_INVALID_ADDRESS); static lldb::ValueObjectSP Create (ExecutionContextScope *exe_scope, @@ -43,7 +47,8 @@ public: const ConstString &name, const lldb::DataBufferSP &result_data_sp, lldb::ByteOrder byte_order, - uint8_t addr_size); + uint8_t addr_size, + lldb::addr_t address = LLDB_INVALID_ADDRESS); static lldb::ValueObjectSP Create (ExecutionContextScope *exe_scope, @@ -91,7 +96,24 @@ public: void SetByteSize (size_t size); - + + virtual lldb::ValueObjectSP + Dereference (Error &error); + + virtual ValueObject * + CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); + + virtual lldb::ValueObjectSP + GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); + + virtual lldb::ValueObjectSP + AddressOf (Error &error); + + virtual size_t + GetPointeeData (DataExtractor& data, + uint32_t item_idx = 0, + uint32_t item_count = 1); + protected: virtual bool UpdateValue (); @@ -106,17 +128,22 @@ protected: clang::ASTContext *m_clang_ast; // The clang AST that the clang type comes from ConstString m_type_name; uint32_t m_byte_size; + + ValueObjectConstResultImpl m_impl; private: + friend class ValueObjectConstResultImpl; ValueObjectConstResult (ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, - uint32_t addr_byte_size); + uint32_t addr_byte_size, + lldb::addr_t address); ValueObjectConstResult (ExecutionContextScope *exe_scope, clang::ASTContext *clang_ast, void *clang_type, const ConstString &name, - const DataExtractor &data); + const DataExtractor &data, + lldb::addr_t address); ValueObjectConstResult (ExecutionContextScope *exe_scope, clang::ASTContext *clang_ast, @@ -124,7 +151,8 @@ private: const ConstString &name, const lldb::DataBufferSP &result_data_sp, lldb::ByteOrder byte_order, - uint8_t addr_size); + uint8_t addr_size, + lldb::addr_t address); ValueObjectConstResult (ExecutionContextScope *exe_scope, clang::ASTContext *clang_ast, diff --git a/lldb/include/lldb/Core/ValueObjectConstResultChild.h b/lldb/include/lldb/Core/ValueObjectConstResultChild.h new file mode 100644 index 00000000000..3dcef1ff4e5 --- /dev/null +++ b/lldb/include/lldb/Core/ValueObjectConstResultChild.h @@ -0,0 +1,78 @@ +//===-- ValueObjectConstResultChild.h -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ValueObjectConstResultChild_h_ +#define liblldb_ValueObjectConstResultChild_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/ValueObjectChild.h" +#include "lldb/Core/ValueObjectConstResultImpl.h" + +namespace lldb_private { + +//---------------------------------------------------------------------- +// A child of a ValueObjectConstResult. +//---------------------------------------------------------------------- +class ValueObjectConstResultChild : public ValueObjectChild +{ +public: + + ValueObjectConstResultChild (ValueObject &parent, + clang::ASTContext *clang_ast, + void *clang_type, + const ConstString &name, + uint32_t byte_size, + int32_t byte_offset, + uint32_t bitfield_bit_size, + uint32_t bitfield_bit_offset, + bool is_base_class, + bool is_deref_of_parent); + + virtual ~ValueObjectConstResultChild(); + + virtual lldb::ValueObjectSP + Dereference (Error &error); + + virtual ValueObject * + CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); + + virtual lldb::clang_type_t + GetClangType () + { + return ValueObjectChild::GetClangType(); + } + + virtual lldb::ValueObjectSP + GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); + + virtual lldb::ValueObjectSP + AddressOf (Error &error); + + virtual size_t + GetPointeeData (DataExtractor& data, + uint32_t item_idx = 0, + uint32_t item_count = 1); + +protected: + ValueObjectConstResultImpl m_impl; + +private: + friend class ValueObject; + friend class ValueObjectConstResult; + friend class ValueObjectConstResultImpl; + + DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResultChild); +}; + +} // namespace lldb_private + +#endif // liblldb_ValueObjectConstResultChild_h_ diff --git a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h new file mode 100644 index 00000000000..1b9c63fa4fa --- /dev/null +++ b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h @@ -0,0 +1,89 @@ +//===-- ValueObjectConstResultImpl.h -----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ValueObjectConstResultImpl_h_ +#define liblldb_ValueObjectConstResultImpl_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/ValueObject.h" + +namespace lldb_private { + +//---------------------------------------------------------------------- +// A class wrapping common implementation details for operations in +// ValueObjectConstResult ( & Child ) that may need to jump from the host +// memory space into the target's memory space +//---------------------------------------------------------------------- +class ValueObjectConstResultImpl +{ +public: + + ValueObjectConstResultImpl (ValueObject* valobj, + lldb::addr_t live_address = LLDB_INVALID_ADDRESS); + + virtual + ~ValueObjectConstResultImpl() + { + } + + lldb::ValueObjectSP + Dereference (Error &error); + + ValueObject * + CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index); + + lldb::ValueObjectSP + GetSyntheticChildAtOffset (uint32_t offset, const ClangASTType& type, bool can_create); + + lldb::ValueObjectSP + AddressOf (Error &error); + + bool + NeedsDerefOnTarget() + { + m_impl_backend->UpdateValueIfNeeded(false); + return (m_impl_backend->GetValue().GetValueType() == Value::eValueTypeHostAddress); + } + + lldb::addr_t + GetLiveAddress() + { + return m_live_address; + } + + void + SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS) + { + m_live_address = addr; + } + + lldb::ValueObjectSP + DerefOnTarget(); + + virtual size_t + GetPointeeData (DataExtractor& data, + uint32_t item_idx = 0, + uint32_t item_count = 1); + +private: + + ValueObject *m_impl_backend; + lldb::addr_t m_live_address; + lldb::ValueObjectSP m_load_addr_backend; + lldb::ValueObjectSP m_address_of_backend; + + DISALLOW_COPY_AND_ASSIGN (ValueObjectConstResultImpl); +}; + +} // namespace lldb_private + +#endif // liblldb_ValueObjectConstResultImpl_h_ diff --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h index 2e525eab863..575d37ae1b3 100644 --- a/lldb/include/lldb/Core/ValueObjectVariable.h +++ b/lldb/include/lldb/Core/ValueObjectVariable.h @@ -54,6 +54,9 @@ public: virtual Module* GetModule(); + + virtual SymbolContextScope * + GetSymbolContextScope(); protected: virtual bool diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 21becb6f297..91b2b6dc010 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -10,8 +10,6 @@ #ifndef liblldb_ScriptInterpreter_h_ #define liblldb_ScriptInterpreter_h_ -#include "lldb/API/SBValue.h" - #include "lldb/lldb-private.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Utility/PseudoTerminal.h" @@ -41,7 +39,7 @@ public: typedef uint32_t (*SWIGPythonCalculateNumChildren) (void *implementor); typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx); typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name); - typedef lldb::SBValue* (*SWIGPythonCastPyObjectToSBValue) (void* data); + typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); typedef void (*SWIGPythonUpdateSynthProviderInstance) (void* data); typedef bool (*SWIGPythonCallCommand) (const char *python_function_name, @@ -160,10 +158,10 @@ public: return 0; } - virtual void* + virtual lldb::ValueObjectSP GetChildAtIndex (void *implementor, uint32_t idx) { - return NULL; + return lldb::ValueObjectSP(); } virtual int @@ -177,12 +175,6 @@ public: { } - virtual lldb::SBValue* - CastPyObjectToSBValue (void* data) - { - return NULL; - } - virtual bool RunScriptBasedCommand(const char* impl_function, const char* args, diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h index 8e5033b3c41..e90e7cdb86a 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -23,7 +23,7 @@ #include "lldb/Host/Terminal.h" namespace lldb_private { - + class ScriptInterpreterPython : public ScriptInterpreter { public: @@ -69,7 +69,7 @@ public: virtual uint32_t CalculateNumChildren (void *implementor); - virtual void* + virtual lldb::ValueObjectSP GetChildAtIndex (void *implementor, uint32_t idx); virtual int @@ -78,9 +78,6 @@ public: virtual void UpdateSynthProviderInstance (void* implementor); - virtual lldb::SBValue* - CastPyObjectToSBValue (void* data); - virtual bool RunScriptBasedCommand(const char* impl_function, const char* args, @@ -161,6 +158,28 @@ protected: RestoreTerminalState (); private: + + class Locker + { + public: + Locker (ScriptInterpreterPython *py_interpreter, + FILE* wait_msg_handle = NULL, + bool need_session = true); + + bool + HasAcquiredLock () + { + return m_release_lock; + } + + ~Locker (); + + private: + bool m_need_session; + bool m_release_lock; + ScriptInterpreterPython *m_python_interpreter; + FILE* m_tmp_fh; + }; static size_t InputReaderCallback (void *baton, @@ -181,7 +200,6 @@ private: bool m_valid_session; }; - } // namespace lldb_private diff --git a/lldb/include/lldb/Symbol/ClangASTType.h b/lldb/include/lldb/Symbol/ClangASTType.h index 71fa375f8b1..9d256b77540 100644 --- a/lldb/include/lldb/Symbol/ClangASTType.h +++ b/lldb/include/lldb/Symbol/ClangASTType.h @@ -285,6 +285,21 @@ public: static lldb::clang_type_t GetPointeeType (lldb::clang_type_t opaque_clang_qual_type); + + lldb::clang_type_t + GetArrayElementType (uint32_t& stride); + + static lldb::clang_type_t + GetArrayElementType (clang::ASTContext* ast, + lldb::clang_type_t opaque_clang_qual_type, + uint32_t& stride); + + lldb::clang_type_t + GetPointerType (); + + static lldb::clang_type_t + GetPointerType (clang::ASTContext *ast_context, + lldb::clang_type_t opaque_clang_qual_type); static lldb::clang_type_t RemoveFastQualifiers (lldb::clang_type_t); diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 290d03203b2..789eeb66cc7 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -91,7 +91,12 @@ public: { return m_max_children_display; } - + uint32_t + GetMaximumSizeOfStringSummary() + { + return m_max_strlen_length; + } + protected: void @@ -107,6 +112,7 @@ protected: OptionValueBoolean m_skip_prologue; PathMappingList m_source_map; uint32_t m_max_children_display; + uint32_t m_max_strlen_length; }; @@ -478,7 +484,8 @@ public: bool prefer_file_cache, void *dst, size_t dst_len, - Error &error); + Error &error, + lldb::addr_t *load_addr_ptr = NULL); size_t ReadScalarIntegerFromMemory (const Address& addr, diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index b14860cd56e..950796d67a0 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -354,6 +354,7 @@ namespace lldb { eArgTypeCount, eArgTypeEndAddress, eArgTypeExpression, + eArgTypeExpressionPath, eArgTypeExprFormat, eArgTypeFilename, eArgTypeFormat, @@ -376,6 +377,9 @@ namespace lldb { eArgTypePid, eArgTypePlugin, eArgTypeProcessName, + eArgTypePythonClass, + eArgTypePythonFunction, + eArgTypePythonScript, eArgTypeQueueName, eArgTypeRegisterName, eArgTypeRegularExpression, diff --git a/lldb/include/lldb/lldb-forward-rtti.h b/lldb/include/lldb/lldb-forward-rtti.h index b4eb8c6ee0e..b89d9579acb 100644 --- a/lldb/include/lldb/lldb-forward-rtti.h +++ b/lldb/include/lldb/lldb-forward-rtti.h @@ -34,6 +34,7 @@ namespace lldb { typedef SharedPtr<lldb_private::Connection>::Type ConnectionSP; typedef SharedPtr<lldb_private::CompileUnit>::Type CompUnitSP; typedef SharedPtr<lldb_private::DataBuffer>::Type DataBufferSP; + typedef SharedPtr<lldb_private::DataExtractor>::Type DataExtractorSP; typedef SharedPtr<lldb_private::Debugger>::Type DebuggerSP; typedef SharedPtr<lldb_private::Disassembler>::Type DisassemblerSP; typedef SharedPtr<lldb_private::DynamicLoader>::Type DynamicLoaderSP; diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index e45f4de2286..c07af33ce20 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -181,6 +181,10 @@ class Value; class ValueFormat; class ValueList; class ValueObject; +class ValueObjectChild; +class ValueObjectConstResult; +class ValueObjectConstResultChild; +class ValueObjectConstResultImpl; class ValueObjectList; class Variable; class VariableList; |