def parse_dwarf(infile, cuname): if not os.path.isfile(infile): error("No such file %s" % infile) exit(1) dwarf = DWARF(infile) # Keep track of what has been written to the syntax tree # Indexed by (tag,name) # Instead of using this, it may be better to just collect and # to dedup later, so that we can check that there are no name conflicts. written = defaultdict(int) if cuname: # TODO: handle multiple specific compilation units cu = None for i, c in enumerate(dwarf.info.cus): if c.name.endswith(cuname[0]): cu = c break if cu is None: print("Can't find compilation unit %s" % cuname, file=sys.stderr) statements = process_compile_unit(dwarf, cu, written) else: statements = [] for cu in dwarf.info.cus: progress("Processing %s" % cu.name) statements.extend(process_compile_unit(dwarf, cu, written)) return statements
def parse_dwarf(infile, root): if not os.path.isfile(infile): error("No such file %s" % infile) exit(1) dwarf = DWARF(infile) for cu in dwarf.info.cus: progress("Processing %s" % cu.name) types = process_compile_unit(dwarf, cu, root) if types: return types
def parse_dwarf(infile, roots): if not os.path.isfile(infile): error("No such file %s" % infile) exit(1) dwarf = DWARF(infile) for cu in dwarf.info.cus: progress("Processing %s" % cu.name) types = process_compile_unit(dwarf, cu, roots) if all(x in types for x in roots): # return if all roots found return types return None # not found