[Lldb-commits] [lldb] r114602 - in /lldb/trunk: include/lldb/API/ lldb.xcodeproj/ scripts/ scripts/Python/ source/API/

Caroline Tice ctice at apple.com
Wed Sep 22 16:01:29 PDT 2010


Author: ctice
Date: Wed Sep 22 18:01:29 2010
New Revision: 114602

URL: http://llvm.org/viewvc/llvm-project?rev=114602&view=rev
Log:
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.


Added:
    lldb/trunk/scripts/Python/python-extensions.swig
Modified:
    lldb/trunk/include/lldb/API/SBAddress.h
    lldb/trunk/include/lldb/API/SBBlock.h
    lldb/trunk/include/lldb/API/SBBreakpoint.h
    lldb/trunk/include/lldb/API/SBBreakpointLocation.h
    lldb/trunk/include/lldb/API/SBCommandReturnObject.h
    lldb/trunk/include/lldb/API/SBCompileUnit.h
    lldb/trunk/include/lldb/API/SBDebugger.h
    lldb/trunk/include/lldb/API/SBDefines.h
    lldb/trunk/include/lldb/API/SBError.h
    lldb/trunk/include/lldb/API/SBEvent.h
    lldb/trunk/include/lldb/API/SBFileSpec.h
    lldb/trunk/include/lldb/API/SBFrame.h
    lldb/trunk/include/lldb/API/SBFunction.h
    lldb/trunk/include/lldb/API/SBInstruction.h
    lldb/trunk/include/lldb/API/SBLineEntry.h
    lldb/trunk/include/lldb/API/SBModule.h
    lldb/trunk/include/lldb/API/SBProcess.h
    lldb/trunk/include/lldb/API/SBSymbol.h
    lldb/trunk/include/lldb/API/SBSymbolContext.h
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/include/lldb/API/SBThread.h
    lldb/trunk/include/lldb/API/SBType.h
    lldb/trunk/include/lldb/API/SBValue.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/scripts/lldb.swig
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/API/SBBlock.cpp
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBCommandReturnObject.cpp
    lldb/trunk/source/API/SBCompileUnit.cpp
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBError.cpp
    lldb/trunk/source/API/SBEvent.cpp
    lldb/trunk/source/API/SBFileSpec.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBFunction.cpp
    lldb/trunk/source/API/SBLineEntry.cpp
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/API/SBSymbol.cpp
    lldb/trunk/source/API/SBSymbolContext.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/API/SBType.cpp
    lldb/trunk/source/API/SBValue.cpp

Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Wed Sep 22 18:01:29 2010
@@ -47,13 +47,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
 
     friend class SBFrame;

Modified: lldb/trunk/include/lldb/API/SBBlock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBlock.h (original)
+++ lldb/trunk/include/lldb/API/SBBlock.h Wed Sep 22 18:01:29 2010
@@ -52,13 +52,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject *, which contains a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBFrame;
     friend class SBSymbolContext;

Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Wed Sep 22 18:01:29 2010
@@ -116,13 +116,6 @@
     static lldb::SBBreakpointLocation
     GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBBreakpointLocation;
     friend class SBTarget;

Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Wed Sep 22 18:01:29 2010
@@ -74,13 +74,6 @@
     SBBreakpoint
     GetBreakpoint ();
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBBreakpoint;
 

Modified: lldb/trunk/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h Wed Sep 22 18:01:29 2010
@@ -61,13 +61,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBCommandInterpreter;
     friend class SBOptions;

Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/trunk/include/lldb/API/SBCompileUnit.h Wed Sep 22 18:01:29 2010
@@ -53,13 +53,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBFrame;
     friend class SBSymbolContext;

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Wed Sep 22 18:01:29 2010
@@ -157,13 +157,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
     uint32_t
     GetTerminalWidth () const;
 

Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Wed Sep 22 18:01:29 2010
@@ -10,11 +10,6 @@
 #ifndef LLDB_SBDefines_h_
 #define LLDB_SBDefines_h_
 
-// In order to guarantee correct working with Python, Python.h *MUST* be
-// the *FIRST* header file included:
-
-#include <Python.h>
-
 // C Includes
 // C++ Includes
 // Other libraries and framework includes

Modified: lldb/trunk/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Wed Sep 22 18:01:29 2010
@@ -68,13 +68,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBArguments;
     friend class SBDebugger;

Modified: lldb/trunk/include/lldb/API/SBEvent.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBEvent.h (original)
+++ lldb/trunk/include/lldb/API/SBEvent.h Wed Sep 22 18:01:29 2010
@@ -57,13 +57,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-   PyObject *
-   __repr__ ();
-
 protected:
     friend class SBListener;
     friend class SBBroadcaster;

Modified: lldb/trunk/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpec.h Wed Sep 22 18:01:29 2010
@@ -54,13 +54,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBBlock;
     friend class SBCompileUnit;

Modified: lldb/trunk/include/lldb/API/SBFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFrame.h (original)
+++ lldb/trunk/include/lldb/API/SBFrame.h Wed Sep 22 18:01:29 2010
@@ -115,13 +115,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBValue;
 

Modified: lldb/trunk/include/lldb/API/SBFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFunction.h (original)
+++ lldb/trunk/include/lldb/API/SBFunction.h Wed Sep 22 18:01:29 2010
@@ -42,13 +42,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBFrame;
     friend class SBSymbolContext;

Modified: lldb/trunk/include/lldb/API/SBInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBInstruction.h (original)
+++ lldb/trunk/include/lldb/API/SBInstruction.h Wed Sep 22 18:01:29 2010
@@ -49,13 +49,6 @@
     //bool
     //GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    //PyObject *
-    //__repr__ ();
-
 private:
 
     //lldb_private::Disassembler::Instruction::SharedPtr  m_opaque_sp;

Modified: lldb/trunk/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLineEntry.h (original)
+++ lldb/trunk/include/lldb/API/SBLineEntry.h Wed Sep 22 18:01:29 2010
@@ -61,13 +61,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBCompileUnit;
     friend class SBFrame;

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Wed Sep 22 18:01:29 2010
@@ -52,13 +52,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBSymbolContext;
     friend class SBTarget;

Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Wed Sep 22 18:01:29 2010
@@ -155,13 +155,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It take no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBAddress;
     friend class SBBreakpoint;

Modified: lldb/trunk/include/lldb/API/SBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbol.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbol.h Wed Sep 22 18:01:29 2010
@@ -43,13 +43,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     friend class SBSymbolContext;
 

Modified: lldb/trunk/include/lldb/API/SBSymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContext.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContext.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContext.h Wed Sep 22 18:01:29 2010
@@ -44,6 +44,9 @@
     SBLineEntry     GetLineEntry ();
     SBSymbol        GetSymbol ();
 
+    bool
+    GetDescription (lldb::SBStream &description);
+
 protected:
     friend class SBFrame;
     friend class SBModule;
@@ -58,6 +61,9 @@
     lldb_private::SymbolContext&
     operator*();
 
+    lldb_private::SymbolContext&
+    ref();
+
     const lldb_private::SymbolContext&
     operator*() const;
 
@@ -71,16 +77,6 @@
     void
     SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
 
-    bool
-    GetDescription (lldb::SBStream &description);
-
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 private:
     std::auto_ptr<lldb_private::SymbolContext> m_opaque_ap;
 };

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Wed Sep 22 18:01:29 2010
@@ -145,13 +145,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBAddress;
     friend class SBDebugger;

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Wed Sep 22 18:01:29 2010
@@ -91,13 +91,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBBreakpoint;
     friend class SBBreakpointLocation;

Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Wed Sep 22 18:01:29 2010
@@ -57,13 +57,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It takes no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     void *m_ast;
     void *m_type;

Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Wed Sep 22 18:01:29 2010
@@ -88,13 +88,6 @@
     bool
     GetDescription (lldb::SBStream &description);
 
-    // The following function gets called by Python when a user tries to print
-    // an object of this class.  It take no arguments and returns a
-    // PyObject * representing a char * (and it must be named "__repr__");
-
-    PyObject *
-    __repr__ ();
-
 protected:
     friend class SBValueList;
     friend class SBFrame;

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Sep 22 18:01:29 2010
@@ -1046,6 +1046,7 @@
 		9A42976211861AA600FE05CD /* CommandObjectBreakpointCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpointCommand.cpp; path = source/Commands/CommandObjectBreakpointCommand.cpp; sourceTree = "<group>"; };
 		9A4633DA11F65D8600955CE1 /* UserSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserSettingsController.h; path = include/lldb/Core/UserSettingsController.h; sourceTree = "<group>"; };
 		9A4633DC11F65D9A00955CE1 /* UserSettingsController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserSettingsController.cpp; path = source/Core/UserSettingsController.cpp; sourceTree = "<group>"; };
+		9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "python-extensions.swig"; sourceTree = "<group>"; };
 		9A633FE7112DCE3C001A7E43 /* SBFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFrame.cpp; path = source/API/SBFrame.cpp; sourceTree = "<group>"; };
 		9A633FE8112DCE3C001A7E43 /* SBFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFrame.h; path = include/lldb/API/SBFrame.h; sourceTree = "<group>"; };
 		9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScriptInterpreter.cpp; path = source/Interpreter/ScriptInterpreter.cpp; sourceTree = "<group>"; };
@@ -1553,6 +1554,7 @@
 				266960601199F4230075C61A /* build-swig-Python.sh */,
 				266960611199F4230075C61A /* edit-swig-python-wrapper-file.py */,
 				266960621199F4230075C61A /* finish-swig-Python-lldb.sh */,
+				9A48A3A7124AAA5A00922451 /* python-extensions.swig */,
 			);
 			path = Python;
 			sourceTree = "<group>";
@@ -2349,7 +2351,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				en,

Added: lldb/trunk/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=114602&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig (added)
+++ lldb/trunk/scripts/Python/python-extensions.swig Wed Sep 22 18:01:29 2010
@@ -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());
+        }
+}
+

Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Wed Sep 22 18:01:29 2010
@@ -156,4 +156,4 @@
 %include "lldb/API/SBValueList.h"
 %include "lldb/lldb-types.h"
 
-
+%include "./Python/python-extensions.swig"

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Wed Sep 22 18:01:29 2010
@@ -140,6 +140,7 @@
 bool
 SBAddress::GetDescription (SBStream &description)
 {
+    description.ref();
     if (m_opaque_ap.get())
     {
         m_opaque_ap->DumpDebug (description.get());
@@ -149,12 +150,3 @@
 
     return true;
 }
-
-PyObject *
-SBAddress::__repr__ ()
-{
-    SBStream description;
-    description.ref();            // Make sure it contains a valid StreamString.
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBlock.cpp (original)
+++ lldb/trunk/source/API/SBBlock.cpp Wed Sep 22 18:01:29 2010
@@ -158,12 +158,3 @@
     
     return true;
 }
-
-PyObject *
-SBBlock::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Wed Sep 22 18:01:29 2010
@@ -337,7 +337,7 @@
         else
             level = eDescriptionLevelBrief;
 
-
+        description.ref();
         m_opaque_sp->GetDescription (description.get(), level);
         description.get()->EOL();
     }
@@ -347,15 +347,6 @@
     return true;
 }
 
-PyObject *
-SBBreakpoint::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription ("full", description);
-    return PyString_FromString (description.GetData());
-}
-
 bool
 SBBreakpoint::PrivateBreakpointHitCallback 
 (

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Wed Sep 22 18:01:29 2010
@@ -212,6 +212,7 @@
         else
             level = eDescriptionLevelBrief;
 
+        description.ref();
         m_opaque_sp->GetDescription (description.get(), level);
         description.get()->EOL();
     }
@@ -221,15 +222,6 @@
     return true;
 }
 
-PyObject *
-SBBreakpointLocation::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription ("full", description);
-    return PyString_FromString (description.GetData());
-}
-
 SBBreakpoint
 SBBreakpointLocation::GetBreakpoint ()
 {

Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Wed Sep 22 18:01:29 2010
@@ -188,11 +188,3 @@
 
     return true;
 }
-
-PyObject *
-SBCommandReturnObject::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Wed Sep 22 18:01:29 2010
@@ -125,6 +125,7 @@
 {
     if (m_opaque_ptr)
     {
+        description.ref();
         m_opaque_ptr->Dump (description.get(), false);
     }
     else
@@ -132,12 +133,3 @@
     
     return true;
 }
-
-PyObject *
-SBCompileUnit::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Sep 22 18:01:29 2010
@@ -695,12 +695,3 @@
     
     return true;
 }
-
-
-PyObject *
-SBDebugger::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Wed Sep 22 18:01:29 2010
@@ -198,11 +198,3 @@
 
     return true;
 } 
-
-PyObject *
-SBError::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Wed Sep 22 18:01:29 2010
@@ -156,6 +156,7 @@
 {
     if (m_opaque)
     {
+        description.ref();
         m_opaque->Dump (description.get());
     }
     else
@@ -163,12 +164,3 @@
 
     return true;
 }
-
-PyObject *
-SBEvent::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Wed Sep 22 18:01:29 2010
@@ -158,11 +158,3 @@
     
     return true;
 }
-
-PyObject *
-SBFileSpec::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Sep 22 18:01:29 2010
@@ -394,6 +394,7 @@
 {
     if (m_opaque_sp)
     {
+        description.ref();
         m_opaque_sp->Dump (description.get(), true, false);
     }
     else
@@ -401,12 +402,3 @@
 
     return true;
 }
-
-PyObject *
-SBFrame::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Wed Sep 22 18:01:29 2010
@@ -69,6 +69,7 @@
 {
     if (m_opaque_ptr)
     {
+        description.ref();
         m_opaque_ptr->Dump (description.get(), false);
     }
     else
@@ -76,12 +77,3 @@
 
     return true;
 }
-
-PyObject *
-SBFunction::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Wed Sep 22 18:01:29 2010
@@ -172,11 +172,3 @@
 
     return true;
 }
-
-PyObject *
-SBLineEntry::__repr__ ()
-{
-    SBStream description; 
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Wed Sep 22 18:01:29 2010
@@ -133,6 +133,7 @@
 {
     if (m_opaque_sp)
     {
+        description.ref();
         m_opaque_sp->Dump (description.get());
     }
     else
@@ -140,12 +141,3 @@
 
     return true;
 }
-
-PyObject *
-SBModule::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Wed Sep 22 18:01:29 2010
@@ -485,11 +485,3 @@
 
     return true;
 }
-
-PyObject *
-SBProcess::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Wed Sep 22 18:01:29 2010
@@ -69,19 +69,12 @@
 {
     if (m_opaque_ptr)
     {
-        m_opaque_ptr->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
+        description.ref();
+        m_opaque_ptr->GetDescription (description.get(), 
+                                      lldb::eDescriptionLevelFull, NULL);
     }
     else
         description.Printf ("No value");
     
     return true;
 }
-
-PyObject *
-SBSymbol::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Wed Sep 22 18:01:29 2010
@@ -32,7 +32,12 @@
     m_opaque_ap ()
 {
     if (rhs.IsValid())
-        *m_opaque_ap = *rhs.m_opaque_ap;
+    {
+        if (m_opaque_ap.get())
+            *m_opaque_ap = *rhs.m_opaque_ap;
+        else
+            ref() = *rhs.m_opaque_ap;
+    }
 }
 
 SBSymbolContext::~SBSymbolContext ()
@@ -141,6 +146,14 @@
     return *m_opaque_ap.get();
 }
 
+lldb_private::SymbolContext&
+SBSymbolContext::ref()
+{
+    if (m_opaque_ap.get() == NULL)
+        m_opaque_ap.reset (new SymbolContext);
+    return *m_opaque_ap.get();
+}
+
 lldb_private::SymbolContext *
 SBSymbolContext::get() const
 {
@@ -152,6 +165,7 @@
 {
     if (m_opaque_ap.get())
     {
+        description.ref();
         m_opaque_ap->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
     }
     else
@@ -159,12 +173,3 @@
 
     return true;
 }
-
-PyObject *
-SBSymbolContext::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Sep 22 18:01:29 2010
@@ -507,6 +507,7 @@
 {
     if (m_opaque_sp)
     {
+        description.ref();
         m_opaque_sp->Dump (description.get());
     }
     else
@@ -514,12 +515,3 @@
     
     return true;
 }
-
-PyObject *
-SBTarget::__repr__ ()
-{
-    SBStream description;
-    description.ref();
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Wed Sep 22 18:01:29 2010
@@ -428,11 +428,3 @@
     
     return true;
 }
-
-PyObject *
-SBThread::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}

Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Wed Sep 22 18:01:29 2010
@@ -185,14 +185,6 @@
     return true;
 }
 
-PyObject *
-SBType::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}
-
 SBTypeMember::SBTypeMember () :
     m_ast (NULL),
     m_parent_type (NULL),

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=114602&r1=114601&r2=114602&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Sep 22 18:01:29 2010
@@ -293,11 +293,3 @@
 
     return true;
 }
-
-PyObject *
-SBValue::__repr__ ()
-{
-    SBStream description;
-    GetDescription (description);
-    return PyString_FromString (description.GetData());
-}





More information about the lldb-commits mailing list