summaryrefslogtreecommitdiffstats
path: root/components/breakpad
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 14:10:06 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 14:10:06 +0000
commit431bfcd282c6a9edce18fdbb773cff5f82c1af9b (patch)
treeaba157d6c866ef98a4b784654d597e8641d6d6b1 /components/breakpad
parentae9475b7ced68c8bc3de8e5b8f2dddc29e813c0f (diff)
downloadchromium_src-431bfcd282c6a9edce18fdbb773cff5f82c1af9b.zip
chromium_src-431bfcd282c6a9edce18fdbb773cff5f82c1af9b.tar.gz
chromium_src-431bfcd282c6a9edce18fdbb773cff5f82c1af9b.tar.bz2
Only generate breakpad symbols for build artefacts
Generating them for system libraries takes a long time, and they're unlikely to have symbols anyway. BUG=247431 R=marja@chromium.org Review URL: https://codereview.chromium.org/48633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/breakpad')
-rwxr-xr-xcomponents/breakpad/tools/generate_breakpad_symbols.py57
1 files changed, 29 insertions, 28 deletions
diff --git a/components/breakpad/tools/generate_breakpad_symbols.py b/components/breakpad/tools/generate_breakpad_symbols.py
index 176665d..e7ec3a9 100755
--- a/components/breakpad/tools/generate_breakpad_symbols.py
+++ b/components/breakpad/tools/generate_breakpad_symbols.py
@@ -38,21 +38,11 @@ def GetCommandOutput(command):
return output
-def GetDumpSymsBinary(dump_syms_dir=None):
+def GetDumpSymsBinary(build_dir=None):
"""Returns the path to the dump_syms binary."""
DUMP_SYMS = 'dump_syms'
- dump_syms_bin = None
- if dump_syms_dir:
- bin = os.path.join(os.path.expanduser(dump_syms_dir), DUMP_SYMS)
- if os.access(bin, os.X_OK):
- dump_syms_bin = bin
- else:
- for path in os.environ['PATH'].split(':'):
- bin = os.path.join(path, DUMP_SYMS)
- if os.access(bin, os.X_OK):
- dump_syms_bin = bin
- break
- if not dump_syms_bin:
+ dump_syms_bin = os.path.join(os.path.expanduser(build_dir), DUMP_SYMS)
+ if not os.access(dump_syms_bin, os.X_OK):
print 'Cannot find %s.' % DUMP_SYMS
sys.exit(1)
@@ -67,8 +57,8 @@ def Resolve(path, exe_path, loader_path, rpaths):
@rpath is replaced with the first path in |rpaths| where the referenced file
is found
"""
- path.replace('@loader_path', loader_path)
- path.replace('@executable_path', exe_path)
+ path = path.replace('@loader_path', loader_path)
+ path = path.replace('@executable_path', exe_path)
if path.find('@rpath') != -1:
for rpath in rpaths:
new_path = Resolve(path.replace('@rpath', rpath), exe_path, loader_path,
@@ -112,21 +102,29 @@ def GetSharedLibraryDependenciesMac(binary, exe_path):
m = lib_re.match(line)
if m:
dep = Resolve(m.group(1), exe_path, loader_path, rpaths)
- if dep and os.access(dep, os.X_OK):
+ if dep:
deps.append(os.path.normpath(dep))
return deps
-def GetSharedLibraryDependencies(binary, exe_path):
+def GetSharedLibraryDependencies(options, binary, exe_path):
"""Return absolute paths to all shared library dependecies of the binary."""
+ deps = []
if sys.platform.startswith('linux'):
- return GetSharedLibraryDependenciesLinux(binary)
-
- if sys.platform == 'darwin':
- return GetSharedLibraryDependenciesMac(binary, exe_path)
+ deps = GetSharedLibraryDependenciesLinux(binary)
+ elif sys.platform == 'darwin':
+ deps = GetSharedLibraryDependenciesMac(binary, exe_path)
+ else:
+ print "Platform not supported."
+ sys.exit(1)
- print "Platform not supported."
- sys.exit(1)
+ result = []
+ build_dir = os.path.abspath(options.build_dir)
+ for dep in deps:
+ if (os.access(dep, os.X_OK) and
+ os.path.abspath(os.path.dirname(dep)).startswith(build_dir)):
+ result.append(dep)
+ return result
def mkdir_p(path):
@@ -148,7 +146,7 @@ def GenerateSymbols(options, binaries):
while True:
binary = queue.get()
- syms = GetCommandOutput([GetDumpSymsBinary(options.dump_syms_dir),
+ syms = GetCommandOutput([GetDumpSymsBinary(options.build_dir),
binary])
module_line = re.match("MODULE [^ ]+ [^ ]+ ([0-9A-F]+) (.*)\n", syms)
output_path = os.path.join(options.symbols_dir, module_line.group(2),
@@ -174,9 +172,8 @@ def GenerateSymbols(options, binaries):
def main():
parser = optparse.OptionParser()
- parser.add_option('', '--dump-syms-dir', default='',
- help='The directory where dump_syms is installed. '
- 'Searches $PATH by default')
+ parser.add_option('', '--build-dir', default='',
+ help='The build output directory.')
parser.add_option('', '--symbols-dir', default='',
help='The directory where to write the symbols file.')
parser.add_option('', '--binary', default='',
@@ -193,6 +190,10 @@ def main():
print "Required option --symbols-dir missing."
return 1
+ if not options.build_dir:
+ print "Required option --build-dir missing."
+ return 1
+
if not options.binary:
print "Required option --binary missing."
return 1
@@ -212,7 +213,7 @@ def main():
queue = [options.binary]
exe_path = os.path.dirname(options.binary)
while queue:
- deps = GetSharedLibraryDependencies(queue.pop(0), exe_path)
+ deps = GetSharedLibraryDependencies(options, queue.pop(0), exe_path)
new_deps = set(deps) - binaries
binaries |= new_deps
queue.extend(list(new_deps))