From 10de09044e1de695faab21fecaca51352563f04e Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Wed, 10 Oct 2012 22:54:17 +0000 Subject: Implement a new SBDeclaration class to wrap an lldb_private::Declaration - make a GetDeclaration() API on SBValue to return a declaration. This will only work for vroot variables as they are they only objects for which we currently provide a valid Declaration llvm-svn: 165672 --- lldb/scripts/Python/python-extensions.swig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lldb/scripts/Python/python-extensions.swig') diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 19868fb..89ad1b2 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -111,6 +111,20 @@ return PyString_FromString(""); } } +%extend lldb::SBDeclaration { + PyObject *lldb::SBDeclaration::__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::SBError { PyObject *lldb::SBError::__str__ (){ lldb::SBStream description; -- cgit v1.1