Skip to content
Snippets Groups Projects
Commit 50ae5ab0 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

lrdp-v2: Add `--eval' option

Although the `--shell' option can currently be used for ad-hoc
debugging, it's not ideal for scripting since it prints out a bunch of
other stuff during initialization.  Add a dedicated `--eval' option that
executes arbitrary Python code without printing anything else.

Change-Id: I9e24e6d140dd49208b850b2a17ac2f599a35657b
parent e3ef28ce
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,8 @@ if __name__ == '__main__':
default=False)
parser.add_option('', '--ipc-debug', dest='ipc_debug', action='store_true',
help='Debug Mode for IPC Logging', default=False)
parser.add_option('', '--eval',
help='Evaluate some python code directly, or from stdin if "-" is passed. The "dump" variable will be available, as it is with the --shell option.') # noqa
for p in parser_util.get_parsers():
parser.add_option(p.shortopt or '',
......@@ -294,6 +296,14 @@ if __name__ == '__main__':
dump = RamDump(options, nm_path, gdb_path, objdump_path)
if options.eval:
if options.eval == '-':
code = sys.stdin.read()
else:
code = options.eval
exec(code)
sys.exit(0)
if options.shell or options.classic_shell:
print("Entering interactive shell mode.")
print("The RamDump instance is available in the `dump' variable\n")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment