From 6563826ff0f83cc8ef6c84154841245834a5b37e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 7 Jan 2020 16:45:43 -0800 Subject: Revert "Re-land "[lldb/Lua] Add string conversion operator for SBTarget."" This was returning a pointer to a stack-allocated memory location. This works for Python where we return a PythonString which must own the underlying string. --- lldb/scripts/Python/python-extensions.swig | 12 ++++++++++++ 1 file changed, 12 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 51b7e47..c10c32b 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -502,6 +502,18 @@ } %extend lldb::SBTarget { + %nothreadallow; + PyObject *lldb::SBTarget::__str__ (){ + lldb::SBStream description; + $self->GetDescription (description, lldb::eDescriptionLevelBrief); + 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; + return PythonString(llvm::StringRef(desc, desc_len)).release(); + } + %clearnothreadallow; + %pythoncode %{ def __eq__(self, rhs): if not isinstance(rhs, type(self)): -- cgit v1.1