def parse_dsymutil(data, module):
 sys_map = {}
 sys_map[module] = {}
 want_lower = ['_IdlePML4']
 type_map = {}
 type_map[module] = {}
 arch = ''
 for line in data.splitlines():
  ents = line.split()
  match = re.search("\\[.*?\\(([^\\)]+)\\)\\s+[0-9A-Fa-z]+\\s+\\d+\\s+([0-9A-Fa-f]+)\\s'(\\w+)'", line)
  if match:
   (sym_type, addr, name) = match.groups()
   sym_type = sym_type.strip()
   addr = int(addr, 16)
   if ((addr == 0) or (name == '')):
    continue
   if (not (name in sys_map[module])):
    sys_map[module][name] = [(addr, sym_type)]
   oldaddr = sys_map[module][name][0][0]
   if ((addr < oldaddr) and (name in want_lower)):
    sys_map[module][name] = [(addr, sym_type)]
   if (not (addr in type_map[module])):
    type_map[module][addr] = (name, [sym_type])
   type_map[module][addr][1].append(sym_type)
  elif (line.find('Symbol table for') != (-1)):
   if (line.find('i386') != (-1)):
    arch = '32bit'
   else:
    arch = '64bit'
 if (arch == ''):
  return None
 return (arch, sys_map, type_map)

def parse_dsymutil ( data , module ) : sys_map = { } sys_map [ module ] = { } want_lower = [ '_IdlePML4' ] type_map = { } type_map [ module ] = { } arch = '' for line in data . splitlines ( ) : ents = line . split ( ) match = re . search ( "\\[.*?\\(([^\\)]+)\\)\\s+[0-9A-Fa-z]+\\s+\\d+\\s+([0-9A-Fa-f]+)\\s'(\\w+)'" , line ) if match : ( sym_type , addr , name ) = match . groups ( ) sym_type = sym_type . strip ( ) addr = int ( addr , 16 ) if ( ( addr == 0 ) or ( name == '' ) ) : continue if ( not ( name in sys_map [ module ] ) ) : sys_map [ module ] [ name ] = [ ( addr , sym_type ) ] oldaddr = sys_map [ module ] [ name ] [ 0 ] [ 0 ] if ( ( addr < oldaddr ) and ( name in want_lower ) ) : sys_map [ module ] [ name ] = [ ( addr , sym_type ) ] if ( not ( addr in type_map [ module ] ) ) : type_map [ module ] [ addr ] = ( name , [ sym_type ] ) type_map [ module ] [ addr ] [ 1 ] . append ( sym_type ) elif ( line . find ( 'Symbol table for' ) != ( - 1 ) ) : if ( line . find ( 'i386' ) != ( - 1 ) ) : arch = '32bit' else : arch = '64bit' if ( arch == '' ) : return None return ( arch , sys_map , type_map )
parse the symbol file .