aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/verify_api.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/scripts/verify_api.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/scripts/verify_api.py')
-rwxr-xr-xlldb/scripts/verify_api.py67
1 files changed, 49 insertions, 18 deletions
diff --git a/lldb/scripts/verify_api.py b/lldb/scripts/verify_api.py
index e636cdd..630247d 100755
--- a/lldb/scripts/verify_api.py
+++ b/lldb/scripts/verify_api.py
@@ -7,8 +7,10 @@ import os.path
import re
import sys
-def extract_exe_symbol_names (arch, exe_path, match_str):
- command = 'dsymutil --arch %s -s "%s" | grep "%s" | colrm 1 69' % (arch, exe_path, match_str)
+
+def extract_exe_symbol_names(arch, exe_path, match_str):
+ command = 'dsymutil --arch %s -s "%s" | grep "%s" | colrm 1 69' % (
+ arch, exe_path, match_str)
(command_exit_status, command_output) = commands.getstatusoutput(command)
if command_exit_status == 0:
if command_output:
@@ -19,27 +21,55 @@ def extract_exe_symbol_names (arch, exe_path, match_str):
print 'error: command failed with exit status %i\n command: %s' % (command_exit_status, command)
return list()
+
def verify_api(all_args):
'''Verify the API in the specified library is valid given one or more binaries.'''
usage = "usage: verify_api --library <path> [ --library <path> ...] executable1 [executable2 ...]"
- description='''Verify the API in the specified library is valid given one or more binaries.
-
+ description = '''Verify the API in the specified library is valid given one or more binaries.
+
Example:
-
+
verify_api.py --library ~/Documents/src/lldb/build/Debug/LLDB.framework/LLDB --arch x86_64 /Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB --api-regex lldb
'''
- parser = optparse.OptionParser(description=description, prog='verify_api',usage=usage)
- parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
- parser.add_option('-a', '--arch', type='string', action='append', dest='archs', help='architecure to use when checking the api')
- parser.add_option('-r', '--api-regex', type='string', dest='api_regex_str', help='Exclude any undefined symbols that do not match this regular expression when searching for missing APIs.')
- parser.add_option('-l', '--library', type='string', action='append', dest='libraries', help='Specify one or more libraries that will contain all needed APIs for the executables.')
+ parser = optparse.OptionParser(
+ description=description,
+ prog='verify_api',
+ usage=usage)
+ parser.add_option(
+ '-v',
+ '--verbose',
+ action='store_true',
+ dest='verbose',
+ help='display verbose debug info',
+ default=False)
+ parser.add_option(
+ '-a',
+ '--arch',
+ type='string',
+ action='append',
+ dest='archs',
+ help='architecure to use when checking the api')
+ parser.add_option(
+ '-r',
+ '--api-regex',
+ type='string',
+ dest='api_regex_str',
+ help='Exclude any undefined symbols that do not match this regular expression when searching for missing APIs.')
+ parser.add_option(
+ '-l',
+ '--library',
+ type='string',
+ action='append',
+ dest='libraries',
+ help='Specify one or more libraries that will contain all needed APIs for the executables.')
(options, args) = parser.parse_args(all_args)
-
+
api_external_symbols = list()
if options.archs:
for arch in options.archs:
for library in options.libraries:
- external_symbols = extract_exe_symbol_names(arch, library, "( SECT EXT)");
+ external_symbols = extract_exe_symbol_names(
+ arch, library, "( SECT EXT)")
if external_symbols:
for external_symbol in external_symbols:
api_external_symbols.append(external_symbol)
@@ -52,16 +82,17 @@ def verify_api(all_args):
print "API symbols:"
for (i, external_symbol) in enumerate(api_external_symbols):
print "[%u] %s" % (i, external_symbol)
-
+
api_regex = None
if options.api_regex_str:
api_regex = re.compile(options.api_regex_str)
-
- for arch in options.archs:
+
+ for arch in options.archs:
for exe_path in args:
print 'Verifying (%s) "%s"...' % (arch, exe_path)
exe_errors = 0
- undefined_symbols = extract_exe_symbol_names(arch, exe_path, "( UNDF EXT)");
+ undefined_symbols = extract_exe_symbol_names(
+ arch, exe_path, "( UNDF EXT)")
for undefined_symbol in undefined_symbols:
if api_regex:
match = api_regex.search(undefined_symbol)
@@ -79,6 +110,6 @@ def verify_api(all_args):
print 'error: missing %u API symbols from %s' % (exe_errors, options.libraries)
else:
print 'success'
-
+
if __name__ == '__main__':
- verify_api(sys.argv[1:]) \ No newline at end of file
+ verify_api(sys.argv[1:])