tests: simplify some accesses to insn's details, and fix some typo bugs

This commit is contained in:
Nguyen Anh Quynh 2014-01-05 21:45:30 +08:00
parent fa02175fba
commit f122ae0629
3 changed files with 13 additions and 12 deletions

View File

@ -85,7 +85,7 @@ static void print_insn_detail(cs_insn *ins)
}
if (arm->cc != ARM_CC_AL && arm->cc != ARM_CC_INVALID)
printf("\tCode condition: %u\n", ins->detail->arm.cc);
printf("\tCode condition: %u\n", arm->cc);
if (arm->update_flags)
printf("\tUpdate-flags: True\n");

View File

@ -173,28 +173,29 @@ static void test()
i->id, cs_insn_name(handle, i->id));
// print implicit registers used by this instruction
if (i->detail->regs_read_count > 0) {
cs_detail *detail = i->detail;
if (detail->regs_read_count > 0) {
printf("\tImplicit registers read: ");
for (n = 0; n < i->detail->regs_read_count; n++) {
printf("%s ", cs_reg_name(handle, i->detail->regs_read[n]));
for (n = 0; n < detail->regs_read_count; n++) {
printf("%s ", cs_reg_name(handle, detail->regs_read[n]));
}
printf("\n");
}
// print implicit registers modified by this instruction
if (i->detail->regs_write_count > 0) {
if (detail->regs_write_count > 0) {
printf("\tImplicit registers modified: ");
for (n = 0; n < i->detail->regs_write_count; n++) {
printf("%s ", cs_reg_name(handle, i->detail->regs_write[n]));
for (n = 0; n < detail->regs_write_count; n++) {
printf("%s ", cs_reg_name(handle, detail->regs_write[n]));
}
printf("\n");
}
// print the groups this instruction belong to
if (i->detail->groups_count > 0) {
if (detail->groups_count > 0) {
printf("\tThis instruction belongs to groups: ");
for (n = 0; n < i->detail->groups_count; n++) {
printf("%u ", i->detail->groups[n]);
for (n = 0; n < detail->groups_count; n++) {
printf("%u ", detail->groups[n]);
}
printf("\n");
}

View File

@ -60,10 +60,10 @@ static void print_insn_detail(cs_insn *ins)
}
if (ppc->bc != 0)
printf("\tBranch code: %u\n", ins->detail->ppc.bc);
printf("\tBranch code: %u\n", ppc->bc);
if (ppc->bh != 0)
printf("\tBranch hint: %u\n", ins->detail->ppc.bh);
printf("\tBranch hint: %u\n", ppc->bh);
if (ppc->update_cr0)
printf("\tUpdate-CR0: True\n");