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. llvm-svn: 114321
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "lldb/API/SBCompileUnit.h"
|
||||
#include "lldb/API/SBLineEntry.h"
|
||||
#include "lldb/API/SBStream.h"
|
||||
#include "lldb/Symbol/CompileUnit.h"
|
||||
#include "lldb/Symbol/LineEntry.h"
|
||||
#include "lldb/Symbol/LineTable.h"
|
||||
@@ -118,3 +119,25 @@ SBCompileUnit::operator*() const
|
||||
{
|
||||
return *m_opaque_ptr;
|
||||
}
|
||||
|
||||
bool
|
||||
SBCompileUnit::GetDescription (SBStream &description)
|
||||
{
|
||||
if (m_opaque_ptr)
|
||||
{
|
||||
m_opaque_ptr->Dump (description.get(), false);
|
||||
}
|
||||
else
|
||||
description.Printf ("No Value");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
SBCompileUnit::__repr__ ()
|
||||
{
|
||||
SBStream description;
|
||||
description.ref();
|
||||
GetDescription (description);
|
||||
return PyString_FromString (description.GetData());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user