Add GetDescription() and __repr__ () methods to most API classes, to allow
"print" from inside Python to print out the objects in a more useful
manner.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114321 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index e338101..a0b340a 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBStream.h"
#include "lldb/Core/Module.h"
using namespace lldb;
@@ -127,3 +128,24 @@
return sb_sc;
}
+bool
+SBModule::GetDescription (SBStream &description)
+{
+ if (m_opaque_sp)
+ {
+ m_opaque_sp->Dump (description.get());
+ }
+ else
+ description.Printf ("No value");
+
+ return true;
+}
+
+PyObject *
+SBModule::__repr__ ()
+{
+ SBStream description;
+ description.ref();
+ GetDescription (description);
+ return PyString_FromString (description.GetData());
+}