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/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index 1e3c712..aa84575 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -12,6 +12,7 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBStream.h"
#include "lldb/API/SBThread.h"
#include "lldb/Breakpoint/Breakpoint.h"
@@ -321,12 +322,9 @@
return 0;
}
-void
-SBBreakpoint::GetDescription (FILE *f, const char *description_level)
+bool
+SBBreakpoint::GetDescription (const char *description_level, SBStream &description)
{
- if (f == NULL)
- return;
-
if (m_opaque_sp)
{
DescriptionLevel level;
@@ -339,11 +337,23 @@
else
level = eDescriptionLevelBrief;
- StreamFile str (f);
- m_opaque_sp->GetDescription (&str, level);
- str.EOL();
+ m_opaque_sp->GetDescription (description.get(), level);
+ description.get()->EOL();
}
+ else
+ description.Printf ("No value");
+
+ return true;
+}
+
+PyObject *
+SBBreakpoint::__repr__ ()
+{
+ SBStream description;
+ description.ref();
+ GetDescription ("full", description);
+ return PyString_FromString (description.GetData());
}
bool