The example had gotten stale, so I made it work again, and for fun printed out the frame registers as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128523 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/python/disasm.py b/examples/python/disasm.py
index 5d20874..e7f482f 100755
--- a/examples/python/disasm.py
+++ b/examples/python/disasm.py
@@ -31,13 +31,14 @@
if target.IsValid():
# If the target is valid set a breakpoint at main
- main_bp = target.BreakpointCreateByName ("main", sys.argv[1]);
+ main_bp = target.BreakpointCreateByName ("main", target.GetExecutable().GetFilename());
print main_bp
# Launch the process. Since we specified synchronous mode, we won't return
# from this function until we hit the breakpoint at main
- process = target.LaunchProcess ([''], [''], "/dev/stdout", 0, False)
+ error = lldb.SBError()
+ process = target.Launch (debugger.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
# Make sure the launch went ok
if process.IsValid():
@@ -72,6 +73,19 @@
# Now get all instructions for this symbol and print them
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 "Hit the breakpoint at main, continue and wait for program to exit..."
# Now continue to the program exit
process.Continue()