'Configure the crash handler by:
* Setting up core size to unlimited
* Putting an appropriate crash handler on /proc/sys/kernel/core_pattern
* Create files that the crash handler will use to figure which tests
are active at a given moment
The crash handler will pick up the core file and write it to
self.debugdir, and perform analysis on it to generate a report. The
program also outputs some results to syslog.
If multiple tests are running, an attempt to verify if we still have
the old PID on the system process table to determine whether it is a
parent of the current test execution. If we can\'t determine it, the
core file and the report file will be copied to all test debug dirs.'

def configure_crash_handler(self):

    self.crash_handling_enabled = False
    cmd = "python    -c    'import    sys;    print    sys.version_info[0],    sys.version_info[1]'"
    result = utils.run(cmd, ignore_status=True, verbose=False)
    if (result.exit_status != 0):
        logging.warning('System    python    is    too    old,    crash    handling    disabled')
        return
    (major, minor) = [int(x) for x in result.stdout.strip().split()]
    if ((major, minor) < (2, 4)):
        logging.warning('System    python    is    too    old,    crash    handling    disabled')
        return
    if (not settings.settings.get_value('COMMON', 'crash_handling_enabled', type=bool)):
        return
    self.pattern_file = '/proc/sys/kernel/core_pattern'
    try:
        resource.setrlimit(resource.RLIMIT_CORE, ((-1), (-1)))
        self.core_pattern_backup = open(self.pattern_file, 'r').read()
        pattern_file = open(self.pattern_file, 'w')
        tools_dir = os.path.join(self.autodir, 'tools')
        crash_handler_path = os.path.join(tools_dir, 'crash_handler.py')
        pattern_file.write((('|' + crash_handler_path) + '    %p    %t    %u    %s    %h    %e'))
        self.debugdir_tmp_file = ('/tmp/autotest_results_dir.%s' % os.getpid())
        utils.open_write_close(self.debugdir_tmp_file, (self.debugdir + '\n'))
    except Exception as e:
        logging.warning('Crash    handling    disabled:    %s', e)
    else:
        self.crash_handling_enabled = True
        try:
            os_dep.command('gdb')
        except ValueError:
            logging.warning('Could    not    find    GDB    installed.    Crash    handling    will    operate    with    limited    functionality')
