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

Johnny Chen johnny.chen at apple.com
Wed May 25 15:01:17 PDT 2011


Author: johnny
Date: Wed May 25 17:01:16 2011
New Revision: 132088

URL: http://llvm.org/viewvc/llvm-project?rev=132088&view=rev
Log:
Add a little twist to the disasm.py script so that it is possible to terminate the inferior process
by entering 'Ctrl-D' or 'quit'.

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=132088&r1=132087&r2=132088&view=diff
==============================================================================
--- lldb/trunk/examples/python/disasm.py (original)
+++ lldb/trunk/examples/python/disasm.py Wed May 25 17:01:16 2011
@@ -11,7 +11,7 @@
 import lldb
 import os
 import sys
-import time
+import signal
 
 def disassemble_instructions (insts):
     for i in insts:
@@ -81,12 +81,17 @@
                         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
-            process.Continue()
-            # When we return from the above function we will hopefully be at the
-            # program exit. Print out some process info
-            print process
+            print "Hit the breakpoint at main, enter to continue and wait for program to exit or 'Ctrl-D'/'quit' to terminate the program"
+            next = sys.stdin.readline()
+            if not next or next.rstrip('\n') == 'quit':
+                print "Terminating the inferior process..."
+                process.Kill()
+            else:
+                # Now continue to the program exit
+                process.Continue()
+                # When we return from the above function we will hopefully be at the
+                # program exit. Print out some process info
+                print process
         elif state == lldb.eStateExited:
             print "Didn't hit the breakpoint at main, program has exited..."
         else:





More information about the lldb-commits mailing list