diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-05-25 22:01:16 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-05-25 22:01:16 +0000 |
commit | 2dda91690f9f8ca6fcdf1ef2624007f1bfd64968 (patch) | |
tree | 992eb58f2115c91ad34caf8e3a1253643aba17c4 /lldb/examples/python/disasm.py | |
parent | 84b64a3e926f5daffe9eb09207ce028e13c883c5 (diff) | |
download | bcm5719-llvm-2dda91690f9f8ca6fcdf1ef2624007f1bfd64968.tar.gz bcm5719-llvm-2dda91690f9f8ca6fcdf1ef2624007f1bfd64968.zip |
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'.
llvm-svn: 132088
Diffstat (limited to 'lldb/examples/python/disasm.py')
-rwxr-xr-x | lldb/examples/python/disasm.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lldb/examples/python/disasm.py b/lldb/examples/python/disasm.py index 9dd2b74f9cc..4c4e2d7497b 100755 --- a/lldb/examples/python/disasm.py +++ b/lldb/examples/python/disasm.py @@ -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 @@ if target: 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: |