change API cs_disasm_dyn(): break cs_insn into 2 structures, and put all details into new structure cs_detail. this break API compatibility
diff --git a/tests/test.c b/tests/test.c
index 7a8baaa..52e54f6 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -166,7 +166,7 @@
printf("0x%"PRIx64":\n", insn[j-1].address + insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(insn);
+ cs_free(insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
diff --git a/tests/test_arm.c b/tests/test_arm.c
index cbc7b3d..15fc6a2 100644
--- a/tests/test_arm.c
+++ b/tests/test_arm.c
@@ -31,7 +31,7 @@
static void print_insn_detail(cs_insn *ins)
{
- cs_arm *arm = &(ins->arm);
+ cs_arm *arm = &(ins->detail->arm);
if (arm->op_count)
printf("\top_count: %u\n", arm->op_count);
@@ -85,7 +85,7 @@
}
if (arm->cc != ARM_CC_AL && arm->cc != ARM_CC_INVALID)
- printf("\tCode condition: %u\n", ins->arm.cc);
+ printf("\tCode condition: %u\n", ins->detail->arm.cc);
if (arm->update_flags)
printf("\tUpdate-flags: True\n");
@@ -211,7 +211,7 @@
printf("0x%"PRIx64":\n", insn[j-1].address + insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(insn);
+ cs_free(insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
diff --git a/tests/test_arm64.c b/tests/test_arm64.c
index 7ce52be..bc7304c 100644
--- a/tests/test_arm64.c
+++ b/tests/test_arm64.c
@@ -31,7 +31,7 @@
static void print_insn_detail(cs_insn *ins)
{
- cs_arm64 *arm64 = &(ins->arm64);
+ cs_arm64 *arm64 = &(ins->detail->arm64);
int i;
if (arm64->op_count)
@@ -171,7 +171,7 @@
printf("0x%"PRIx64":\n", insn[j-1].address + insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(insn);
+ cs_free(insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
diff --git a/tests/test_detail.c b/tests/test_detail.c
index 268c62d..1880e17 100644
--- a/tests/test_detail.c
+++ b/tests/test_detail.c
@@ -167,28 +167,28 @@
i->id, cs_insn_name(handle, i->id));
// print implicit registers used by this instruction
- if (i->regs_read_count > 0) {
+ if (i->detail->regs_read_count > 0) {
printf("\tImplicit registers read: ");
- for (n = 0; n < i->regs_read_count; n++) {
- printf("%s ", cs_reg_name(handle, i->regs_read[n]));
+ for (n = 0; n < i->detail->regs_read_count; n++) {
+ printf("%s ", cs_reg_name(handle, i->detail->regs_read[n]));
}
printf("\n");
}
// print implicit registers modified by this instruction
- if (i->regs_write_count > 0) {
+ if (i->detail->regs_write_count > 0) {
printf("\tImplicit registers modified: ");
- for (n = 0; n < i->regs_write_count; n++) {
- printf("%s ", cs_reg_name(handle, i->regs_write[n]));
+ for (n = 0; n < i->detail->regs_write_count; n++) {
+ printf("%s ", cs_reg_name(handle, i->detail->regs_write[n]));
}
printf("\n");
}
// print the groups this instruction belong to
- if (i->groups_count > 0) {
+ if (i->detail->groups_count > 0) {
printf("\tThis instruction belongs to groups: ");
- for (n = 0; n < i->groups_count; n++) {
- printf("%u ", i->groups[n]);
+ for (n = 0; n < i->detail->groups_count; n++) {
+ printf("%u ", i->detail->groups[n]);
}
printf("\n");
}
@@ -198,7 +198,7 @@
printf("0x%"PRIx64":\n", all_insn[j-1].address + all_insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(all_insn);
+ cs_free(all_insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
diff --git a/tests/test_mips.c b/tests/test_mips.c
index 8e2c4b5..53f3bc1 100644
--- a/tests/test_mips.c
+++ b/tests/test_mips.c
@@ -31,7 +31,7 @@
static void print_insn_detail(cs_insn *ins)
{
- cs_mips *mips = &(ins->mips);
+ cs_mips *mips = &(ins->detail->mips);
if (mips->op_count)
printf("\top_count: %u\n", mips->op_count);
@@ -116,7 +116,7 @@
printf("0x%"PRIx64":\n", insn[j-1].address + insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(insn);
+ cs_free(insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
diff --git a/tests/test_x86.c b/tests/test_x86.c
index 93231e8..bbedcea 100644
--- a/tests/test_x86.c
+++ b/tests/test_x86.c
@@ -34,7 +34,7 @@
static void print_insn_detail(csh ud, cs_mode mode, cs_insn *ins)
{
int i;
- cs_x86 *x86 = &(ins->x86);
+ cs_x86 *x86 = &(ins->detail->x86);
print_string_hex("\tPrefix:", x86->prefix, 5);
@@ -188,7 +188,7 @@
printf("0x%"PRIx64":\n", insn[j-1].address + insn[j-1].size);
// free memory allocated by cs_disasm_dyn()
- cs_free(insn);
+ cs_free(insn, count);
} else {
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);