def get_info_from_core(path):
 full_exe_path = None
 output = commands.getoutput(('gdb -c %s batch' % path))
 path_pattern = re.compile("Core was generated by `([^\x00]+)'", re.IGNORECASE)
 match = re.findall(path_pattern, output)
 for m in match:
  m = m.split(' ')[0]
  if os.path.isfile(m):
   full_exe_path = m
   break
 if (full_exe_path is None):
  syslog.syslog(('Could not determine from which application core file %s is from' % path))
 return {'full_exe_path': full_exe_path}

def get_info_from_core ( path ) : full_exe_path = None output = commands . getoutput ( ( 'gdb -c %s batch' % path ) ) path_pattern = re . compile ( "Core was generated by `([^\x00]+)'" , re . IGNORECASE ) match = re . findall ( path_pattern , output ) for m in match : m = m . split ( ' ' ) [ 0 ] if os . path . isfile ( m ) : full_exe_path = m break if ( full_exe_path is None ) : syslog . syslog ( ( 'Could not determine from which application core file %s is from' % path ) ) return { 'full_exe_path' : full_exe_path }
reads a core file and extracts a dictionary with useful core information .