From dac97f31a38cd97c4c2c0465d8fcd462e7744145 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Wed, 22 Sep 2010 23:01:29 +0000 Subject: Remove all the __repr__ methods from the API/*.h files, and put them into python-extensions.swig, which gets included into lldb.swig, and adds them back into the classes when swig generates it's C++ file. This keeps the Python stuff out of the general API classes. Also fixed a small bug in the copy constructor for SBSymbolContext. llvm-svn: 114602 --- lldb/scripts/Python/python-extensions.swig | 135 +++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 lldb/scripts/Python/python-extensions.swig (limited to 'lldb/scripts/Python/python-extensions.swig') diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig new file mode 100644 index 0000000..7d706fd --- /dev/null +++ b/lldb/scripts/Python/python-extensions.swig @@ -0,0 +1,135 @@ + +%extend lldb::SBAddress { + PyObject *lldb::SBAddress::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBBlock { + PyObject *lldb::SBBlock::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBBreakpoint { + PyObject *lldb::SBBreakpoint::__repr__ (){ + lldb::SBStream description; + $self->GetDescription ("full", description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBBreakpointLocation { + PyObject *lldb::SBBreakpointLocation::__repr__ (){ + lldb::SBStream description; + $self->GetDescription ("full", description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBCommandReturnObject { + PyObject *lldb::SBCommandReturnObject::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBCompileUnit { + PyObject *lldb::SBCompileUnit::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBDebugger { + PyObject *lldb::SBDebugger::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBError { + PyObject *lldb::SBError::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBFileSpec { + PyObject *lldb::SBFileSpec::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBFrame { + PyObject *lldb::SBFrame::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBFunction { + PyObject *lldb::SBFunction::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBLineEntry { + PyObject *lldb::SBLineEntry::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBModule { + PyObject *lldb::SBModule::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBProcess { + PyObject *lldb::SBProcess::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBSymbol { + PyObject *lldb::SBSymbol::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBSymbolContext { + PyObject *lldb::SBSymbolContext::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBTarget { + PyObject *lldb::SBTarget::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBThread { + PyObject *lldb::SBThread::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} +%extend lldb::SBValue { + PyObject *lldb::SBValue::__repr__ (){ + lldb::SBStream description; + $self->GetDescription (description); + return PyString_FromString (description.GetData()); + } +} + -- cgit v1.1