Rename RAnalOp->code to RAnalOp->esil (Evaluable String Intermediate Language)

This commit is contained in:
pancake 2013-05-17 01:50:49 +02:00
parent 356640967b
commit 9f309aea25
5 changed files with 21 additions and 21 deletions

View File

@ -15,7 +15,7 @@ R_API RAnalOp *r_anal_op_new() {
op->fail = -1;
op->ref = -1;
op->value = -1;
op->code[0] = 0;
op->esil[0] = 0;
op->next = NULL;
}
return op;

View File

@ -18,7 +18,7 @@ static int mips_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) {
op->type = R_ANAL_OP_TYPE_UNK;
op->length = oplen;
op->delay = 4;
op->code[0] = 0;
op->esil[0] = 0;
//r_mem_copyendian ((ut8*)&opcode, b, 4, !anal->big_endian);
memcpy (&opcode, b, 4);
@ -140,13 +140,13 @@ static int mips_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) {
case 2: // j
op->type = R_ANAL_OP_TYPE_JMP;
op->jump = address;
sprintf (op->code, "pc=0x%08"PFMT64x, address);
sprintf (op->esil, "pc=0x%08"PFMT64x, address);
break;
case 3: // jal
op->type = R_ANAL_OP_TYPE_CALL;
op->jump = address;
op->fail = addr+8;
sprintf (op->code, "lr=pc+4,pc=0x%08"PFMT64x, address);
sprintf (op->esil, "lr=pc+4,pc=0x%08"PFMT64x, address);
break;
}
family = 'J';

View File

@ -140,67 +140,67 @@ int x86_udis86_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len)
op->ref = op->value = -1;
oplen = op->length = ud_insn_len (&u);
op->code[0] = 0;
op->esil[0] = 0;
if (anal->decode) {
switch (u.mnemonic) {
case UD_Ijz: // TODO: carry flag
getarg (src, &u, 0);
sprintf (op->code, "?zf,%s=%s", pc, src);
sprintf (op->esil, "?zf,%s=%s", pc, src);
break;
case UD_Ijnz: // TODO: carry flag
getarg (src, &u, 0);
sprintf (op->code, "?!zf,%s=%s", pc, src);
sprintf (op->esil, "?!zf,%s=%s", pc, src);
break;
case UD_Ijmp: // TODO: carry flag
getarg (src, &u, 0);
sprintf (op->code, "%s=%s", pc, src);
sprintf (op->esil, "%s=%s", pc, src);
break;
case UD_Icall: // TODO: carry flag
getarg (src, &u, 0);
sprintf (op->code, "%s-=%d,%d[%s]=%s,%s=%s",
sprintf (op->esil, "%s-=%d,%d[%s]=%s,%s=%s",
sp, regsz, regsz, sp, pc, pc, src);
break;
case UD_Ishl: // TODO: carry flag
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s<<=%s", src, dst);
sprintf (op->esil, "%s<<=%s", src, dst);
break;
case UD_Ishr: // TODO: carry flag
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s>>=%s", src, dst);
sprintf (op->esil, "%s>>=%s", src, dst);
break;
case UD_Iadd: // TODO: carry flag
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s+=%s", src, dst);
sprintf (op->esil, "%s+=%s", src, dst);
break;
case UD_Isub: // TODO: below flag
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s-=%s", src, dst);
sprintf (op->esil, "%s-=%s", src, dst);
break;
case UD_Iand:
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s&=%s", src, dst);
sprintf (op->esil, "%s&=%s", src, dst);
break;
case UD_Isyscall:
strcpy (op->code, "$");
strcpy (op->esil, "$");
break;
case UD_Iint:
n = getval (&u.operand[0]);
sprintf (op->code, "$0x%x,%s+=%d", n, pc, oplen);
sprintf (op->esil, "$0x%x,%s+=%d", n, pc, oplen);
break;
case UD_Ilea:
case UD_Imov:
getarg (src, &u, 0);
getarg (dst, &u, 1);
sprintf (op->code, "%s=%s,%s+=%d", src, dst, pc, oplen);
sprintf (op->esil, "%s=%s,%s+=%d", src, dst, pc, oplen);
break;
case UD_Ipush:
getarg (str, &u, 0);
sprintf (op->code, "%s-=%d,%d[%s]=%s,%s+=%d",
sprintf (op->esil, "%s-=%d,%d[%s]=%s,%s+=%d",
sp, regsz, regsz, sp, str, pc, oplen);
break;
default:

View File

@ -222,8 +222,8 @@ static void r_core_anal_bytes (RCore *core, const ut8 *buf, int len, int nops) {
r_cons_printf ("addr: 0x%08"PFMT64x"\n", core->offset+idx);
r_cons_printf ("size: %d\n", op.length);
r_cons_printf ("type: %d (%s)\n", op.type, optypestr (op.type)); // TODO: string
if (op.code)
r_cons_printf ("code: %s\n", op.code);
if (op.esil)
r_cons_printf ("esil: %s\n", op.esil);
r_cons_printf ("eob: %d\n", op.eob);
if (op.jump != UT64_MAX)
r_cons_printf ("jump: 0x%08"PFMT64x"\n", op.jump);

View File

@ -543,7 +543,7 @@ typedef struct r_anal_op_t {
st64 stackptr; /* stack pointer */
RAnalValue *src[3];
RAnalValue *dst;
char code[64];
char esil[64];
int refptr;
char *evalstr; /* evaluation string . the new anal */
struct r_anal_op_t *next;