A bit better thumb pseudo decompile and analysis

This commit is contained in:
pancake 2015-05-05 21:35:49 +02:00
parent 0c8837de17
commit 08c859d18c
2 changed files with 11 additions and 0 deletions

View File

@ -416,6 +416,12 @@ static void anop32 (RAnalOp *op, cs_insn *insn) {
op->type = R_ANAL_OP_TYPE_CALL;
op->jump = IMM(0);
break;
case ARM_INS_CBZ:
case ARM_INS_CBNZ:
op->type = R_ANAL_OP_TYPE_CJMP;
op->jump = IMM(1);
op->fail = addr+op->size;
break;
case ARM_INS_B:
case ARM_INS_BX:
case ARM_INS_BXJ:

View File

@ -25,6 +25,8 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "asl", "1 = 2 << 3"},
{ "asr", "1 = 2 >> 3"},
{ "b", "jmp 1"},
{ "cbz", "if !1 jmp 2"},
{ "b.w", "jmp 1"},
{ "b.gt", "jmp ifgt 1"},
{ "b.le", "jmp ifle 1"},
{ "beq lr", "ifeq ret"},
@ -41,11 +43,13 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "fml", "1 = 2 * 3"},
{ "ldr", "1 = 2"},
{ "ldrb", "1 = 2"},
{ "ldr.w", "1 = 2"},
{ "ldrsw", "1 = 2 + 3"},
{ "lsl", "1 = 2 << 3"},
{ "lsr", "1 = 2 >> 3"},
{ "mov", "1 = 2"},
{ "movz", "1 = 2"},
{ "vmov.i32", "1 = 2"},
{ "muf", "1 = 2 * 3"},
{ "mul", "1 = 2 * 3"},
{ "orr", "1 = 2 | 3"},
@ -71,6 +75,7 @@ static int replace(int argc, const char *argv[], char *newstr) {
{ "pop.w", "pop 1"},
{ "vpop", "pop 1"},
{ "vpush", "push 1"},
{ "push.w", "push 1"},
{ NULL }
};