diff options
Diffstat (limited to 'lldb/scripts/Python')
-rwxr-xr-x | lldb/scripts/Python/build-swig-Python.sh | 2 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBModule.i | 4 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBModuleSpec.i | 133 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTarget.i | 3 | ||||
-rw-r--r-- | lldb/scripts/Python/python-extensions.swig | 31 |
5 files changed, 172 insertions, 1 deletions
diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index 96c4b2b73f6..28e7df91c1c 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -105,6 +105,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\ " ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\ " ${SRC_ROOT}/include/lldb/API/SBListener.h"\ " ${SRC_ROOT}/include/lldb/API/SBModule.h"\ +" ${SRC_ROOT}/include/lldb/API/SBModuleSpec.h"\ " ${SRC_ROOT}/include/lldb/API/SBProcess.h"\ " ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\ " ${SRC_ROOT}/include/lldb/API/SBStream.h"\ @@ -150,6 +151,7 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBLineEntry.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBListener.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBModule.i"\ +" ${SRC_ROOT}/scripts/Python/interface/SBModuleSpec.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBProcess.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBSourceManager.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBStream.i"\ diff --git a/lldb/scripts/Python/interface/SBModule.i b/lldb/scripts/Python/interface/SBModule.i index aa2571c1090..fdf017754d0 100644 --- a/lldb/scripts/Python/interface/SBModule.i +++ b/lldb/scripts/Python/interface/SBModule.i @@ -96,7 +96,9 @@ public: SBModule (); - SBModule (const SBModule &rhs); + SBModule (const lldb::SBModule &rhs); + + SBModule (const lldb::SBModuleSpec &module_spec); SBModule (lldb::SBProcess &process, lldb::addr_t header_addr); diff --git a/lldb/scripts/Python/interface/SBModuleSpec.i b/lldb/scripts/Python/interface/SBModuleSpec.i new file mode 100644 index 00000000000..55fd9b1a043 --- /dev/null +++ b/lldb/scripts/Python/interface/SBModuleSpec.i @@ -0,0 +1,133 @@ +//===-- SWIG Interface for SBModule -----------------------------*- 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 SBModuleSpec +{ +public: + + SBModuleSpec (); + + SBModuleSpec (const lldb::SBModuleSpec &rhs); + + ~SBModuleSpec (); + + bool + IsValid () const; + + void + Clear(); + + //------------------------------------------------------------------ + /// Get const accessor for the module file. + /// + /// This function returns the file for the module on the host system + /// that is running LLDB. This can differ from the path on the + /// platform since we might be doing remote debugging. + /// + /// @return + /// A const reference to the file specification object. + //------------------------------------------------------------------ + lldb::SBFileSpec + GetFileSpec (); + + void + SetFileSpec (const lldb::SBFileSpec &fspec); + + //------------------------------------------------------------------ + /// Get accessor for the module platform file. + /// + /// Platform file refers to the path of the module as it is known on + /// the remote system on which it is being debugged. For local + /// debugging this is always the same as Module::GetFileSpec(). But + /// remote debugging might mention a file '/usr/lib/liba.dylib' + /// which might be locally downloaded and cached. In this case the + /// platform file could be something like: + /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib' + /// The file could also be cached in a local developer kit directory. + /// + /// @return + /// A const reference to the file specification object. + //------------------------------------------------------------------ + lldb::SBFileSpec + GetPlatformFileSpec (); + + void + SetPlatformFileSpec (const lldb::SBFileSpec &fspec); + + lldb::SBFileSpec + GetSymbolFileSpec (); + + void + SetSymbolFileSpec (const lldb::SBFileSpec &fspec); + + const char * + GetObjectName (); + + void + SetObjectName (const char *name); + + const char * + GetTriple (); + + void + SetTriple (const char *triple); + + const uint8_t * + GetUUIDBytes (); + + size_t + GetUUIDLength (); + + bool + SetUUIDBytes (const uint8_t *uuid, size_t uuid_len); + + bool + GetDescription (lldb::SBStream &description); + +}; + + +class SBModuleSpecList +{ +public: + SBModuleSpecList(); + + SBModuleSpecList (const SBModuleSpecList &rhs); + + ~SBModuleSpecList(); + + static SBModuleSpecList + GetModuleSpecifications (const char *path); + + void + Append (const lldb::SBModuleSpec &spec); + + void + Append (const lldb::SBModuleSpecList &spec_list); + + lldb::SBModuleSpec + FindFirstMatchingSpec (const lldb::SBModuleSpec &match_spec); + + lldb::SBModuleSpecList + FindMatchingSpecs (const lldb::SBModuleSpec &match_spec); + + size_t + GetSize(); + + lldb::SBModuleSpec + GetSpecAtIndex (size_t i); + + bool + GetDescription (lldb::SBStream &description); + +}; + +} // namespace lldb diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i index e7dba2a7a00..a171d6f087a 100644 --- a/lldb/scripts/Python/interface/SBTarget.i +++ b/lldb/scripts/Python/interface/SBTarget.i @@ -515,6 +515,9 @@ public: const char *uuid_cstr, const char *symfile); + lldb::SBModule + AddModule (const SBModuleSpec &module_spec); + uint32_t GetNumModules () const; diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 14dc044856e..c4bc8b9141b 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -353,6 +353,37 @@ return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs) %} } + +%extend lldb::SBModuleSpec { + PyObject *lldb::SBModuleSpec::__str__ (){ + lldb::SBStream description; + $self->GetDescription (description); + const char *desc = description.GetData(); + size_t desc_len = description.GetSize(); + if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) + --desc_len; + if (desc_len > 0) + return PyString_FromStringAndSize (desc, desc_len); + else + return PyString_FromString(""); + } +} + +%extend lldb::SBModuleSpecList { + PyObject *lldb::SBModuleSpecList::__str__ (){ + lldb::SBStream description; + $self->GetDescription (description); + const char *desc = description.GetData(); + size_t desc_len = description.GetSize(); + if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) + --desc_len; + if (desc_len > 0) + return PyString_FromStringAndSize (desc, desc_len); + else + return PyString_FromString(""); + } +} + %extend lldb::SBProcess { PyObject *lldb::SBProcess::__str__ (){ lldb::SBStream description; |