Simplify code to print symbols and sections within a module using the built-in iterators.
llvm-svn: 141326
diff --git a/lldb/examples/python/symbolicate-crash.py b/lldb/examples/python/symbolicate-crash.py
index c7972ab..8b315d4 100755
--- a/lldb/examples/python/symbolicate-crash.py
+++ b/lldb/examples/python/symbolicate-crash.py
@@ -278,17 +278,12 @@
print_module_section (section.GetSubSectionAtIndex(sect_idx), depth - 1)
def print_module_sections (module, depth):
- num_sections = module.GetNumSections()
-
- for sect_idx in range(num_sections):
- section = module.GetSectionAtIndex(sect_idx)
- print_module_section (section, depth)
+ for sect in module.section_iter():
+ print_module_section (sect, depth)
def print_module_symbols (module):
- n = module.GetNumSymbols()
-
- for i in range(n):
- print module.GetSymbolAtIndex(i)
+ for sym in module:
+ print sym
def usage():
print "Usage: lldb-symbolicate.py [-n name] executable-image"