summaryrefslogtreecommitdiffstats
path: root/lldb/scripts
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-01-08 20:56:11 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2020-01-08 21:02:59 -0800
commit51bdd98b8a52d07004bcaddff26caf376a1c32bf (patch)
tree979384730992ef98f1ea73e9a3c8579b7226dd45 /lldb/scripts
parentd48ac7d54d8a096677c84cfb2928400e05b918ea (diff)
downloadbcm5719-llvm-51bdd98b8a52d07004bcaddff26caf376a1c32bf.tar.gz
bcm5719-llvm-51bdd98b8a52d07004bcaddff26caf376a1c32bf.zip
[lldb/SWIG] Refactor extensions to be non Python-specific (3/3)
The current SWIG extensions for the string conversion operator is Python specific because it uses the PythonObjects. This means that the code cannot be reused for other SWIG supported languages such as Lua. This reimplements the extensions in a more generic way that can be reused. It uses a SWIG macro to reduce code duplication. Differential revision: https://reviews.llvm.org/D72377
Diffstat (limited to 'lldb/scripts')
-rw-r--r--lldb/scripts/Python/python-extensions.swig257
-rw-r--r--lldb/scripts/interface/SBProcess.i2
-rw-r--r--lldb/scripts/interface/SBSection.i2
-rw-r--r--lldb/scripts/interface/SBSymbol.i2
-rw-r--r--lldb/scripts/interface/SBSymbolContext.i1
-rw-r--r--lldb/scripts/interface/SBSymbolContextList.i2
-rw-r--r--lldb/scripts/interface/SBThread.i2
-rw-r--r--lldb/scripts/interface/SBType.i5
-rw-r--r--lldb/scripts/interface/SBTypeCategory.i2
-rw-r--r--lldb/scripts/interface/SBTypeEnumMember.i1
-rw-r--r--lldb/scripts/interface/SBTypeFilter.i2
-rw-r--r--lldb/scripts/interface/SBTypeFormat.i2
-rw-r--r--lldb/scripts/interface/SBTypeNameSpecifier.i2
-rw-r--r--lldb/scripts/interface/SBTypeSummary.i2
-rw-r--r--lldb/scripts/interface/SBTypeSynthetic.i2
-rw-r--r--lldb/scripts/interface/SBValue.i2
-rw-r--r--lldb/scripts/interface/SBValueList.i23
-rw-r--r--lldb/scripts/interface/SBWatchpoint.i1
18 files changed, 59 insertions, 253 deletions
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig
index 36dac19644b..0b23fdd4000 100644
--- a/lldb/scripts/Python/python-extensions.swig
+++ b/lldb/scripts/Python/python-extensions.swig
@@ -125,32 +125,7 @@
%}
}
-%extend lldb::SBProcess {
- %nothreadallow;
- PyObject *lldb::SBProcess::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
-}
%extend lldb::SBSection {
- %nothreadallow;
- PyObject *lldb::SBSection::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
-
%pythoncode %{
def __eq__(self, rhs):
if not isinstance(rhs, type(self)):
@@ -180,17 +155,6 @@
{}
}
%extend lldb::SBSymbol {
- %nothreadallow;
- PyObject *lldb::SBSymbol::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
%pythoncode %{
def __eq__(self, rhs):
if not isinstance(rhs, type(self)):
@@ -205,32 +169,6 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
-%extend lldb::SBSymbolContext {
- %nothreadallow;
- PyObject *lldb::SBSymbolContext::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
-}
-%extend lldb::SBSymbolContextList {
- %nothreadallow;
- PyObject *lldb::SBSymbolContextList::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
-}
%extend lldb::SBTarget {
%pythoncode %{
@@ -248,44 +186,7 @@
%}
}
-%extend lldb::SBType {
- %nothreadallow;
- PyObject *lldb::SBType::__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;
-}
-%extend lldb::SBTypeCategory {
- %nothreadallow;
- PyObject *lldb::SBTypeCategory::__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;
-}
%extend lldb::SBTypeFilter {
- %nothreadallow;
- PyObject *lldb::SBTypeFilter::__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)):
@@ -300,70 +201,8 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
-%extend lldb::SBTypeFormat {
- %nothreadallow;
- PyObject *lldb::SBTypeFormat::__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;
-}
-%extend lldb::SBTypeMember {
- %nothreadallow;
- PyObject *lldb::SBTypeMember::__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;
-}
-%extend lldb::SBTypeMemberFunction {
- %nothreadallow;
- PyObject *lldb::SBTypeMemberFunction::__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;
-}
-%extend lldb::SBTypeEnumMember {
- %nothreadallow;
- PyObject *lldb::SBTypeEnumMember::__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;
-}
+
%extend lldb::SBTypeNameSpecifier {
- %nothreadallow;
- PyObject *lldb::SBTypeNameSpecifier::__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)):
@@ -378,18 +217,8 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
+
%extend lldb::SBTypeSummary {
- %nothreadallow;
- PyObject *lldb::SBTypeSummary::__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)):
@@ -404,18 +233,8 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
+
%extend lldb::SBTypeSynthetic {
- %nothreadallow;
- PyObject *lldb::SBTypeSynthetic::__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)):
@@ -430,18 +249,8 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
+
%extend lldb::SBThread {
- %nothreadallow;
- PyObject *lldb::SBThread::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
%pythoncode %{
def __eq__(self, rhs):
if not isinstance(rhs, type(self)):
@@ -456,64 +265,6 @@
return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
%}
}
-%extend lldb::SBValue {
- %nothreadallow;
- PyObject *lldb::SBValue::__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;
- return PythonString(llvm::StringRef(desc, desc_len)).release();
- }
- %clearnothreadallow;
-}
-%extend lldb::SBValueList {
- %nothreadallow;
- PyObject *lldb::SBValueList::__str__ (){
- lldb::SBStream description;
- const size_t n = $self->GetSize();
- if (n)
- {
- for (size_t i=0; i<n; ++i)
- $self->GetValueAtIndex(i).GetDescription(description);
- }
- else
- {
- description.Printf("<empty> lldb.SBValueList()");
- }
- 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;
-}
-%extend lldb::SBWatchpoint {
- %nothreadallow;
- PyObject *lldb::SBWatchpoint::__str__ (){
- lldb::SBStream description;
- $self->GetDescription (description, lldb::eDescriptionLevelVerbose);
- 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;
-}
-
-
-// %extend lldb::SBDebugger {
-// // FIXME: We can't get the callback and baton
-// PyObject *lldb::SBDebugger (){
-// // Only call Py_XDECREF if we have a Python object (or NULL)
-// if (LLDBSwigPythonCallPythonLogOutputCallback == $self->GetLogOutPutCallback())
-// Py_XDECREF($self->GetCallbackBaton());
-// }
-// }
%pythoncode %{
diff --git a/lldb/scripts/interface/SBProcess.i b/lldb/scripts/interface/SBProcess.i
index c5ebc246861..ac6a265faec 100644
--- a/lldb/scripts/interface/SBProcess.i
+++ b/lldb/scripts/interface/SBProcess.i
@@ -417,6 +417,8 @@ public:
lldb::SBProcessInfo
GetProcessInfo();
+ STRING_EXTENSION(SBProcess)
+
#ifdef SWIGPYTHON
%pythoncode %{
def __get_is_alive__(self):
diff --git a/lldb/scripts/interface/SBSection.i b/lldb/scripts/interface/SBSection.i
index c1a84acc4f1..3d1c900917f 100644
--- a/lldb/scripts/interface/SBSection.i
+++ b/lldb/scripts/interface/SBSection.i
@@ -114,6 +114,8 @@ public:
bool
operator != (const lldb::SBSection &rhs);
+ STRING_EXTENSION(SBSection)
+
#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
diff --git a/lldb/scripts/interface/SBSymbol.i b/lldb/scripts/interface/SBSymbol.i
index e5880e66d30..4e17ab5af0f 100644
--- a/lldb/scripts/interface/SBSymbol.i
+++ b/lldb/scripts/interface/SBSymbol.i
@@ -72,6 +72,8 @@ public:
bool
operator != (const lldb::SBSymbol &rhs) const;
+ STRING_EXTENSION(SBSymbol)
+
#ifdef SWIGPYTHON
%pythoncode %{
def get_instructions_from_current_target (self):
diff --git a/lldb/scripts/interface/SBSymbolContext.i b/lldb/scripts/interface/SBSymbolContext.i
index a6aa4d78bfe..b6b336516c9 100644
--- a/lldb/scripts/interface/SBSymbolContext.i
+++ b/lldb/scripts/interface/SBSymbolContext.i
@@ -81,6 +81,7 @@ public:
bool
GetDescription (lldb::SBStream &description);
+ STRING_EXTENSION(SBSymbolContext)
#ifdef SWIGPYTHON
%pythoncode %{
diff --git a/lldb/scripts/interface/SBSymbolContextList.i b/lldb/scripts/interface/SBSymbolContextList.i
index 54adc659fa2..f5adcfcebfb 100644
--- a/lldb/scripts/interface/SBSymbolContextList.i
+++ b/lldb/scripts/interface/SBSymbolContextList.i
@@ -60,6 +60,8 @@ public:
void
Clear();
+ STRING_EXTENSION(SBSymbolContextList)
+
#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
diff --git a/lldb/scripts/interface/SBThread.i b/lldb/scripts/interface/SBThread.i
index c1c045487fc..95b15b182ec 100644
--- a/lldb/scripts/interface/SBThread.i
+++ b/lldb/scripts/interface/SBThread.i
@@ -402,6 +402,8 @@ public:
bool
SafeToCallFunctions ();
+ STRING_EXTENSION(SBThread)
+
#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
diff --git a/lldb/scripts/interface/SBType.i b/lldb/scripts/interface/SBType.i
index d9da9e39b95..3cd82452084 100644
--- a/lldb/scripts/interface/SBType.i
+++ b/lldb/scripts/interface/SBType.i
@@ -43,6 +43,8 @@ public:
uint32_t
GetBitfieldSizeInBits();
+ STRING_EXTENSION_LEVEL(SBTypeMember, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
@@ -100,6 +102,7 @@ public:
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
+ STRING_EXTENSION_LEVEL(SBTypeMemberFunction, lldb::eDescriptionLevelBrief)
protected:
lldb::TypeMemberFunctionImplSP m_opaque_sp;
};
@@ -314,6 +317,8 @@ public:
bool operator!=(lldb::SBType &rhs);
+ STRING_EXTENSION_LEVEL(SBType, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
def template_arg_array(self):
diff --git a/lldb/scripts/interface/SBTypeCategory.i b/lldb/scripts/interface/SBTypeCategory.i
index 43fe9faf70f..b762bf8a95a 100644
--- a/lldb/scripts/interface/SBTypeCategory.i
+++ b/lldb/scripts/interface/SBTypeCategory.i
@@ -124,6 +124,8 @@ namespace lldb {
bool
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
+ STRING_EXTENSION_LEVEL(SBTypeCategory, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
diff --git a/lldb/scripts/interface/SBTypeEnumMember.i b/lldb/scripts/interface/SBTypeEnumMember.i
index b2d86171178..006bdeaa8ce 100644
--- a/lldb/scripts/interface/SBTypeEnumMember.i
+++ b/lldb/scripts/interface/SBTypeEnumMember.i
@@ -43,6 +43,7 @@ public:
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
+ STRING_EXTENSION_LEVEL(SBTypeEnumMember, lldb::eDescriptionLevelBrief)
#ifdef SWIGPYTHON
%pythoncode %{
name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')
diff --git a/lldb/scripts/interface/SBTypeFilter.i b/lldb/scripts/interface/SBTypeFilter.i
index 3759e0a23d4..c1d282c6d4f 100644
--- a/lldb/scripts/interface/SBTypeFilter.i
+++ b/lldb/scripts/interface/SBTypeFilter.i
@@ -61,6 +61,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeFilter &rhs);
+ STRING_EXTENSION_LEVEL(SBTypeFilter, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
options = property(GetOptions, SetOptions)
diff --git a/lldb/scripts/interface/SBTypeFormat.i b/lldb/scripts/interface/SBTypeFormat.i
index 5efd135b732..765a2a7bb99 100644
--- a/lldb/scripts/interface/SBTypeFormat.i
+++ b/lldb/scripts/interface/SBTypeFormat.i
@@ -61,6 +61,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeFormat &rhs);
+ STRING_EXTENSION_LEVEL(SBTypeFormat, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
format = property(GetFormat, SetFormat)
diff --git a/lldb/scripts/interface/SBTypeNameSpecifier.i b/lldb/scripts/interface/SBTypeNameSpecifier.i
index bb16e86b0bc..772f7c17409 100644
--- a/lldb/scripts/interface/SBTypeNameSpecifier.i
+++ b/lldb/scripts/interface/SBTypeNameSpecifier.i
@@ -53,6 +53,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeNameSpecifier &rhs);
+ STRING_EXTENSION_LEVEL(SBTypeNameSpecifier, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
name = property(GetName)
diff --git a/lldb/scripts/interface/SBTypeSummary.i b/lldb/scripts/interface/SBTypeSummary.i
index 225a404cf73..adcc79b5a6e 100644
--- a/lldb/scripts/interface/SBTypeSummary.i
+++ b/lldb/scripts/interface/SBTypeSummary.i
@@ -101,6 +101,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeSummary &rhs);
+ STRING_EXTENSION_LEVEL(SBTypeSummary, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
options = property(GetOptions, SetOptions)
diff --git a/lldb/scripts/interface/SBTypeSynthetic.i b/lldb/scripts/interface/SBTypeSynthetic.i
index d9d75e4c9ef..f57139ebf9f 100644
--- a/lldb/scripts/interface/SBTypeSynthetic.i
+++ b/lldb/scripts/interface/SBTypeSynthetic.i
@@ -63,6 +63,8 @@ namespace lldb {
bool
operator != (lldb::SBTypeSynthetic &rhs);
+ STRING_EXTENSION_LEVEL(SBTypeSynthetic, lldb::eDescriptionLevelBrief)
+
#ifdef SWIGPYTHON
%pythoncode %{
options = property(GetOptions, SetOptions)
diff --git a/lldb/scripts/interface/SBValue.i b/lldb/scripts/interface/SBValue.i
index 8647854e89c..fb899805c39 100644
--- a/lldb/scripts/interface/SBValue.i
+++ b/lldb/scripts/interface/SBValue.i
@@ -440,6 +440,8 @@ public:
const SBExpressionOptions &options,
const char *name) const;
+ STRING_EXTENSION(SBValue)
+
#ifdef SWIGPYTHON
%pythoncode %{
def __get_dynamic__ (self):
diff --git a/lldb/scripts/interface/SBValueList.i b/lldb/scripts/interface/SBValueList.i
index 56ef19054e4..17ba2056f0c 100644
--- a/lldb/scripts/interface/SBValueList.i
+++ b/lldb/scripts/interface/SBValueList.i
@@ -101,6 +101,29 @@ public:
lldb::SBValue
GetFirstValueByName (const char* name) const;
+ %extend {
+ %nothreadallow;
+ std::string lldb::SBValueList::__str__ (){
+ lldb::SBStream description;
+ const size_t n = $self->GetSize();
+ if (n)
+ {
+ for (size_t i=0; i<n; ++i)
+ $self->GetValueAtIndex(i).GetDescription(description);
+ }
+ else
+ {
+ description.Printf("<empty> lldb.SBValueList()");
+ }
+ 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 std::string(desc, desc_len);
+ }
+ %clearnothreadallow;
+ }
+
#ifdef SWIGPYTHON
%pythoncode %{
def __iter__(self):
diff --git a/lldb/scripts/interface/SBWatchpoint.i b/lldb/scripts/interface/SBWatchpoint.i
index e11c4f213ca..cb0bc5f9859 100644
--- a/lldb/scripts/interface/SBWatchpoint.i
+++ b/lldb/scripts/interface/SBWatchpoint.i
@@ -90,6 +90,7 @@ public:
static lldb::SBWatchpoint
GetWatchpointFromEvent (const lldb::SBEvent& event);
+ STRING_EXTENSION_LEVEL(SBWatchpoint, lldb::eDescriptionLevelVerbose)
};
} // namespace lldb
OpenPOWER on IntegriCloud