Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to run commands in sequence #233

Merged
merged 2 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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