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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 raise Exception("Could not find tool chain") | 99 raise Exception("Could not find tool chain") |
100 | 100 |
101 def TranslateLibPath(lib): | 101 def TranslateLibPath(lib): |
102 # SymbolInformation(lib, addr) receives lib as the path from symbols | 102 # SymbolInformation(lib, addr) receives lib as the path from symbols |
103 # root to the symbols file. This needs to be translated to point to the | 103 # root to the symbols file. This needs to be translated to point to the |
104 # correct .so path. If the user doesn't explicitly specify which directory to | 104 # correct .so path. If the user doesn't explicitly specify which directory to |
105 # use, then use the most recently updated one in one of the known directories. | 105 # use, then use the most recently updated one in one of the known directories. |
106 # If the .so is not found somewhere in CHROME_SYMBOLS_DIR, leave it | 106 # If the .so is not found somewhere in CHROME_SYMBOLS_DIR, leave it |
107 # untranslated in case it is an Android symbol in SYMBOLS_DIR. | 107 # untranslated in case it is an Android symbol in SYMBOLS_DIR. |
108 library_name = os.path.basename(lib) | 108 library_name = os.path.basename(lib) |
| 109 out_dir = os.environ.get('CHROMIUM_OUT_DIR', 'out') |
109 candidate_dirs = ['.', | 110 candidate_dirs = ['.', |
110 'out/Debug/lib', | 111 os.path.join(out_dir, 'Debug', 'lib'), |
111 'out/Debug/lib.target', | 112 os.path.join(out_dir, 'Debug', 'lib.target'), |
112 'out/Release/lib', | 113 os.path.join(out_dir, 'Release', 'lib'), |
113 'out/Release/lib.target', | 114 os.path.join(out_dir, 'Release', 'lib.target'), |
114 ] | 115 ] |
115 | 116 |
116 candidate_libraries = map( | 117 candidate_libraries = map( |
117 lambda d: ('%s/%s/%s' % (CHROME_SYMBOLS_DIR, d, library_name)), | 118 lambda d: ('%s/%s/%s' % (CHROME_SYMBOLS_DIR, d, library_name)), |
118 candidate_dirs) | 119 candidate_dirs) |
119 candidate_libraries = filter(os.path.exists, candidate_libraries) | 120 candidate_libraries = filter(os.path.exists, candidate_libraries) |
120 candidate_libraries = sorted(candidate_libraries, | 121 candidate_libraries = sorted(candidate_libraries, |
121 key=os.path.getmtime, reverse=True) | 122 key=os.path.getmtime, reverse=True) |
122 | 123 |
123 if not candidate_libraries: | 124 if not candidate_libraries: |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 process.stdin.write("\n") | 382 process.stdin.write("\n") |
382 process.stdin.close() | 383 process.stdin.close() |
383 demangled_symbol = process.stdout.readline().strip() | 384 demangled_symbol = process.stdout.readline().strip() |
384 process.stdout.close() | 385 process.stdout.close() |
385 return demangled_symbol | 386 return demangled_symbol |
386 | 387 |
387 def FormatSymbolWithOffset(symbol, offset): | 388 def FormatSymbolWithOffset(symbol, offset): |
388 if offset == 0: | 389 if offset == 0: |
389 return symbol | 390 return symbol |
390 return "%s+%d" % (symbol, offset) | 391 return "%s+%d" % (symbol, offset) |
OLD | NEW |