| OLD | NEW |
| 1 # Copyright (C) 2013 The Android Open Source Project | 1 # Copyright (C) 2013 The Android Open Source Project |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and | 12 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. | 13 # limitations under the License. |
| 14 | 14 |
| 15 """Module for looking up symbolic debugging information. | 15 """Module for looking up symbolic debugging information. |
| 16 | 16 |
| 17 The information can include symbol names, offsets, and source locations. | 17 The information can include symbol names, offsets, and source locations. |
| 18 """ | 18 """ |
| 19 | 19 |
| 20 import glob | 20 import glob |
| 21 import itertools | 21 import itertools |
| 22 import os | 22 import os |
| 23 import re | 23 import re |
| 24 import subprocess | 24 import subprocess |
| 25 import zipfile | 25 import zipfile |
| 26 | 26 |
| 27 NDK_DIR = "" | 27 NDK_DIR = "" |
| 28 BUILD_DIR = "" | 28 BUILD_DIRS = [] |
| 29 SYMBOLS_DIR = "" | 29 SYMBOLS_DIR = "" |
| 30 | 30 |
| 31 ARCH = "arm" | 31 ARCH = "arm" |
| 32 | 32 |
| 33 TOOLCHAIN_INFO = None | 33 TOOLCHAIN_INFO = None |
| 34 | 34 |
| 35 def Uname(): | 35 def Uname(): |
| 36 """'uname' for constructing prebuilt/<...> and out/host/<...> paths.""" | 36 """'uname' for constructing prebuilt/<...> and out/host/<...> paths.""" |
| 37 uname = os.uname()[0] | 37 uname = os.uname()[0] |
| 38 proc = os.uname()[-1] | 38 proc = os.uname()[-1] |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 """Returns a list of candidate filenames. | 183 """Returns a list of candidate filenames. |
| 184 | 184 |
| 185 Args: | 185 Args: |
| 186 filepart: the file part of the pathname. | 186 filepart: the file part of the pathname. |
| 187 candidate_fun: a function to apply to each candidate, returns a list. | 187 candidate_fun: a function to apply to each candidate, returns a list. |
| 188 relative_dirs: a list of relative directory names to search from. | 188 relative_dirs: a list of relative directory names to search from. |
| 189 | 189 |
| 190 Returns: | 190 Returns: |
| 191 A list of candidate files ordered by modification time, newest first. | 191 A list of candidate files ordered by modification time, newest first. |
| 192 """ | 192 """ |
| 193 candidates = [BUILD_DIR] | 193 candidates = list(BUILD_DIRS) |
| 194 | 194 |
| 195 if relative_dirs: | 195 if relative_dirs: |
| 196 candidates = PathListJoin(candidates, relative_dirs) | 196 candidates = PathListJoin(candidates, relative_dirs) |
| 197 | 197 |
| 198 candidates = PathListJoin(candidates, [filepart]) | 198 candidates = PathListJoin(candidates, [filepart]) |
| 199 candidates = list( | 199 candidates = list( |
| 200 itertools.chain.from_iterable(map(candidate_fun, candidates))) | 200 itertools.chain.from_iterable(map(candidate_fun, candidates))) |
| 201 candidates = sorted(candidates, key=os.path.getmtime, reverse=True) | 201 candidates = sorted(candidates, key=os.path.getmtime, reverse=True) |
| 202 return candidates | 202 return candidates |
| 203 | 203 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 process.stdin.write("\n") | 554 process.stdin.write("\n") |
| 555 process.stdin.close() | 555 process.stdin.close() |
| 556 demangled_symbol = process.stdout.readline().strip() | 556 demangled_symbol = process.stdout.readline().strip() |
| 557 process.stdout.close() | 557 process.stdout.close() |
| 558 return demangled_symbol | 558 return demangled_symbol |
| 559 | 559 |
| 560 def FormatSymbolWithOffset(symbol, offset): | 560 def FormatSymbolWithOffset(symbol, offset): |
| 561 if offset == 0: | 561 if offset == 0: |
| 562 return symbol | 562 return symbol |
| 563 return "%s+%d" % (symbol, offset) | 563 return "%s+%d" % (symbol, offset) |
| OLD | NEW |