[Lldb-commits] [lldb] r130456 - /lldb/trunk/examples/python/disasm.py
Johnny Chen
johnny.chen at apple.com
Thu Apr 28 16:26:17 PDT 2011
Author: johnny
Date: Thu Apr 28 18:26:17 2011
New Revision: 130456
URL: http://llvm.org/viewvc/llvm-project?rev=130456&view=rev
Log:
Modified to take advantage of the iteration protocol for our lldb container objects.
Modified:
lldb/trunk/examples/python/disasm.py
Modified: lldb/trunk/examples/python/disasm.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/disasm.py?rev=130456&r1=130455&r2=130456&view=diff
==============================================================================
--- lldb/trunk/examples/python/disasm.py (original)
+++ lldb/trunk/examples/python/disasm.py Thu Apr 28 18:26:17 2011
@@ -14,8 +14,8 @@
import time
def disassemble_instructions (insts):
- for i in range(insts.GetSize()):
- print insts.GetInstructionAtIndex(i)
+ for i in insts:
+ print i
# Create a new debugger instance
debugger = lldb.SBDebugger.Create()
@@ -74,17 +74,13 @@
insts = symbol.GetInstructions(target)
disassemble_instructions (insts)
- print "Frame registers:"
registerList = frame.GetRegisters()
- numRegisterSets = registerList.GetSize()
- for i in range (0, numRegisterSets):
- value = registerList.GetValueAtIndex(i)
- print value
- numChildren = value.GetNumChildren()
- if numChildren > 0:
- for j in range (0, numChildren):
- child = value.GetChildAtIndex(j)
- print "Name: ", child.GetName(), " Value: ", child.GetValue(frame)
+ print "Frame registers (size of register set = %d):" % registerList.GetSize()
+ for value in registerList:
+ #print value
+ print "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
+ for child in value:
+ print "Name: ", child.GetName(), " Value: ", child.GetValue(frame)
print "Hit the breakpoint at main, continue and wait for program to exit..."
# Now continue to the program exit
More information about the lldb-commits
mailing list