aboutsummaryrefslogtreecommitdiff
path: root/lldb/utils/test/run-dis.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/utils/test/run-dis.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/utils/test/run-dis.py')
-rwxr-xr-xlldb/utils/test/run-dis.py51
1 files changed, 34 insertions, 17 deletions
diff --git a/lldb/utils/test/run-dis.py b/lldb/utils/test/run-dis.py
index a243794..b635e8c 100755
--- a/lldb/utils/test/run-dis.py
+++ b/lldb/utils/test/run-dis.py
@@ -5,7 +5,9 @@ Run lldb disassembler on all the binaries specified by a combination of root dir
and path pattern.
"""
-import os, sys, subprocess
+import os
+import sys
+import subprocess
import re
from optparse import OptionParser
@@ -29,11 +31,14 @@ template = '%s/lldb-disasm.py -C "platform select remote-ios" -o "-n" -q -e %s -
# Regular expression for detecting file output for Mach-o binary.
mach_o = re.compile('\sMach-O.+binary')
+
+
def isbinary(path):
- file_output = subprocess.Popen(["file", path],
+ file_output = subprocess.Popen(["file", path],
stdout=subprocess.PIPE).stdout.read()
return (mach_o.search(file_output) is not None)
+
def walk_and_invoke(sdk_root, path_regexp, suffix, num_symbols):
"""Look for matched file and invoke lldb disassembly on it."""
global scriptPath
@@ -49,7 +54,8 @@ def walk_and_invoke(sdk_root, path_regexp, suffix, num_symbols):
if os.path.islink(path):
continue
- # We'll be pattern matching based on the path relative to the SDK root.
+ # We'll be pattern matching based on the path relative to the SDK
+ # root.
replaced_path = path.replace(root_dir, "", 1)
# Check regular expression match for the replaced path.
if not path_regexp.search(replaced_path):
@@ -60,10 +66,12 @@ def walk_and_invoke(sdk_root, path_regexp, suffix, num_symbols):
if not isbinary(path):
continue
- command = template % (scriptPath, path, num_symbols if num_symbols > 0 else 1000)
+ command = template % (
+ scriptPath, path, num_symbols if num_symbols > 0 else 1000)
print "Running %s" % (command)
os.system(command)
+
def main():
"""Read the root dir and the path spec, invoke lldb-disasm.py on the file."""
global scriptPath
@@ -78,23 +86,32 @@ def main():
Run lldb disassembler on all the binaries specified by a combination of root dir
and path pattern.
""")
- parser.add_option('-r', '--root-dir',
- type='string', action='store',
- dest='root_dir',
- help='Mandatory: the root directory for the SDK symbols.')
- parser.add_option('-p', '--path-pattern',
- type='string', action='store',
- dest='path_pattern',
- help='Mandatory: regular expression pattern for the desired binaries.')
+ parser.add_option(
+ '-r',
+ '--root-dir',
+ type='string',
+ action='store',
+ dest='root_dir',
+ help='Mandatory: the root directory for the SDK symbols.')
+ parser.add_option(
+ '-p',
+ '--path-pattern',
+ type='string',
+ action='store',
+ dest='path_pattern',
+ help='Mandatory: regular expression pattern for the desired binaries.')
parser.add_option('-s', '--suffix',
type='string', action='store', default=None,
dest='suffix',
help='Specify the suffix of the binaries to look for.')
- parser.add_option('-n', '--num-symbols',
- type='int', action='store', default=-1,
- dest='num_symbols',
- help="""The number of symbols to disassemble, if specified.""")
-
+ parser.add_option(
+ '-n',
+ '--num-symbols',
+ type='int',
+ action='store',
+ default=-1,
+ dest='num_symbols',
+ help="""The number of symbols to disassemble, if specified.""")
opts, args = parser.parse_args()
if not opts.root_dir or not opts.path_pattern: