[Lldb-commits] [lldb] r140449 - in /lldb/trunk/scripts/Python: interface/SBModule.i interface/SBSection.i modify-python-lldb.py

Johnny Chen johnny.chen at apple.com
Fri Sep 23 21:51:43 PDT 2011


Author: johnny
Date: Fri Sep 23 23:51:43 2011
New Revision: 140449

URL: http://llvm.org/viewvc/llvm-project?rev=140449&view=rev
Log:
SBSection supports iteration through its subsections, represented as SBSection as well.
SBModule supports an additional SBSection iteration, besides the original SBSymbol iteration.
Add docstrings and implement the two SBSection iteration protocols.

Modified:
    lldb/trunk/scripts/Python/interface/SBModule.i
    lldb/trunk/scripts/Python/interface/SBSection.i
    lldb/trunk/scripts/Python/modify-python-lldb.py

Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=140449&r1=140448&r2=140449&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Fri Sep 23 23:51:43 2011
@@ -31,7 +31,8 @@
     if thisModule == thatModule:
         print 'This module is the same as that module'
 
-to test module equality."
+to test module equality.  A module also contains object file sections, namely
+SBSection.  SBModule supports section iteration through section_iter()."
 ) SBModule;
 class SBModule
 {

Modified: lldb/trunk/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSection.i?rev=140449&r1=140448&r2=140449&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBSection.i (original)
+++ lldb/trunk/scripts/Python/interface/SBSection.i Fri Sep 23 23:51:43 2011
@@ -10,7 +10,10 @@
 namespace lldb {
 
 %feature("docstring",
-"Represents an executable image section."
+"Represents an executable image section.
+
+SBSection supports iteration through its subsection, represented as SBSection
+as well."
 ) SBSection;
 
 class SBSection

Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=140449&r1=140448&r2=140449&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Fri Sep 23 23:51:43 2011
@@ -150,6 +150,7 @@
 iter_def = "    def __iter__(self): return lldb_iter(self, '%s', '%s')"
 module_iter = "    def module_iter(self): return lldb_iter(self, '%s', '%s')"
 breakpoint_iter = "    def breakpoint_iter(self): return lldb_iter(self, '%s', '%s')"
+section_iter = "    def section_iter(self): return lldb_iter(self, '%s', '%s')"
 
 # Called to implement the built-in function len().
 # Eligible objects are those containers with unambiguous iteration support.
@@ -172,6 +173,7 @@
       'SBDebugger':    ('GetNumTargets',     'GetTargetAtIndex'),
       'SBModule':      ('GetNumSymbols',     'GetSymbolAtIndex'),
       'SBProcess':     ('GetNumThreads',     'GetThreadAtIndex'),
+      'SBSection':     ('GetNumSubSections', 'GetSubSectionAtIndex'),
       'SBThread':      ('GetNumFrames',      'GetFrameAtIndex'),
 
       'SBInstructionList':   ('GetSize', 'GetInstructionAtIndex'),
@@ -186,7 +188,10 @@
       # SBTarget needs special processing, see below.
       'SBTarget': {'module':     ('GetNumModules', 'GetModuleAtIndex'),
                    'breakpoint': ('GetNumBreakpoints', 'GetBreakpointAtIndex')
-                   }
+                   },
+
+      # SBModule has an additional section_iter(), see below.
+      'SBModule-extra': ('GetNumSections', 'GetSectionAtIndex')
       }
 
 #
@@ -332,6 +337,9 @@
                     new_content.add_line(eq_def % (cls, list_to_frag(e[cls])))
                     new_content.add_line(ne_def)
 
+            # SBModule has an extra SBSection iterator!
+            if cls == "SBModule":
+                new_content.add_line(section_iter % d[cls+'-extra'])
             # This special purpose iterator is for SBValue only!!!
             if cls == "SBValue":
                 new_content.add_line(linked_list_iter_def)





More information about the lldb-commits mailing list