Add SWIG Python interface files for SBLineEntry, SBListener, and SBModule.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@135441 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/scripts/Python/interface/SBBreakpoint.i b/scripts/Python/interface/SBBreakpoint.i
index 3c2920a..0ca83bf 100644
--- a/scripts/Python/interface/SBBreakpoint.i
+++ b/scripts/Python/interface/SBBreakpoint.i
@@ -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:
diff --git a/scripts/Python/interface/SBLineEntry.i b/scripts/Python/interface/SBLineEntry.i
new file mode 100644
index 0000000..18dc6c3
--- /dev/null
+++ b/scripts/Python/interface/SBLineEntry.i
@@ -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
diff --git a/scripts/Python/interface/SBListener.i b/scripts/Python/interface/SBListener.i
new file mode 100644
index 0000000..ded91b9
--- /dev/null
+++ b/scripts/Python/interface/SBListener.i
@@ -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
diff --git a/scripts/Python/interface/SBModule.i b/scripts/Python/interface/SBModule.i
new file mode 100644
index 0000000..cea05e7
--- /dev/null
+++ b/scripts/Python/interface/SBModule.i
@@ -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