* Update mac symbol dump

Update posix generate_breakpad_symbols.py file to use argparse instead of deprecated optparse.
Also, make changes to the posix generate_breakpad_symbols.py file to accept multiple binaries.
And update dump-symbols.py to get symbols for the mac helper app as well.

* Changes to appease the linter
This commit is contained in:
Nitish Sakhawalkar 2018-05-20 18:01:17 -07:00 коммит произвёл Cheng Zhao
Родитель 7c19ae302e
Коммит b842a4b133
2 изменённых файлов: 31 добавлений и 38 удалений

Просмотреть файл

@ -22,18 +22,25 @@ def main(destination):
generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix', generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'posix',
'generate_breakpad_symbols.py') 'generate_breakpad_symbols.py')
if PLATFORM == 'darwin': if PLATFORM == 'darwin':
start = os.path.join(OUT_DIR, '{0}.app'.format(product_name), 'Contents', #macOS has an additional helper app; provide the path to that binary also
'MacOS', product_name) main_app = os.path.join(OUT_DIR, '{0}.app'.format(product_name),
'Contents', 'MacOS', product_name)
helper_name = product_name + " Helper"
helper_app = os.path.join(OUT_DIR, '{0}.app'.format(helper_name),
'Contents', 'MacOS', product_name + " Helper")
binaries = [main_app, helper_app]
else: else:
start = os.path.join(OUT_DIR, project_name) binaries = [os.path.join(OUT_DIR, project_name)]
args = [ args = [
'--build-dir={0}'.format(OUT_DIR), '--build-dir={0}'.format(OUT_DIR),
'--binary={0}'.format(start),
'--symbols-dir={0}'.format(destination), '--symbols-dir={0}'.format(destination),
'--libchromiumcontent-dir={0}'.format(CHROMIUM_DIR), '--libchromiumcontent-dir={0}'.format(CHROMIUM_DIR),
'--clear', '--clear',
'--jobs=16', '--jobs=16',
] ]
for binary in binaries:
args += '--binary={0}'.format(binary),
else: else:
generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'win', generate_breakpad_symbols = os.path.join(SOURCE_ROOT, 'tools', 'win',
'generate_breakpad_symbols.py') 'generate_breakpad_symbols.py')

Просмотреть файл

@ -11,7 +11,7 @@ platforms is planned.
""" """
import errno import errno
import optparse import argparse
import os import os
import Queue import Queue
import re import re
@ -218,44 +218,29 @@ def GenerateSymbols(options, binaries):
def main(): def main():
parser = optparse.OptionParser() parser = argparse.ArgumentParser(description='Generate Breakpad Symbols Project')
parser.add_option('', '--build-dir', default='', parser.add_argument('--build-dir', required=True,
help='The build output directory.') help='The build output directory.')
parser.add_option('', '--symbols-dir', default='', parser.add_argument('--symbols-dir', required=True,
help='The directory where to write the symbols file.') help='The directory where to write the symbols file.')
parser.add_option('', '--libchromiumcontent-dir', default='', parser.add_argument('--libchromiumcontent-dir', required=True,
help='The directory where libchromiumcontent is downloaded.') help='The directory where libchromiumcontent is downloaded.')
parser.add_option('', '--binary', default='', parser.add_argument('--binary', action='append', required=True,
help='The path of the binary to generate symbols for.') help='The path of the binary to generate symbols for.')
parser.add_option('', '--clear', default=False, action='store_true', parser.add_argument('--clear', default=False, action='store_true',
help='Clear the symbols directory before writing new ' help='Clear the symbols directory before writing new '
'symbols.') 'symbols.')
parser.add_option('-j', '--jobs', default=CONCURRENT_TASKS, action='store', parser.add_argument('-j', '--jobs', default=CONCURRENT_TASKS, action='store',
type='int', help='Number of parallel tasks to run.') type=int, help='Number of parallel tasks to run.')
parser.add_option('-v', '--verbose', action='store_true', parser.add_argument('-v', '--verbose', action='store_true',
help='Print verbose status output.') help='Print verbose status output.')
(options, _) = parser.parse_args() options = parser.parse_args()
if not options.symbols_dir: for bin_file in options.binary:
print "Required option --symbols-dir missing." if not os.access(bin_file, os.X_OK):
return 1 print "Cannot find %s." % options.binary
return 1
if not options.build_dir:
print "Required option --build-dir missing."
return 1
if not options.libchromiumcontent_dir:
print "Required option --libchromiumcontent-dir missing."
return 1
if not options.binary:
print "Required option --binary missing."
return 1
if not os.access(options.binary, os.X_OK):
print "Cannot find %s." % options.binary
return 1
if options.clear: if options.clear:
try: try:
@ -264,11 +249,12 @@ def main():
pass pass
# Build the transitive closure of all dependencies. # Build the transitive closure of all dependencies.
binaries = set([options.binary]) binaries = set(options.binary)
queue = [options.binary] queue = options.binary
exe_path = os.path.dirname(options.binary)
while queue: while queue:
deps = GetSharedLibraryDependencies(options, queue.pop(0), exe_path) current_bin = queue.pop(0)
exe_path = os.path.dirname(current_bin)
deps = GetSharedLibraryDependencies(options, current_bin, exe_path)
new_deps = set(deps) - binaries new_deps = set(deps) - binaries
binaries |= new_deps binaries |= new_deps
queue.extend(list(new_deps)) queue.extend(list(new_deps))