-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from zats/delay
Add delay command
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |