[Lldb-commits] [lldb] r135441 - in /lldb/trunk: include/lldb/API/SBLineEntry.h include/lldb/API/SBListener.h include/lldb/API/SBModule.h scripts/Python/interface/SBBreakpoint.i scripts/Python/interface/SBLineEntry.i scripts/Python/interface/SBListener.i scripts/Python/interface/SBModule.i scripts/lldb.swig

Johnny Chen johnny.chen at apple.com
Mon Jul 18 16:11:07 PDT 2011


Author: johnny
Date: Mon Jul 18 18:11:07 2011
New Revision: 135441

URL: http://llvm.org/viewvc/llvm-project?rev=135441&view=rev
Log:
Add SWIG Python interface files for SBLineEntry, SBListener, and SBModule.

Added:
    lldb/trunk/scripts/Python/interface/SBLineEntry.i
    lldb/trunk/scripts/Python/interface/SBListener.i
    lldb/trunk/scripts/Python/interface/SBModule.i
Modified:
    lldb/trunk/include/lldb/API/SBLineEntry.h
    lldb/trunk/include/lldb/API/SBListener.h
    lldb/trunk/include/lldb/API/SBModule.h
    lldb/trunk/scripts/Python/interface/SBBreakpoint.i
    lldb/trunk/scripts/lldb.swig

Modified: lldb/trunk/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=135441&r1=135440&r2=135441&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLineEntry.h (original)
+++ lldb/trunk/include/lldb/API/SBLineEntry.h Mon Jul 18 18:11:07 2011
@@ -16,17 +16,8 @@
 
 namespace lldb {
 
-#ifdef SWIG
-%feature("docstring",
-         "Specifies an association with a contiguous range of instructions and"
-         " a source file location. SBCompileUnit contains SBLineEntry(s)."
-         ) SBLineEntry;
-#endif
 class SBLineEntry
 {
-#ifdef SWIG
-    %feature("autodoc", "1");
-#endif
 public:
 
     SBLineEntry ();

Modified: lldb/trunk/include/lldb/API/SBListener.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBListener.h?rev=135441&r1=135440&r2=135441&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBListener.h (original)
+++ lldb/trunk/include/lldb/API/SBListener.h Mon Jul 18 18:11:07 2011
@@ -16,9 +16,6 @@
 
 class SBListener
 {
-#ifdef SWIG
-    %feature("autodoc", "1");
-#endif
 public:
     SBListener ();
 

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=135441&r1=135440&r2=135441&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Mon Jul 18 18:11:07 2011
@@ -16,22 +16,8 @@
 
 namespace lldb {
 
-#ifdef SWIG
-%feature("docstring",
-         "Represents an executable image and its associated object and symbol"
-         " files.\n"
-         "\n"
-         "The module is designed to be able to select a single slice of an\n"
-         "executable image as it would appear on disk and during program\n"
-         "execution."
-         ) SBModule;
-#endif
 class SBModule
 {
-#ifdef SWIG
-    %feature("autodoc", "1");
-#endif
-
 public:
 
     SBModule ();
@@ -48,9 +34,6 @@
     bool
     IsValid () const;
 
-#ifdef SWIG
-    %feature("docstring", "
-#endif
     //------------------------------------------------------------------
     /// Get const accessor for the module file specification.
     ///
@@ -61,15 +44,9 @@
     /// @return
     ///     A const reference to the file specification object.
     //------------------------------------------------------------------
-#ifdef SWIG
-    ") GetFileSpec;
-#endif
     lldb::SBFileSpec
     GetFileSpec () const;
 
-#ifdef SWIG
-    %feature("docstring", "
-#endif
     //------------------------------------------------------------------
     /// Get accessor for the module platform file specification.
     ///
@@ -85,9 +62,6 @@
     /// @return
     ///     A const reference to the file specification object.
     //------------------------------------------------------------------
-#ifdef SWIG
-    ") GetPlatformFileSpec;
-#endif
     lldb::SBFileSpec
     GetPlatformFileSpec () const;
 
@@ -99,11 +73,6 @@
     GetUUIDBytes () const;
 #endif
 
-#ifdef SWIG
-    %feature("docstring",
-             "Returns the UUID of the module as a Python string."
-             ) GetUUIDString;
-#endif
     const char *
     GetUUIDString () const;
 
@@ -133,9 +102,6 @@
     lldb::SBSymbol
     GetSymbolAtIndex (size_t idx);
 
-#ifdef SWIG
-    %feature("docstring", "
-#endif
     //------------------------------------------------------------------
     /// Find functions by name.
     ///
@@ -160,18 +126,12 @@
     /// @return
     ///     The number of matches added to \a sc_list.
     //------------------------------------------------------------------
-#ifdef SWIG
-    ") FindFunctions;
-#endif
     uint32_t
     FindFunctions (const char *name, 
                    uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
                    bool append, 
                    lldb::SBSymbolContextList& sc_list);
 
-#ifdef SWIG
-    %feature("docstring", "
-#endif
     //------------------------------------------------------------------
     /// Find global and static variables by name.
     ///
@@ -188,9 +148,6 @@
     /// @return
     ///     A list of matched variables in an SBValueList.
     //------------------------------------------------------------------
-#ifdef SWIG
-    ") FindGlobalVariables;
-#endif
     lldb::SBValueList
     FindGlobalVariables (lldb::SBTarget &target, 
                          const char *name, 

Modified: lldb/trunk/scripts/Python/interface/SBBreakpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBreakpoint.i?rev=135441&r1=135440&r2=135441&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBBreakpoint.i (original)
+++ lldb/trunk/scripts/Python/interface/SBBreakpoint.i Mon Jul 18 18:11:07 2011
@@ -64,12 +64,19 @@
 
         process.Continue()
 
-SBBreakpoint supports breakpoint location iteration. For example,
+SBBreakpoint supports breakpoint location iteration, for example,
 
     for bl in breakpoint:
         print 'breakpoint location load addr: %s' % hex(bl.GetLoadAddress())
         print 'breakpoint location condition: %s' % hex(bl.GetCondition())
-") SBBreakpoint;
+
+and rich comparion methods which allow the API program to use,
+
+    if aBreakpoint == bBreakpoint:
+        ...
+
+to compare two breakpoints for equality."
+) SBBreakpoint;
 class SBBreakpoint
 {
 public:

Added: lldb/trunk/scripts/Python/interface/SBLineEntry.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBLineEntry.i?rev=135441&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBLineEntry.i (added)
+++ lldb/trunk/scripts/Python/interface/SBLineEntry.i Mon Jul 18 18:11:07 2011
@@ -0,0 +1,50 @@
+//===-- SWIG Interface for SBLineEntry --------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+namespace lldb {
+
+%feature("docstring",
+"Specifies an association with a contiguous range of instructions and
+a source file location. SBCompileUnit contains SBLineEntry(s).
+
+See also SBCompileUnit for example usage of SBLineEntry API."
+) SBLineEntry;
+class SBLineEntry
+{
+public:
+
+    SBLineEntry ();
+
+    SBLineEntry (const lldb::SBLineEntry &rhs);
+
+    ~SBLineEntry ();
+
+    lldb::SBAddress
+    GetStartAddress () const;
+
+    lldb::SBAddress
+    GetEndAddress () const;
+
+    bool
+    IsValid () const;
+
+    lldb::SBFileSpec
+    GetFileSpec () const;
+
+    uint32_t
+    GetLine () const;
+
+    uint32_t
+    GetColumn () const;
+
+    bool
+    GetDescription (lldb::SBStream &description);
+};
+
+} // namespace lldb

Added: lldb/trunk/scripts/Python/interface/SBListener.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBListener.i?rev=135441&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBListener.i (added)
+++ lldb/trunk/scripts/Python/interface/SBListener.i Mon Jul 18 18:11:07 2011
@@ -0,0 +1,89 @@
+//===-- SWIG Interface for SBListener ---------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+namespace lldb {
+
+%feature("docstring",
+"API clients can register its own listener to debugger events.
+
+See aslo SBEvent for example usage of creating and adding a listener."
+) SBListener;
+class SBListener
+{
+public:
+    SBListener ();
+
+    SBListener (const char *name);
+
+    SBListener (const SBListener &rhs);
+
+    ~SBListener ();
+
+    void
+    AddEvent (const lldb::SBEvent &event);
+
+    void
+    Clear ();
+
+    bool
+    IsValid () const;
+
+    uint32_t
+    StartListeningForEvents (const lldb::SBBroadcaster& broadcaster,
+                             uint32_t event_mask);
+
+    bool
+    StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
+                            uint32_t event_mask);
+
+    // Returns true if an event was recieved, false if we timed out.
+    bool
+    WaitForEvent (uint32_t num_seconds,
+                  lldb::SBEvent &event);
+
+    bool
+    WaitForEventForBroadcaster (uint32_t num_seconds,
+                                const lldb::SBBroadcaster &broadcaster,
+                                lldb::SBEvent &sb_event);
+
+    bool
+    WaitForEventForBroadcasterWithType (uint32_t num_seconds,
+                                        const lldb::SBBroadcaster &broadcaster,
+                                        uint32_t event_type_mask,
+                                        lldb::SBEvent &sb_event);
+
+    bool
+    PeekAtNextEvent (lldb::SBEvent &sb_event);
+
+    bool
+    PeekAtNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
+                                   lldb::SBEvent &sb_event);
+
+    bool
+    PeekAtNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
+                                           uint32_t event_type_mask,
+                                           lldb::SBEvent &sb_event);
+
+    bool
+    GetNextEvent (lldb::SBEvent &sb_event);
+
+    bool
+    GetNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
+                                lldb::SBEvent &sb_event);
+
+    bool
+    GetNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
+                                        uint32_t event_type_mask,
+                                        lldb::SBEvent &sb_event);
+
+    bool
+    HandleBroadcastEvent (const lldb::SBEvent &event);
+};
+
+} // namespace lldb

Added: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=135441&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (added)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Mon Jul 18 18:11:07 2011
@@ -0,0 +1,165 @@
+//===-- SWIG Interface for SBModule -----------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+namespace lldb {
+
+%feature("docstring",
+"Represents an executable image and its associated object and symbol files.
+
+The module is designed to be able to select a single slice of an
+executable image as it would appear on disk and during program
+execution.
+
+You can retrieve SBModule from SBSymbolContext, which in turn is available
+from SBFrame.
+
+SBModule supports symbol iteration, for example,
+
+    for symbol in module:
+        name = symbol.GetName()
+        saddr = symbol.GetStartAddress()
+        eaddr = symbol.GetEndAddress()
+
+and rich comparion methods which allow the API program to use,
+
+    if thisModule == thatModule:
+        print 'This module is the same as that module'
+
+to test module equality."
+) SBModule;
+class SBModule
+{
+public:
+
+    SBModule ();
+
+    SBModule (const SBModule &rhs);
+    
+    ~SBModule ();
+
+    bool
+    IsValid () const;
+
+    %feature("docstring", "
+    //------------------------------------------------------------------
+    /// Get const accessor for the module file specification.
+    ///
+    /// This function returns the file for the module on the host system
+    /// that is running LLDB. This can differ from the path on the 
+    /// platform since we might be doing remote debugging.
+    ///
+    /// @return
+    ///     A const reference to the file specification object.
+    //------------------------------------------------------------------
+    ") GetFileSpec;
+    lldb::SBFileSpec
+    GetFileSpec () const;
+
+    %feature("docstring", "
+    //------------------------------------------------------------------
+    /// Get accessor for the module platform file specification.
+    ///
+    /// Platform file refers to the path of the module as it is known on
+    /// the remote system on which it is being debugged. For local 
+    /// debugging this is always the same as Module::GetFileSpec(). But
+    /// remote debugging might mention a file '/usr/lib/liba.dylib'
+    /// which might be locally downloaded and cached. In this case the
+    /// platform file could be something like:
+    /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
+    /// The file could also be cached in a local developer kit directory.
+    ///
+    /// @return
+    ///     A const reference to the file specification object.
+    //------------------------------------------------------------------
+    ") GetPlatformFileSpec;
+    lldb::SBFileSpec
+    GetPlatformFileSpec () const;
+
+    bool
+    SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
+
+    %feature("docstring", "Returns the UUID of the module as a Python string."
+    ) GetUUIDString;
+    const char *
+    GetUUIDString () const;
+
+    bool
+    ResolveFileAddress (lldb::addr_t vm_addr, 
+                        lldb::SBAddress& addr);
+
+    lldb::SBSymbolContext
+    ResolveSymbolContextForAddress (const lldb::SBAddress& addr, 
+                                    uint32_t resolve_scope);
+
+    bool
+    GetDescription (lldb::SBStream &description);
+
+    size_t
+    GetNumSymbols ();
+    
+    lldb::SBSymbol
+    GetSymbolAtIndex (size_t idx);
+
+    %feature("docstring", "
+    //------------------------------------------------------------------
+    /// Find functions by name.
+    ///
+    /// @param[in] name
+    ///     The name of the function we are looking for.
+    ///
+    /// @param[in] name_type_mask
+    ///     A logical OR of one or more FunctionNameType enum bits that
+    ///     indicate what kind of names should be used when doing the
+    ///     lookup. Bits include fully qualified names, base names,
+    ///     C++ methods, or ObjC selectors. 
+    ///     See FunctionNameType for more details.
+    ///
+    /// @param[in] append
+    ///     If true, any matches will be appended to \a sc_list, else
+    ///     matches replace the contents of \a sc_list.
+    ///
+    /// @param[out] sc_list
+    ///     A symbol context list that gets filled in with all of the
+    ///     matches.
+    ///
+    /// @return
+    ///     The number of matches added to \a sc_list.
+    //------------------------------------------------------------------
+    ") FindFunctions;
+    uint32_t
+    FindFunctions (const char *name, 
+                   uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+                   bool append, 
+                   lldb::SBSymbolContextList& sc_list);
+
+    %feature("docstring", "
+    //------------------------------------------------------------------
+    /// Find global and static variables by name.
+    ///
+    /// @param[in] target
+    ///     A valid SBTarget instance representing the debuggee.
+    ///
+    /// @param[in] name
+    ///     The name of the global or static variable we are looking
+    ///     for.
+    ///
+    /// @param[in] max_matches
+    ///     Allow the number of matches to be limited to \a max_matches.
+    ///
+    /// @return
+    ///     A list of matched variables in an SBValueList.
+    //------------------------------------------------------------------
+    ") FindGlobalVariables;
+    lldb::SBValueList
+    FindGlobalVariables (lldb::SBTarget &target, 
+                         const char *name, 
+                         uint32_t max_matches);
+};
+
+} // namespace lldb

Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=135441&r1=135440&r2=135441&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Mon Jul 18 18:11:07 2011
@@ -215,9 +215,9 @@
 %include "lldb/API/SBInputReader.h"
 %include "lldb/API/SBInstruction.h"
 %include "lldb/API/SBInstructionList.h"
-%include "lldb/API/SBLineEntry.h"
-%include "lldb/API/SBListener.h"
-%include "lldb/API/SBModule.h"
+%include "./Python/interface/SBLineEntry.i"
+%include "./Python/interface/SBListener.i"
+%include "./Python/interface/SBModule.i"
 %include "./Python/interface/SBProcess.i"
 %include "lldb/API/SBSourceManager.h"
 %include "lldb/API/SBStream.h"





More information about the lldb-commits mailing list