Use OS independent printf formatting.
This commit is contained in:
parent
bd003941a8
commit
6511ca8b1f
|
@ -28,14 +28,12 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||||
case ARM_OP_REG:
|
case ARM_OP_REG:
|
||||||
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
|
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
|
||||||
break;
|
break;
|
||||||
case ARM_OP_IMM: {
|
case ARM_OP_IMM:
|
||||||
bool neg_imm = op->imm < 0;
|
if (op->imm < 0)
|
||||||
if (neg_imm)
|
printf("\t\toperands[%u].type: IMM = -0x%" PRIx64 "\n", i, -(op->imm));
|
||||||
printf("\t\toperands[%u].type: IMM = -0x%lx\n", i, -(op->imm));
|
|
||||||
else
|
else
|
||||||
printf("\t\toperands[%u].type: IMM = 0x%lx\n", i, op->imm);
|
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case ARM_OP_PRED:
|
case ARM_OP_PRED:
|
||||||
printf("\t\toperands[%u].type: PRED = %d\n", i, op->pred);
|
printf("\t\toperands[%u].type: PRED = %d\n", i, op->pred);
|
||||||
break;
|
break;
|
||||||
|
@ -64,10 +62,10 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ARM_OP_PIMM:
|
case ARM_OP_PIMM:
|
||||||
printf("\t\toperands[%u].type: P-IMM = %u\n", i, op->imm);
|
printf("\t\toperands[%u].type: P-IMM = %" PRIu64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
case ARM_OP_CIMM:
|
case ARM_OP_CIMM:
|
||||||
printf("\t\toperands[%u].type: C-IMM = %u\n", i, op->imm);
|
printf("\t\toperands[%u].type: C-IMM = %" PRIu64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
case ARM_OP_SETEND:
|
case ARM_OP_SETEND:
|
||||||
printf("\t\toperands[%u].type: SETEND = %s\n", i, op->setend == ARM_SETEND_BE? "be" : "le");
|
printf("\t\toperands[%u].type: SETEND = %s\n", i, op->setend == ARM_SETEND_BE? "be" : "le");
|
||||||
|
|
|
@ -55,7 +55,10 @@ static void print_insn_detail(csh cs_handle, cs_insn *ins)
|
||||||
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(cs_handle, op->reg));
|
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(cs_handle, op->reg));
|
||||||
break;
|
break;
|
||||||
case ARM_OP_IMM:
|
case ARM_OP_IMM:
|
||||||
printf("\t\toperands[%u].type: IMM = 0x%x\n", i, op->imm);
|
if (op->imm < 0)
|
||||||
|
printf("\t\toperands[%u].type: IMM = -0x%" PRIx64 "\n", i, -(op->imm));
|
||||||
|
else
|
||||||
|
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
case ARM_OP_FP:
|
case ARM_OP_FP:
|
||||||
#if defined(_KERNEL_MODE)
|
#if defined(_KERNEL_MODE)
|
||||||
|
@ -82,10 +85,10 @@ static void print_insn_detail(csh cs_handle, cs_insn *ins)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ARM_OP_PIMM:
|
case ARM_OP_PIMM:
|
||||||
printf("\t\toperands[%u].type: P-IMM = %u\n", i, op->imm);
|
printf("\t\toperands[%u].type: P-IMM = %" PRIu64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
case ARM_OP_CIMM:
|
case ARM_OP_CIMM:
|
||||||
printf("\t\toperands[%u].type: C-IMM = %u\n", i, op->imm);
|
printf("\t\toperands[%u].type: C-IMM = %" PRIu64 "\n", i, op->imm);
|
||||||
break;
|
break;
|
||||||
case ARM_OP_SETEND:
|
case ARM_OP_SETEND:
|
||||||
printf("\t\toperands[%u].type: SETEND = %s\n", i, op->setend == ARM_SETEND_BE? "be" : "le");
|
printf("\t\toperands[%u].type: SETEND = %s\n", i, op->setend == ARM_SETEND_BE? "be" : "le");
|
||||||
|
|
Loading…
Reference in New Issue