forked from OSchip/llvm-project
[asan_symbolize] Fix broken pipe handling for python 2.7
I D65322 I added a check for BrokenPipeError. However, python 2.7 doesn't have BrokenPipeError. To be python 2.7 and 3 compatible we need to catch IOError instead and check for errno == errno.EPIPE. llvm-svn: 370025
This commit is contained in:
parent
09fcec7c0a
commit
677c6ddd33
|
@ -21,6 +21,7 @@ script itself.
|
|||
"""
|
||||
import argparse
|
||||
import bisect
|
||||
import errno
|
||||
import getopt
|
||||
import logging
|
||||
import os
|
||||
|
@ -202,9 +203,14 @@ class Addr2LineSymbolizer(Symbolizer):
|
|||
logging.debug("got empty function and file name -> unknown function")
|
||||
function_name = '??'
|
||||
file_name = '??:0'
|
||||
lines.append((function_name, file_name));
|
||||
except BrokenPipeError:
|
||||
logging.debug("got broken pipe, addr2line returncode=%d" % self.pipe.poll())
|
||||
lines.append((function_name, file_name))
|
||||
except IOError as e:
|
||||
# EPIPE happens if addr2line exits early (which some implementations do
|
||||
# if an invalid file is passed).
|
||||
if e.errno == errno.EPIPE:
|
||||
logging.debug("addr2line exited early (broken pipe), returncode=%d" % self.pipe.poll())
|
||||
else:
|
||||
logging.debug("unexpected I/O exception communicating with addr2line", exc_info=e)
|
||||
lines.append(('??', '??:0'))
|
||||
except Exception as e:
|
||||
logging.debug("got unknown exception communicating with addr2line", exc_info=e)
|
||||
|
|
Loading…
Reference in New Issue