[Lldb-commits] [lldb] r128523 - /lldb/trunk/examples/python/disasm.py

Jim Ingham jingham at apple.com
Tue Mar 29 18:55:23 PDT 2011


Author: jingham
Date: Tue Mar 29 20:55:23 2011
New Revision: 128523

URL: http://llvm.org/viewvc/llvm-project?rev=128523&view=rev
Log:
The example had gotten stale, so I made it work again, and for fun printed out the frame registers as well.

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=128523&r1=128522&r2=128523&view=diff
==============================================================================
--- lldb/trunk/examples/python/disasm.py (original)
+++ lldb/trunk/examples/python/disasm.py Tue Mar 29 20:55:23 2011
@@ -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()





More information about the lldb-commits mailing list