Exemplo n.º 1
0
def _ExtractSizesFromDexFile(dex_path):
    counts = {}
    for line in dexdump.DexDump(dex_path, file_summary=True):
        if not line.strip():
            return counts
        m = re.match(r'([a-z_]+_size) *: (\d+)', line)
        if m:
            counts[m.group(1)] = int(m.group(2))
    raise Exception('Unexpected end of output.')
Exemplo n.º 2
0
def _ExtractSizesFromDexFile(dex_path):
  counts = {}
  for line in dexdump.DexDump(dex_path, file_summary=True):
    if not line.strip():
      # Each method, type, field, and string contributes 4 bytes (1 reference)
      # to our DexCache size.
      return counts, sum(counts[x] for x in CONTRIBUTORS_TO_DEX_CACHE) * 4
    m = re.match(r'([a-z_]+_size) *: (\d+)', line)
    if m and m.group(1) in CONTRIBUTORS_TO_DEX_CACHE:
      counts[m.group(1)] = int(m.group(2))
  raise Exception('Unexpected end of output.')
Exemplo n.º 3
0
def SingleMethodCount(dexfile):
    for line in dexdump.DexDump(dexfile, file_summary=True):
        m = _METHOD_IDS_SIZE_RE.match(line)
        if m:
            return m.group(1)
    raise Exception('"method_ids_size" not found in dex dump of %s' % dexfile)