def save_compiled_funcs (fname): out = open (fname, 'w') for (f, func) in functions.iteritems (): trace ('Saving %s' % f) for s in func.serialise (): out.write (s + '\n') out.close ()
def aligned_address_sanity (functions, symbols, radix): for (f, func) in functions.iteritems (): if f not in symbols: # happens for static or invented functions sometimes continue if func.entry: addr = first_aligned_address (func.nodes, radix) if addr == None: printout ('Warning: %s: no aligned instructions' % f) continue addr2 = symbols[f][0] if addr != addr2: printout ('target mismatch on func %s' % f) printout (' (starts at 0x%x not 0x%x)' % (addr, addr2)) return False addr3 = entry_aligned_address (func, radix) if addr3 != addr2: printout ('entry mismatch on func %s' % f) printout (' (enters at 0x%x not 0x%x)' % (addr3, addr2)) return False return True