From dde9cff32aee03e98a5ed91fc8425f241058c771 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Mon, 20 Sep 2010 05:20:02 +0000 Subject: 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 --- lldb/source/API/SBModule.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lldb/source/API/SBModule.cpp') diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index e338101c4e9f..a0b340a9cb7d 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -11,6 +11,7 @@ #include "lldb/API/SBAddress.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBStream.h" #include "lldb/Core/Module.h" using namespace lldb; @@ -127,3 +128,24 @@ SBModule::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolv return sb_sc; } +bool +SBModule::GetDescription (SBStream &description) +{ + if (m_opaque_sp) + { + m_opaque_sp->Dump (description.get()); + } + else + description.Printf ("No value"); + + return true; +} + +PyObject * +SBModule::__repr__ () +{ + SBStream description; + description.ref(); + GetDescription (description); + return PyString_FromString (description.GetData()); +} -- cgit v1.2.3