Skip to content

Commit 713fd15

Browse files
authored
Merge pull request #233 from facebook/sequence
Add command to run commands in sequence
2 parents 89297aa + 42d946c commit 713fd15

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

commands/FBDebugCommands.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def lldbcommands():
1717
FBFindInstancesCommand(),
1818
FBMethodBreakpointEnableCommand(),
1919
FBMethodBreakpointDisableCommand(),
20+
FBSequenceCommand(),
2021
]
2122

2223
class FBWatchInstanceVariableCommand(fb.FBCommand):
@@ -377,3 +378,23 @@ def chiselLibraryPath(self):
377378
source_dir = os.path.dirname(source_path)
378379
# ugh: ../.. is to back out of commands/, then back out of libexec/
379380
return os.path.join(source_dir, '..', '..', 'lib', 'Chisel.framework', 'Chisel')
381+
382+
383+
class FBSequenceCommand(fb.FBCommand):
384+
def name(self):
385+
return 'sequence'
386+
387+
def description(self):
388+
return 'Run commands in sequence, stopping on any error.'
389+
390+
def lex(self, commandLine):
391+
return commandLine.split(';')
392+
393+
def run(self, arguments, options):
394+
interpreter = lldb.debugger.GetCommandInterpreter()
395+
# The full unsplit command is in position 0.
396+
sequence = arguments[1:]
397+
for command in sequence:
398+
interpreter.HandleCommand(command.strip(), self.context, self.result)
399+
if not self.result.Succeeded():
400+
break

fblldb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ def loadCommand(module, command, directory, filename, extension):
5555
name=name))
5656

5757
def makeRunCommand(command, filename):
58-
def runCommand(debugger, input, result, dict):
58+
def runCommand(debugger, input, exe_ctx, result, _):
59+
command.result = result
60+
command.context = exe_ctx
5961
splitInput = command.lex(input)
6062

6163
# OptionParser will throw in the case where you want just one big long argument and no

0 commit comments

Comments
 (0)