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.
This commit is contained in:
Jonas Devlieghere 2020-01-07 16:45:43 -08:00
parent 5e2f4dc37b
commit 6563826ff0
4 changed files with 12 additions and 12 deletions

View File

@ -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)):

View File

@ -1,10 +0,0 @@
%extend lldb::SBTarget {
%nothreadallow;
const char *lldb::SBTarget::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
return description.GetData();
}
%clearnothreadallow;
}

View File

@ -95,7 +95,6 @@ def lldb_iter(obj, getsize, getelem):
%include "./Python/python-typemaps.swig"
%include "./headers.swig"
%include "./extensions.swig"
%{
#include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"

View File

@ -9,7 +9,6 @@
%module lldb
%include "./headers.swig"
%include "./extensions.swig"
%{
using namespace lldb_private;