def read_map(filename, base=0): global elf_data info = parse_elf.go(filename) elf_data[filename] = (base, info) ehdr, phdrs, shdrs, syms, core_info = info result = [] for phdr in phdrs: if phdr["type"] == "load": result.append((phdr["memsz"], base + phdr["vaddr"], phdr["offset"], phdr["filesz"])) result.sort() return result
def test (path): import parse_elf import sys global info info_iter = read (path, parse_elf.go (path)) if not info_iter: sys.stderr.write ('no debugging information present\n') else: for unit in info_iter: print '-' * 75 unit.dump (sys.stdout)