Merge "Handle IOExceptions if addr2line fails." am: 9a192cd10b

am: 636042a889

Change-Id: I5f33b16bed433d2654fa447635ea0e25fb27d273
This commit is contained in:
Christopher Ferris
2018-08-10 17:28:17 -07:00
committed by android-build-merger

View File

@@ -297,26 +297,30 @@ def CallAddr2LineForSet(lib, unique_addrs):
child = _PIPE_ADDR2LINE_CACHE.GetProcess(cmd) child = _PIPE_ADDR2LINE_CACHE.GetProcess(cmd)
for addr in addrs: for addr in addrs:
child.stdin.write("0x%s\n" % addr) try:
child.stdin.flush() child.stdin.write("0x%s\n" % addr)
records = [] child.stdin.flush()
first = True records = []
while True: first = True
symbol = child.stdout.readline().strip() while True:
if symbol == "??": symbol = child.stdout.readline().strip()
symbol = None if symbol == "??":
location = child.stdout.readline().strip() symbol = None
if location == "??:0" or location == "??:?": location = child.stdout.readline().strip()
location = None if location == "??:0" or location == "??:?":
if symbol is None and location is None: location = None
break if symbol is None and location is None:
records.append((symbol, location)) break
if first: records.append((symbol, location))
# Write a blank line as a sentinel so we know when to stop if first:
# reading inlines from the output. # Write a blank line as a sentinel so we know when to stop
# The blank line will cause addr2line to emit "??\n??:0\n". # reading inlines from the output.
child.stdin.write("\n") # The blank line will cause addr2line to emit "??\n??:0\n".
first = False child.stdin.write("\n")
first = False
except IOError as e:
# Remove the / in front of the library name to match other output.
records = [(None, lib[1:] + " ***Error: " + str(e))]
result[addr] = records result[addr] = records
addr_cache[addr] = records addr_cache[addr] = records
return result return result