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:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "lldb/API/SBSymbolContext.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
#include "lldb/API/SBStream.h"
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
@@ -412,3 +413,26 @@ SBThread::operator*()
|
||||
{
|
||||
return *m_opaque_sp;
|
||||
}
|
||||
|
||||
bool
|
||||
SBThread::GetDescription (SBStream &description)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
m_opaque_sp->DumpInfo (description.ref(), true, true, true, LLDB_INVALID_INDEX32);
|
||||
description.Printf (" %d frames, (instance name: %s)", GetNumFrames(),
|
||||
m_opaque_sp->GetInstanceName().AsCString());
|
||||
}
|
||||
else
|
||||
description.Printf ("No value");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
SBThread::__repr__ ()
|
||||
{
|
||||
SBStream description;
|
||||
GetDescription (description);
|
||||
return PyString_FromString (description.GetData());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user