Index: lib/asan/scripts/asan_symbolize.py =================================================================== --- lib/asan/scripts/asan_symbolize.py +++ lib/asan/scripts/asan_symbolize.py @@ -134,34 +134,38 @@ def __init__(self, binary): super(Addr2LineSymbolizer, self).__init__() self.binary = binary - self.pipe = self.open_addr2line() - def open_addr2line(self): + def open_addr2line(self, offset): addr2line_tool = 'addr2line' if binutils_prefix: addr2line_tool = binutils_prefix + addr2line_tool - cmd = [addr2line_tool, '-f'] + cmd = [addr2line_tool, '-fi'] if demangle: cmd += ['--demangle'] cmd += ['-e', self.binary] + cmd += [offset] if DEBUG: print ' '.join(cmd) - return subprocess.Popen(cmd, - stdin=subprocess.PIPE, stdout=subprocess.PIPE) + return subprocess.Popen(cmd, stdout=subprocess.PIPE) def symbolize(self, addr, binary, offset): """Overrides Symbolizer.symbolize.""" if self.binary != binary: return None + self.pipe = self.open_addr2line(offset) + result = [] try: - print >> self.pipe.stdin, offset - function_name = self.pipe.stdout.readline().rstrip() - file_name = self.pipe.stdout.readline().rstrip() + lines = self.pipe.stdout.readlines() except Exception: - function_name = '' - file_name = '' - file_name = fix_filename(file_name) - return ['%s in %s %s' % (addr, function_name, file_name)] + lines = [] + if not lines: + lines.append('??') + lines.append('??:?') + for i in range(0, len(lines), 2): + function_name = lines[i].rstrip() + file_name = fix_filename(lines[i + 1].rstrip()) + result.append('%s in %s %s' % (addr, function_name, file_name)) + return result class UnbufferedLineConverter(object):