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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 | 445 |
446 If the function has been inlined then the list may contain | 446 If the function has been inlined then the list may contain |
447 more than one element with the symbols for the most deeply | 447 more than one element with the symbols for the most deeply |
448 nested inlined location appearing first. | 448 nested inlined location appearing first. |
449 """ | 449 """ |
450 if not lib: | 450 if not lib: |
451 return None | 451 return None |
452 | 452 |
453 | 453 |
454 symbols = SYMBOLS_DIR + lib | 454 symbols = SYMBOLS_DIR + lib |
455 if not os.path.splitext(symbols) in ['', '.so', '.apk']: | |
Primiano Tucci (use gerrit)
2015/06/10 17:37:19
Hmm I think you want [1] here, this is going to sk
Bernhard Bauer
2015/06/10 17:40:03
Durrr. Indeed! Done.
| |
456 return None | |
457 | |
455 if not os.path.isfile(symbols): | 458 if not os.path.isfile(symbols): |
456 return None | 459 return None |
457 | 460 |
458 (label, platform, target) = FindToolchain() | 461 (label, platform, target) = FindToolchain() |
459 cmd = [ToolPath("addr2line"), "--functions", "--inlines", | 462 cmd = [ToolPath("addr2line"), "--functions", "--inlines", |
460 "--demangle", "--exe=" + symbols] | 463 "--demangle", "--exe=" + symbols] |
461 child = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) | 464 child = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
462 | 465 |
463 result = {} | 466 result = {} |
464 addrs = sorted(unique_addrs) | 467 addrs = sorted(unique_addrs) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 process.stdin.write("\n") | 595 process.stdin.write("\n") |
593 process.stdin.close() | 596 process.stdin.close() |
594 demangled_symbol = process.stdout.readline().strip() | 597 demangled_symbol = process.stdout.readline().strip() |
595 process.stdout.close() | 598 process.stdout.close() |
596 return demangled_symbol | 599 return demangled_symbol |
597 | 600 |
598 def FormatSymbolWithOffset(symbol, offset): | 601 def FormatSymbolWithOffset(symbol, offset): |
599 if offset == 0: | 602 if offset == 0: |
600 return symbol | 603 return symbol |
601 return "%s+%d" % (symbol, offset) | 604 return "%s+%d" % (symbol, offset) |
OLD | NEW |