summaryrefslogtreecommitdiff
path: root/lldb/scripts
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-01-07 16:45:43 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2020-01-07 16:45:43 -0800
commit6563826ff0f83cc8ef6c84154841245834a5b37e (patch)
tree19c35ecd6fb5ba37e5ff554e8a39454b4f647b27 /lldb/scripts
parent5e2f4dc37b1bf72bd27e929a68fec18ae1f5cfa8 (diff)
downloadllvm-6563826ff0f83cc8ef6c84154841245834a5b37e.tar.gz
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.
Diffstat (limited to 'lldb/scripts')
-rw-r--r--lldb/scripts/Python/python-extensions.swig12
-rw-r--r--lldb/scripts/extensions.swig10
-rw-r--r--lldb/scripts/lldb.swig1
-rw-r--r--lldb/scripts/lldb_lua.swig1
4 files changed, 12 insertions, 12 deletions
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig
index 51b7e4779116..c10c32b44877 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)):
diff --git a/lldb/scripts/extensions.swig b/lldb/scripts/extensions.swig
deleted file mode 100644
index 974d28b53399..000000000000
--- a/lldb/scripts/extensions.swig
+++ /dev/null
@@ -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;
-}
-
diff --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig
index 0adfcc27d635..f030116b6cb8 100644
--- a/lldb/scripts/lldb.swig
+++ b/lldb/scripts/lldb.swig
@@ -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"
diff --git a/lldb/scripts/lldb_lua.swig b/lldb/scripts/lldb_lua.swig
index 87f37397c858..85edefff76f2 100644
--- a/lldb/scripts/lldb_lua.swig
+++ b/lldb/scripts/lldb_lua.swig
@@ -9,7 +9,6 @@
%module lldb
%include "./headers.swig"
-%include "./extensions.swig"
%{
using namespace lldb_private;