| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (C) 2013 The Android Open Source Project | 3 # Copyright (C) 2013 The Android Open Source Project |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 from pylib import constants | 35 from pylib import constants |
| 36 from pylib.symbols import elf_symbolizer | 36 from pylib.symbols import elf_symbolizer |
| 37 | 37 |
| 38 | 38 |
| 39 CHROME_SRC = constants.DIR_SOURCE_ROOT | 39 CHROME_SRC = constants.DIR_SOURCE_ROOT |
| 40 ANDROID_BUILD_TOP = CHROME_SRC | 40 ANDROID_BUILD_TOP = CHROME_SRC |
| 41 SYMBOLS_DIR = CHROME_SRC | 41 SYMBOLS_DIR = CHROME_SRC |
| 42 CHROME_SYMBOLS_DIR = None | 42 CHROME_SYMBOLS_DIR = None |
| 43 ARCH = "arm" | 43 ARCH = "arm" |
| 44 TOOLCHAIN_INFO = None | 44 TOOLCHAIN_INFO = None |
| 45 | 45 SECONDARY_ABI_OUTPUT_PATH = None |
| 46 | 46 |
| 47 # See: | 47 # See: |
| 48 # http://bugs.python.org/issue14315 | 48 # http://bugs.python.org/issue14315 |
| 49 # https://hg.python.org/cpython/rev/6dd5e9556a60#l2.8 | 49 # https://hg.python.org/cpython/rev/6dd5e9556a60#l2.8 |
| 50 def PatchZipFile(): | 50 def PatchZipFile(): |
| 51 oldDecodeExtra = zipfile.ZipInfo._decodeExtra | 51 oldDecodeExtra = zipfile.ZipInfo._decodeExtra |
| 52 def decodeExtra(self): | 52 def decodeExtra(self): |
| 53 try: | 53 try: |
| 54 oldDecodeExtra(self) | 54 oldDecodeExtra(self) |
| 55 except struct.error: | 55 except struct.error: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ndk = "ndk" | 87 ndk = "ndk" |
| 88 elif ARCH == "x86_64" or ARCH == "x64": | 88 elif ARCH == "x86_64" or ARCH == "x64": |
| 89 toolchain_source = "x86_64-4.9" | 89 toolchain_source = "x86_64-4.9" |
| 90 toolchain_prefix = "x86_64-linux-android" | 90 toolchain_prefix = "x86_64-linux-android" |
| 91 ndk = "ndk" | 91 ndk = "ndk" |
| 92 elif ARCH == "mips": | 92 elif ARCH == "mips": |
| 93 toolchain_source = "mipsel-linux-android-4.9" | 93 toolchain_source = "mipsel-linux-android-4.9" |
| 94 toolchain_prefix = "mipsel-linux-android" | 94 toolchain_prefix = "mipsel-linux-android" |
| 95 ndk = "ndk" | 95 ndk = "ndk" |
| 96 else: | 96 else: |
| 97 raise Exception("Could not find tool chain") | 97 raise Exception("Could not find tool chain for " + ARCH) |
| 98 | 98 |
| 99 toolchain_subdir = ( | 99 toolchain_subdir = ( |
| 100 "third_party/android_tools/%s/toolchains/%s/prebuilt/linux-x86_64/bin" % | 100 "third_party/android_tools/%s/toolchains/%s/prebuilt/linux-x86_64/bin" % |
| 101 (ndk, toolchain_source)) | 101 (ndk, toolchain_source)) |
| 102 | 102 |
| 103 return os.path.join(CHROME_SRC, | 103 return os.path.join(CHROME_SRC, |
| 104 toolchain_subdir, | 104 toolchain_subdir, |
| 105 toolchain_prefix + "-" + tool) | 105 toolchain_prefix + "-" + tool) |
| 106 | 106 |
| 107 def FindToolchain(): | 107 def FindToolchain(): |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Name of the library which corresponds to that APK. | 291 Name of the library which corresponds to that APK. |
| 292 """ | 292 """ |
| 293 matching_apks = GetMatchingApks(device_apk_name) | 293 matching_apks = GetMatchingApks(device_apk_name) |
| 294 logging.debug('MapDeviceApkToLibrary: matching_apks=%s' % matching_apks) | 294 logging.debug('MapDeviceApkToLibrary: matching_apks=%s' % matching_apks) |
| 295 for matching_apk in matching_apks: | 295 for matching_apk in matching_apks: |
| 296 crazy_lib = GetCrazyLib(matching_apk) | 296 crazy_lib = GetCrazyLib(matching_apk) |
| 297 if crazy_lib: | 297 if crazy_lib: |
| 298 return crazy_lib | 298 return crazy_lib |
| 299 | 299 |
| 300 def GetLibrarySearchPaths(): | 300 def GetLibrarySearchPaths(): |
| 301 if SECONDARY_ABI_OUTPUT_PATH: |
| 302 return PathListJoin([SECONDARY_ABI_OUTPUT_PATH], ['lib.unstripped', 'lib', '
.']) |
| 301 if CHROME_SYMBOLS_DIR: | 303 if CHROME_SYMBOLS_DIR: |
| 302 return [CHROME_SYMBOLS_DIR] | 304 return [CHROME_SYMBOLS_DIR] |
| 303 dirs = _GetChromeOutputDirCandidates() | 305 dirs = _GetChromeOutputDirCandidates() |
| 304 # GYP places unstripped libraries under out/$BUILDTYPE/lib | 306 # GYP places unstripped libraries under out/$BUILDTYPE/lib |
| 305 # GN places them under out/$BUILDTYPE/lib.unstripped | 307 # GN places them under out/$BUILDTYPE/lib.unstripped |
| 306 return PathListJoin(dirs, ['lib.unstripped', 'lib', '.']) | 308 return PathListJoin(dirs, ['lib.unstripped', 'lib', '.']) |
| 307 | 309 |
| 308 def GetCandidateLibraries(library_name): | 310 def GetCandidateLibraries(library_name): |
| 309 """Returns a list of candidate library filenames. | 311 """Returns a list of candidate library filenames. |
| 310 | 312 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 process.stdin.write("\n") | 610 process.stdin.write("\n") |
| 609 process.stdin.close() | 611 process.stdin.close() |
| 610 demangled_symbol = process.stdout.readline().strip() | 612 demangled_symbol = process.stdout.readline().strip() |
| 611 process.stdout.close() | 613 process.stdout.close() |
| 612 return demangled_symbol | 614 return demangled_symbol |
| 613 | 615 |
| 614 def FormatSymbolWithOffset(symbol, offset): | 616 def FormatSymbolWithOffset(symbol, offset): |
| 615 if offset == 0: | 617 if offset == 0: |
| 616 return symbol | 618 return symbol |
| 617 return "%s+%d" % (symbol, offset) | 619 return "%s+%d" % (symbol, offset) |
| 620 |
| 621 def SetSecondaryAbiOutputPath(path): |
| 622 global SECONDARY_ABI_OUTPUT_PATH |
| 623 if SECONDARY_ABI_OUTPUT_PATH and SECONDARY_ABI_OUTPUT_PATH != path: |
| 624 raise Exception ("Assign SECONDARY_ABI_OUTPUT_PATH to different value " + |
| 625 " origin: %s new: %s" % ("", path)) |
| 626 else: |
| 627 SECONDARY_ABI_OUTPUT_PATH = path |
| OLD | NEW |