diff options
Diffstat (limited to 'lldb/scripts/Python/interface')
-rw-r--r-- | lldb/scripts/Python/interface/SBData.i | 95 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBValue.i | 55 |
2 files changed, 149 insertions, 1 deletions
diff --git a/lldb/scripts/Python/interface/SBData.i b/lldb/scripts/Python/interface/SBData.i new file mode 100644 index 00000000000..416afb6eab9 --- /dev/null +++ b/lldb/scripts/Python/interface/SBData.i @@ -0,0 +1,95 @@ +//===-- SWIG Interface for SBData -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +namespace lldb { + +class SBData +{ +public: + + SBData (); + + SBData (const SBData &rhs); + + ~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); + + bool + GetDescription (lldb::SBStream &description); + + size_t + ReadRawData (lldb::SBError& error, + uint32_t offset, + void *buf, + size_t size); + + void + SetData(lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size); + + bool + Append(const SBData& rhs); + + +}; + +} // namespace lldb diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i index d73e6012c62..e87241070cb 100644 --- a/lldb/scripts/Python/interface/SBValue.i +++ b/lldb/scripts/Python/interface/SBValue.i @@ -196,6 +196,11 @@ public: lldb::SBValue CreateValueFromAddress(const char* name, lldb::addr_t address, const SBType& type); + lldb::SBValue + CreateValueFromData (const char* name, + const SBData& data, + const SBType& type); + lldb::SBType GetType(); @@ -278,9 +283,57 @@ public: bool GetExpressionPath (lldb::SBStream &description); + + %feature("docstring", " + //------------------------------------------------------------------ + /// 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. + //------------------------------------------------------------------ + ") GetPointeeData; + lldb::SBData + GetPointeeData (uint32_t item_idx = 0, + uint32_t item_count = 1); + + %feature("docstring", " + //------------------------------------------------------------------ + /// 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. + //------------------------------------------------------------------ + ") GetData; + lldb::SBData + GetData (); + + lldb::addr_t + GetLoadAddress(); + + lldb::SBAddress + GetAddress(); %feature("docstring", "Returns an expression path for this value." - ) GetValueForExpressionPath; + ) GetExpressionPath; bool GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes); }; |