Skip to content

Commit

Permalink
Merge pull request #233 from facebook/sequence
Browse files Browse the repository at this point in the history
Add command to run commands in sequence
  • Loading branch information
kastiglione committed Mar 7, 2018
2 parents 89297aa + 42d946c commit 713fd15
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 21 additions & 0 deletions commands/FBDebugCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def lldbcommands():
FBFindInstancesCommand(),
FBMethodBreakpointEnableCommand(),
FBMethodBreakpointDisableCommand(),
FBSequenceCommand(),
]

class FBWatchInstanceVariableCommand(fb.FBCommand):
Expand Down Expand Up @@ -377,3 +378,23 @@ def chiselLibraryPath(self):
source_dir = os.path.dirname(source_path)
# ugh: ../.. is to back out of commands/, then back out of libexec/
return os.path.join(source_dir, '..', '..', 'lib', 'Chisel.framework', 'Chisel')


class FBSequenceCommand(fb.FBCommand):
def name(self):
return 'sequence'

def description(self):
return 'Run commands in sequence, stopping on any error.'

def lex(self, commandLine):
return commandLine.split(';')

def run(self, arguments, options):
interpreter = lldb.debugger.GetCommandInterpreter()
# The full unsplit command is in position 0.
sequence = arguments[1:]
for command in sequence:
interpreter.HandleCommand(command.strip(), self.context, self.result)
if not self.result.Succeeded():
break
4 changes: 3 additions & 1 deletion fblldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def loadCommand(module, command, directory, filename, extension):
name=name))

def makeRunCommand(command, filename):
def runCommand(debugger, input, result, dict):
def runCommand(debugger, input, exe_ctx, result, _):
command.result = result
command.context = exe_ctx
splitInput = command.lex(input)

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

0 comments on commit 713fd15

Please sign in to comment.