Exemplo n.º 1
0
def _DemangleNames(names, tool_prefix):
  """Uses c++filt to demangle a list of names."""
  proc = subprocess.Popen([path_util.GetCppFiltPath(tool_prefix)],
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  stdout = proc.communicate('\n'.join(names))[0]
  assert proc.returncode == 0
  ret = [StripLlvmPromotedGlobalNames(line) for line in stdout.splitlines()]
  if logging.getLogger().isEnabledFor(logging.INFO):
    fail_count = sum(1 for s in ret if s.startswith('_Z'))
    if fail_count:
      logging.info('* Failed to demangle %d/%d items', fail_count, len(ret))
  return ret
Exemplo n.º 2
0
def _UnmangleRemainingSymbols(raw_symbols, tool_prefix):
  """Uses c++filt to unmangle any symbols that need it."""
  to_process = [s for s in raw_symbols if s.full_name.startswith('_Z')]
  if not to_process:
    return

  logging.info('Unmangling %d names', len(to_process))
  proc = subprocess.Popen([path_util.GetCppFiltPath(tool_prefix)],
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  stdout = proc.communicate('\n'.join(s.full_name for s in to_process))[0]
  assert proc.returncode == 0

  for i, line in enumerate(stdout.splitlines()):
    to_process[i].full_name = line
Exemplo n.º 3
0
def _DemangleNames(names, tool_prefix):
  """Uses c++filt to demangle a list of names."""
  proc = subprocess.Popen([path_util.GetCppFiltPath(tool_prefix)],
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  stdout = proc.communicate('\n'.join(_ExtractDemanglablePart(names)))[0]
  assert proc.returncode == 0
  ret = [
      _PostProcessDemangledSymbol(old_name, new_name)
      for (old_name, new_name) in itertools.izip(names, stdout.splitlines())
  ]
  if logging.getLogger().isEnabledFor(logging.INFO):
    fail_count = sum(1 for s in ret if _CanDemangle(s))
    if fail_count:
      logging.info('* Failed to demangle %d/%d items', fail_count, len(ret))
  return ret