Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: tools/binary_size/libsupersize/console.py

Issue 2817813003: supersize: Add "diff" command (Closed)
Patch Set: review commetns Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/binary_size/libsupersize/archive.py ('k') | tools/binary_size/libsupersize/describe.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/libsupersize/console.py
diff --git a/tools/binary_size/libsupersize/console.py b/tools/binary_size/libsupersize/console.py
index 3dbb6a8b3639388c48888c5847a131e8bb2ce31d..e350f8178ee9267b8451fd682c57da070cd3db3b 100644
--- a/tools/binary_size/libsupersize/console.py
+++ b/tools/binary_size/libsupersize/console.py
@@ -206,9 +206,7 @@ class _Session(object):
atexit.register(lambda: readline.write_history_file(history_file))
def Eval(self, query):
- eval_result = eval(query, self._variables)
- if eval_result:
- self._PrintFunc(eval_result)
+ exec query in self._variables
def GoInteractive(self):
_Session._InitReadline()
@@ -221,10 +219,9 @@ def AddArguments(parser):
help='Input .size files to load. For a single file, it will be mapped to '
'the variable "size_info". For multiple inputs, the names will be '
'size_info1, size_info2, etc.')
- parser.add_argument(
- '--query', help='Print the result of the given snippet. Example: '
- 'size_info.symbols.WhereInSection("d")'
- '.WhereBiggerThan(100)')
+ parser.add_argument('--query',
+ help='Execute the given snippet. '
+ 'Example: Print(size_info)')
parser.add_argument('--tool-prefix', default='',
help='Path prefix for objdump. Required only for '
'Disassemble().')
@@ -239,7 +236,9 @@ def Run(args, parser):
parser.error('All inputs must end with ".size"')
size_infos = [archive.LoadAndPostProcessSizeInfo(p) for p in args.inputs]
- lazy_paths = paths.LazyPaths(args=args, input_file=args.inputs[0])
+ lazy_paths = paths.LazyPaths(tool_prefix=args.tool_prefix,
+ output_directory=args.output_directory,
+ any_path_within_output_directory=args.inputs[0])
session = _Session(size_infos, lazy_paths)
if args.query:
« no previous file with comments | « tools/binary_size/libsupersize/archive.py ('k') | tools/binary_size/libsupersize/describe.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698