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/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index a35f94a..27f01d5 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/API/SBLineEntry.h"
+#include "lldb/API/SBStream.h"
 #include "lldb/Symbol/LineEntry.h"
 
 using namespace lldb;
@@ -152,7 +153,30 @@
     return *m_opaque_ap;
 }
 
+bool
+SBLineEntry::GetDescription (SBStream &description)
+{
+    if (m_opaque_ap.get())
+    {
+        // Line entry:  File, line x {, column y}:  Addresses: <start_addr> - <end_addr>
+        char file_path[PATH_MAX*2];
+        m_opaque_ap->file.GetPath (file_path, sizeof (file_path));
+        description.Printf ("Line entry: %s, line %d", file_path, GetLine());
+        if (GetColumn() > 0)
+            description.Printf (", column %d", GetColumn());
+        description.Printf (":  Addresses:  0x%p - 0x%p", GetStartAddress().GetFileAddress() , 
+                            GetEndAddress().GetFileAddress());
+    }
+    else
+        description.Printf ("No value");
 
+    return true;
+}
 
-
-
+PyObject *
+SBLineEntry::__repr__ ()
+{
+    SBStream description; 
+    GetDescription (description);
+    return PyString_FromString (description.GetData());
+}