def _get_debug_output_after_crash(output_filename, base_path):
    """
    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.
    @param output_filename name of log file with tool output
    @param base_path string that needs to be preprended to paths for lookup of files
    """
    logging.debug("Analysing output for crash info.")
    foundDumpFile = False
    try:
        with open(output_filename, 'r+') as outputFile:
            for line in outputFile:
                if foundDumpFile:
                    dumpFileName = base_path + line.strip(' #\n')
                    outputFile.seek(0, os.SEEK_END) # jump to end of log file
                    try:
                        with open(dumpFileName, 'r') as dumpFile:
                            util.copy_all_lines_from_to(dumpFile, outputFile)
                        os.remove(dumpFileName)
                    except IOError as e:
                        logging.warning('Could not append additional segmentation fault information '
                                        'from %s (%s)',
                                        dumpFileName, 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
    except IOError as e:
        logging.warning('Could not analyze tool output for crash information (%s)', e.strerror)
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.
    @param output_filename name of log file with tool output
    @param base_path string that needs to be preprended to paths for lookup of files