third_party/android_platform/development/scripts/symbol.py
def _CallAddr2LineForSet(lib, unique_addrs, cpu_arch):
  """Look up line and symbol information for a set of addresses.

  Args:
    lib: library (or executable) pathname containing symbols
    unique_addrs: set of string hexidecimal addresses look up.
    cpu_arch: Target CPU architecture.

  Returns:
    A dictionary of the form {addr: [(symbol, file:line)]} where
    each address has a list of associated symbols and locations
    or an empty list if no symbol information was found.

    If the function has been inlined then the list may contain
    more than one element with the symbols for the most deeply
    nested inlined location appearing first.
  """
  if not lib:
    return None

  symbols = SYMBOLS_DIR + lib
  if not os.path.splitext(symbols)[1] in ['', '.so', '.apk']:
    return None

  if not os.path.isfile(symbols):
    return None

  addrs = sorted(unique_addrs)
  result = {}

  def _Callback(sym, addr):
    records = []
    while sym:  # Traverse all the inlines following the |inlined_by| chain.
      if sym.source_path and sym.source_line:
        location = '%s:%d' % (sym.source_path, sym.source_line)
      else:
        location = None
      records += [(sym.name, location)]
      sym = sym.inlined_by
    result[addr] = records

  symbolizer = elf_symbolizer.ELFSymbolizer(
      elf_file_path=symbols,
      addr2line_path=host_paths.ToolPath("addr2line", cpu_arch),
      callback=_Callback,
      inlines=True)

  for addr in addrs:
    symbolizer.SymbolizeAsync(int(addr, 16), addr)
  symbolizer.Join()
  return result
Look up line and symbol information for a set of addresses.

  Args:
    lib: library (or executable) pathname containing symbols
    unique_addrs: set of string hexidecimal addresses look up.
    cpu_arch: Target CPU architecture.

  Returns:
    A dictionary of the form {addr: [(symbol, file:line)]} where
    each address has a list of associated symbols and locations
    or an empty list if no symbol information was found.

    If the function has been inlined then the list may contain
    more than one element with the symbols for the most deeply
    nested inlined location appearing first.
  
Look up line and symbol information for a set of addresses.
Look up line and symbol information for a set of addresses .
def _CallAddr2LineForSet(lib, unique_addrs, cpu_arch):
  if not lib:
    return None
  symbols = SYMBOLS_DIR + lib
  if not os.path.splitext(symbols)[1] in ['', '.so', '.apk']:
    return None
  if not os.path.isfile(symbols):
    return None
  addrs = sorted(unique_addrs)
  result = {}
  def _Callback(sym, addr):
    records = []
    while sym:  
      if sym.source_path and sym.source_line:
        location = '%s:%d' % (sym.source_path, sym.source_line)
      else:
        location = None
      records += [(sym.name, location)]
      sym = sym.inlined_by
    result[addr] = records
  symbolizer = elf_symbolizer.ELFSymbolizer(
      elf_file_path=symbols,
      addr2line_path=host_paths.ToolPath("addr2line", cpu_arch),
      callback=_Callback,
      inlines=True)
  for addr in addrs:
    symbolizer.SymbolizeAsync(int(addr, 16), addr)
  symbolizer.Join()
  return result
def _CallAddr2LineForSet ( lib , unique_addrs , cpu_arch ) : if not lib : return None symbols = SYMBOLS_DIR + lib if not os . path . splitext ( symbols ) [ 1 ] in [ '' , '.so' , '.apk' ] : return None if not os . path . isfile ( symbols ) : return None addrs = sorted ( unique_addrs ) result = { } def _Callback ( sym , addr ) : records = [ ] while sym : if sym . source_path and sym . source_line : location = '%s:%d' % ( sym . source_path , sym . source_line ) else : location = None records += [ ( sym . name , location ) ] sym = sym . inlined_by result [ addr ] = records symbolizer = elf_symbolizer . ELFSymbolizer ( elf_file_path = symbols , addr2line_path = host_paths . ToolPath ( "addr2line" , cpu_arch ) , callback = _Callback , inlines = True ) for addr in addrs : symbolizer . SymbolizeAsync ( int ( addr , 16 ) , addr ) symbolizer . Join ( ) return result
Look up line and symbol information for a set of addresses.
Look up line and symbol information for a set of addresses .
"""Look up line and symbol information for a set of addresses.

  Args:
    lib: library (or executable) pathname containing symbols
    unique_addrs: set of string hexidecimal addresses look up.
    cpu_arch: Target CPU architecture.

  Returns:
    A dictionary of the form {addr: [(symbol, file:line)]} where
    each address has a list of associated symbols and locations
    or an empty list if no symbol information was found.

    If the function has been inlined then the list may contain
    more than one element with the symbols for the most deeply
    nested inlined location appearing first.
  """ # Traverse all the inlines following the |inlined_by| chain.
A dictionary of the form {addr: [(symbol, file:line)]} where
each address has a list of associated symbols and locations
or an empty list if no symbol information was found.

If the function has been inlined then the list may contain
more than one element with the symbols for the most deeply
nested inlined location appearing first.
A dictionary of the form { addr : [ ( symbol file : line ) ] } where each address has a list of associated symbols and locations or an empty list if no symbol information was found . If the function has been inlined then the list may contain more than one element with the symbols for the most deeply nested inlined location appearing first .
lib
library (or executable) pathname containing symbols
library ( or executable ) pathname containing symbols
unique_addrs
set of string hexidecimal addresses look up.
set of string hexidecimal addresses look up .
cpu_arch
Target CPU architecture.
Target CPU architecture .