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/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 0f12890..acf98dd 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -25,6 +25,7 @@
 #include "lldb/API/SBInputReader.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBSourceManager.h"
+#include "lldb/API/SBStream.h"
 #include "lldb/API/SBStringList.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
@@ -669,3 +670,26 @@
         return false;
 }
 
+bool
+SBDebugger::GetDescription (SBStream &description)
+{
+    if (m_opaque_sp)
+    {
+        const char *name = m_opaque_sp->GetInstanceName().AsCString();
+        lldb::user_id_t id = m_opaque_sp->GetID();
+        description.Printf ("Debugger (instance: '%s', id: %d)", name, id);
+    }
+    else
+        description.Printf ("No value");
+    
+    return true;
+}
+
+
+PyObject *
+SBDebugger::__repr__ ()
+{
+    SBStream description;
+    GetDescription (description);
+    return PyString_FromString (description.GetData());
+}