Skip to content

Commit

Permalink
Merge pull request #179 from zats/delay
Browse files Browse the repository at this point in the history
Add delay command
  • Loading branch information
kastiglione authored Dec 17, 2016
2 parents d935730 + c4a9b05 commit f0a8402
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions commands/FBDelay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/python
from threading import Timer
import fblldbbase as fb
import fblldbobjcruntimehelpers as runtimeHelpers
import lldb
import string


def lldbcommands():
return [
FBDelay()
]

class FBDelay(fb.FBCommand):
def name(self):
return 'zzz'

def description(self):
return 'Executes specified lldb command after delay.'

def args(self):
return [
fb.FBCommandArgument(arg='delay in seconds', type='float', help='time to wait before executing specified command'),
fb.FBCommandArgument(arg='lldb command', type='string', help='another lldb command to execute after specified delay', default='process interrupt')
]

def run(self, arguments, options):
lldb.debugger.SetAsync(True)
lldb.debugger.HandleCommand('process continue')
delay = float(arguments[0])
command = str(arguments[1])
t = Timer(delay, lambda: self.runDelayed(command))
t.start()

def runDelayed(self, command):
lldb.debugger.HandleCommand('process interrupt')
lldb.debugger.HandleCommand(command)

0 comments on commit f0a8402

Please sign in to comment.