tools/linux/dump-static-initializers.py
def ExtractSymbolReferences(toolchain, binary, start, end, symbol):
  """Given a span of addresses, returns symbol references from disassembly."""
  cmd = [toolchain + 'objdump', binary, '--disassemble',
         '--start-address=0x%x' % start, '--stop-address=0x%x' % end]
  objdump = subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             universal_newlines=True)

  refs = set()
  for line in objdump.stdout:
    if '__static_initialization_and_destruction' in line:
      raise RuntimeError('code mentions '
                         '__static_initialization_and_destruction; '
                         'did you accidentally run this on a Debug binary?')
    match = disassembly_re.search(line)
    if match:
      (ref,) = match.groups()
      if ref.startswith('.LC') or ref.startswith('_DYNAMIC'):
        # Ignore these, they are uninformative.
        continue
      if re.match(symbol, ref):
        # Probably a relative jump within this function.
        continue
      refs.add(ref)

  return sorted(refs)
Given a span of addresses, returns symbol references from disassembly.
Given a span of addresses, returns symbol references from disassembly.
Given a span of addresses returns symbol references from disassembly .
def ExtractSymbolReferences(toolchain, binary, start, end, symbol):
  cmd = [toolchain + 'objdump', binary, '--disassemble',
         '--start-address=0x%x' % start, '--stop-address=0x%x' % end]
  objdump = subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             universal_newlines=True)
  refs = set()
  for line in objdump.stdout:
    if '__static_initialization_and_destruction' in line:
      raise RuntimeError('code mentions '
                         '__static_initialization_and_destruction; '
                         'did you accidentally run this on a Debug binary?')
    match = disassembly_re.search(line)
    if match:
      (ref,) = match.groups()
      if ref.startswith('.LC') or ref.startswith('_DYNAMIC'):
        continue
      if re.match(symbol, ref):
        continue
      refs.add(ref)
  return sorted(refs)
def ExtractSymbolReferences ( toolchain , binary , start , end , symbol ) : cmd = [ toolchain + 'objdump' , binary , '--disassemble' , '--start-address=0x%x' % start , '--stop-address=0x%x' % end ] objdump = subprocess . Popen ( cmd , stdout = subprocess . PIPE , universal_newlines = True ) refs = set ( ) for line in objdump . stdout : if '__static_initialization_and_destruction' in line : raise RuntimeError ( 'code mentions ' '__static_initialization_and_destruction; ' 'did you accidentally run this on a Debug binary?' ) match = disassembly_re . search ( line ) if match : ( ref , ) = match . groups ( ) if ref . startswith ( '.LC' ) or ref . startswith ( '_DYNAMIC' ) : continue if re . match ( symbol , ref ) : continue refs . add ( ref ) return sorted ( refs )
Given a span of addresses, returns symbol references from disassembly.
Given a span of addresses returns symbol references from disassembly .
"""Given a span of addresses, returns symbol references from disassembly.""" # Ignore these, they are uninformative. # Probably a relative jump within this function.
toolchain
binary
start
end
symbol