| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return "darwin-ppc" | 46 return "darwin-ppc" |
| 47 if uname == "Linux": | 47 if uname == "Linux": |
| 48 return "linux-x86" | 48 return "linux-x86" |
| 49 return uname | 49 return uname |
| 50 | 50 |
| 51 def ToolPath(tool, toolchain_info=None): | 51 def ToolPath(tool, toolchain_info=None): |
| 52 """Return a full qualified path to the specified tool""" | 52 """Return a full qualified path to the specified tool""" |
| 53 # ToolPath looks for the tools in the completely incorrect directory. | 53 # ToolPath looks for the tools in the completely incorrect directory. |
| 54 # This looks in the checked in android_tools. | 54 # This looks in the checked in android_tools. |
| 55 if ARCH == "arm": | 55 if ARCH == "arm": |
| 56 toolchain_source = "arm-linux-androideabi-4.6" | 56 toolchain_source = "arm-linux-androideabi-4.9" |
| 57 toolchain_prefix = "arm-linux-androideabi" | 57 toolchain_prefix = "arm-linux-androideabi" |
| 58 ndk = "ndk" | 58 ndk = "ndk" |
| 59 elif ARCH == "arm64": | 59 elif ARCH == "arm64": |
| 60 toolchain_source = "aarch64-linux-android-4.9" | 60 toolchain_source = "aarch64-linux-android-4.9" |
| 61 toolchain_prefix = "aarch64-linux-android" | 61 toolchain_prefix = "aarch64-linux-android" |
| 62 ndk = "ndk" | 62 ndk = "ndk" |
| 63 elif ARCH == "x86": | 63 elif ARCH == "x86": |
| 64 toolchain_source = "x86-4.6" | 64 toolchain_source = "x86-4.9" |
| 65 toolchain_prefix = "i686-android-linux" | 65 toolchain_prefix = "i686-linux-android" |
| 66 ndk = "ndk" | 66 ndk = "ndk" |
| 67 elif ARCH == "x86_64": | 67 elif ARCH == "x86_64": |
| 68 toolchain_source = "x86_64-4.9" | 68 toolchain_source = "x86_64-4.9" |
| 69 toolchain_prefix = "x86_64-linux-android" | 69 toolchain_prefix = "x86_64-linux-android" |
| 70 ndk = "ndk" | 70 ndk = "ndk" |
| 71 elif ARCH == "mips": | 71 elif ARCH == "mips": |
| 72 toolchain_source = "mipsel-linux-android-4.6" | 72 toolchain_source = "mipsel-linux-android-4.9" |
| 73 toolchain_prefix = "mipsel-linux-android" | 73 toolchain_prefix = "mipsel-linux-android" |
| 74 ndk = "ndk" | 74 ndk = "ndk" |
| 75 else: | 75 else: |
| 76 raise Exception("Could not find tool chain") | 76 raise Exception("Could not find tool chain") |
| 77 | 77 |
| 78 toolchain_subdir = ( | 78 toolchain_subdir = ( |
| 79 "third_party/android_tools/%s/toolchains/%s/prebuilt/linux-x86_64/bin" % | 79 "third_party/android_tools/%s/toolchains/%s/prebuilt/linux-x86_64/bin" % |
| 80 (ndk, toolchain_source)) | 80 (ndk, toolchain_source)) |
| 81 | 81 |
| 82 return os.path.join(CHROME_SRC, | 82 return os.path.join(CHROME_SRC, |
| 83 toolchain_subdir, | 83 toolchain_subdir, |
| 84 toolchain_prefix + "-" + tool) | 84 toolchain_prefix + "-" + tool) |
| 85 | 85 |
| 86 def FindToolchain(): | 86 def FindToolchain(): |
| 87 """Look for the latest available toolchain | 87 """Look for the latest available toolchain |
| 88 | 88 |
| 89 Args: | 89 Args: |
| 90 None | 90 None |
| 91 | 91 |
| 92 Returns: | 92 Returns: |
| 93 A pair of strings containing toolchain label and target prefix. | 93 A pair of strings containing toolchain label and target prefix. |
| 94 """ | 94 """ |
| 95 global TOOLCHAIN_INFO | 95 global TOOLCHAIN_INFO |
| 96 if TOOLCHAIN_INFO is not None: | 96 if TOOLCHAIN_INFO is not None: |
| 97 return TOOLCHAIN_INFO | 97 return TOOLCHAIN_INFO |
| 98 | 98 |
| 99 ## Known toolchains, newer ones in the front. | 99 ## Known toolchains, newer ones in the front. |
| 100 gcc_version = "4.9" |
| 100 if ARCH == "arm64": | 101 if ARCH == "arm64": |
| 101 gcc_version = "4.9" | |
| 102 known_toolchains = [ | 102 known_toolchains = [ |
| 103 ("aarch64-linux-android-" + gcc_version, "aarch64", "aarch64-linux-android
") | 103 ("aarch64-linux-android-" + gcc_version, "aarch64", "aarch64-linux-android
") |
| 104 ] | 104 ] |
| 105 elif ARCH == "arm": | 105 elif ARCH == "arm": |
| 106 gcc_version = "4.6" | |
| 107 known_toolchains = [ | 106 known_toolchains = [ |
| 108 ("arm-linux-androideabi-" + gcc_version, "arm", "arm-linux-androideabi"), | 107 ("arm-linux-androideabi-" + gcc_version, "arm", "arm-linux-androideabi") |
| 109 ] | 108 ] |
| 110 elif ARCH =="x86": | 109 elif ARCH =="x86": |
| 111 known_toolchains = [ | 110 known_toolchains = [ |
| 112 ("i686-android-linux-4.4.3", "x86", "i686-android-linux") | 111 ("x86-" + gcc_version, "x86", "i686-linux-android") |
| 113 ] | 112 ] |
| 114 elif ARCH =="x86_64": | 113 elif ARCH =="x86_64": |
| 115 known_toolchains = [ | 114 known_toolchains = [ |
| 116 ("x86_64-linux-android-4.9", "x86_64", "x86_64-linux-android") | 115 ("x86_64-" + gcc_version, "x86_64", "x86_64-linux-android") |
| 117 ] | 116 ] |
| 118 elif ARCH == "mips": | 117 elif ARCH == "mips": |
| 119 gcc_version = "4.6" | |
| 120 known_toolchains = [ | 118 known_toolchains = [ |
| 121 ("mipsel-linux-android-" + gcc_version, "mips", "mipsel-linux-android") | 119 ("mipsel-linux-android-" + gcc_version, "mips", "mipsel-linux-android") |
| 122 ] | 120 ] |
| 123 else: | 121 else: |
| 124 known_toolchains = [] | 122 known_toolchains = [] |
| 125 | 123 |
| 126 # Look for addr2line to check for valid toolchain path. | 124 # Look for addr2line to check for valid toolchain path. |
| 127 for (label, platform, target) in known_toolchains: | 125 for (label, platform, target) in known_toolchains: |
| 128 toolchain_info = (label, platform, target); | 126 toolchain_info = (label, platform, target); |
| 129 if os.path.exists(ToolPath("addr2line", toolchain_info)): | 127 if os.path.exists(ToolPath("addr2line", toolchain_info)): |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 process.stdin.write("\n") | 566 process.stdin.write("\n") |
| 569 process.stdin.close() | 567 process.stdin.close() |
| 570 demangled_symbol = process.stdout.readline().strip() | 568 demangled_symbol = process.stdout.readline().strip() |
| 571 process.stdout.close() | 569 process.stdout.close() |
| 572 return demangled_symbol | 570 return demangled_symbol |
| 573 | 571 |
| 574 def FormatSymbolWithOffset(symbol, offset): | 572 def FormatSymbolWithOffset(symbol, offset): |
| 575 if offset == 0: | 573 if offset == 0: |
| 576 return symbol | 574 return symbol |
| 577 return "%s+%d" % (symbol, offset) | 575 return "%s+%d" % (symbol, offset) |
| OLD | NEW |