def _get_debug_output_after_crash(output_filename):
    """
    Segmentation faults and some memory failures reference a file
    with more information (hs_err_pid_*). We append this file to the log.
    The format that we expect is a line
    "# An error report file with more information is saved as:"
    and the file name of the dump file on the next line.
    """
    logging.debug("Analysing output for crash info.")
    foundDumpFile = False
    with open(output_filename, 'r+') as outputFile:
        for line in outputFile:
            if foundDumpFile:
                try:
                    dumpFileName = line.strip(' #\n')
                    outputFile.seek(0, os.SEEK_END) # jump to end of log file
                    with open(dumpFileName, 'r') as dumpFile:
                        util.copy_all_lines_from_to(dumpFile, outputFile)
                    os.remove(dumpFileName)
                except __HOLE__ as e:
                    logging.warning('Could not append additional segmentation fault information '
                                    'from %s (%s)',
                                    dumpFile, e.strerror)
                break
            try:
                if util.decode_to_string(line).startswith('# An error report file with more information is saved as:'):
                    logging.debug('Going to append error report file')
                    foundDumpFile = True
            except UnicodeDecodeError:
                pass
                # ignore invalid chars from logfile
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/runexecutor.py/_get_debug_output_after_crash