def read_resop_meta(ctx, trace, fileobj): assert len(ctx.forest.resops) == 0 count = read_le_u16(fileobj) for i in range(count): opnum = read_le_u16(fileobj) opname = read_string(fileobj, True) ctx.forest.resops[opnum] = opname
def read_source_code(ctx, trace, fileobj): filename = read_string(fileobj, True) count = read_le_u16(fileobj) for i in range(count): lineno = read_le_u16(fileobj) indent = read_byte(fileobj) text = read_string(fileobj, True) ctx.forest.add_source_code_line(filename, lineno, indent, text)
def read_init_merge_point(ctx, trace, fileobj): count = read_le_u16(fileobj) types = [] for i in range(count): sem_type = read_byte(fileobj) gen_type = read_char(fileobj) d = merge_point.get_decoder(sem_type, gen_type, ctx.forest.version) types.append(d) stage = trace.get_last_stage() assert stage is not None, "last stage is none, but it must not be none!" stage.merge_point_types = types
def read_resop(ctx, trace, fileobj): assert trace is not None opnum = read_le_u16(fileobj) args = read_string(fileobj, True).split(',') failargs = None if 2 <= ctx.forest.version: failargs = read_string(fileobj, True).split(',') result = args[0] args = args[1:] assert opnum in ctx.forest.resops, "opnum is not known: " + str(opnum) + \ " at binary pos " + str(hex(fileobj.tell())) opname = ctx.forest.resops[opnum] op = FlatOp(opnum, opname, args, result, None, -1, failargs=failargs) trace.add_instr(op)
def read_resop(ctx, trace, fileobj): assert trace is not None opnum = read_le_u16(fileobj) args = read_string(fileobj, True).split(",") failargs = None if 2 <= ctx.forest.version: failargs = read_string(fileobj, True).split(",") result = args[0] args = args[1:] assert opnum in ctx.forest.resops, ( "opnum is not known: " + str(opnum) + " at binary pos " + str(hex(fileobj.tell())) ) opname = ctx.forest.resops[opnum] op = FlatOp(opnum, opname, args, result, None, -1, failargs=failargs) trace.add_instr(op)
def read_asm(ctx, trace, fileobj): assert trace is not None, "read asm, no trace obj is provided" rel_pos = read_le_u16(fileobj) dump = read_bytes(fileobj) trace.set_core_dump_to_last_op(rel_pos, dump)