summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2018-10-09 17:04:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-10-09 17:04:08 +0000
commit076bd27d03f5557b1fbd2bfb21e5384d4cf8b0aa (patch)
tree5d098929bf6c50a7bdbb478ca12d4fb7b62e0824 /scripts
parentc5e05f9d7b1c5ca1f9214daeff5dc97e668c0dad (diff)
parent7e73f7a7b43bc2548909feecdcb8671502fc8f54 (diff)
downloadandroid_development-076bd27d03f5557b1fbd2bfb21e5384d4cf8b0aa.tar.gz
android_development-076bd27d03f5557b1fbd2bfb21e5384d4cf8b0aa.tar.bz2
android_development-076bd27d03f5557b1fbd2bfb21e5384d4cf8b0aa.zip
Merge "Prevent "index out of range" crash when addr2line aborts in between"
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/native_heapdump_viewer.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/native_heapdump_viewer.py b/scripts/native_heapdump_viewer.py
index 05df0a6bc..e888e8f42 100755
--- a/scripts/native_heapdump_viewer.py
+++ b/scripts/native_heapdump_viewer.py
@@ -16,6 +16,7 @@
"""Generates a human-interpretable view of a native heap dump from 'am dumpheap -n'."""
+import logging
import os
import os.path
import re
@@ -320,11 +321,18 @@ def ResolveAddrs(html_output, symboldir, app_symboldir, backtraces, mappings):
p = subprocess.Popen(["addr2line", "-C", "-j", ".text", "-e", sofile, "-f"], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
result = p.communicate(input_addrs)[0]
+ addr2line_rc = p.returncode
+ if addr2line_rc and (addr2line_rc < 0):
+ logging.warn("addr2line on " + sofile + " terminated by signal " + str(-1 * addr2line_rc))
splitted = result.split("\n")
for x in range(0, len(addrs_by_lib[lib])):
- function = splitted[2*x];
- location = splitted[2*x+1];
- resolved_addrs[addrs_by_lib[lib][x]] = FrameDescription(function, location, lib)
+ try:
+ function = splitted[2*x];
+ location = splitted[2*x+1];
+ resolved_addrs[addrs_by_lib[lib][x]] = FrameDescription(function, location, lib)
+ except Exception:
+ logging.warn("exception while resolving symbols", exc_info=True)
+ resolved_addrs[addrs_by_lib[lib][x]] = FrameDescription("---", "---", lib)
else:
if html_output == False:
print "%s not found for symbol resolution" % lib