diff --git a/arch/M680X/M680XDisassembler.c b/arch/M680X/M680XDisassembler.c index cfe88d38..55e392f7 100644 --- a/arch/M680X/M680XDisassembler.c +++ b/arch/M680X/M680XDisassembler.c @@ -650,14 +650,14 @@ static bool is_indexed09_post_byte_valid(const m680x_info *info, case 0x9D: // [n16,PCR] insn_description->insn_size += 2; retval = read_byte(info, &ir, *address + 1); - address += 2; + *address += 2; return retval; case 0x9F: // [n] insn_description->insn_size += 2; retval = (post_byte & 0x60) == 0 && read_byte(info, &ir, *address + 1); - address += 2; + *address += 2; return retval; } diff --git a/cstool/cstool.c b/cstool/cstool.c index 15c8ca47..5f7233cc 100644 --- a/cstool/cstool.c +++ b/cstool/cstool.c @@ -135,7 +135,7 @@ static uint8_t *preprocess(char *code, size_t *size) static void usage(char *prog) { printf("Cstool for Capstone Disassembler Engine v%u.%u.%u\n\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA); - printf("Syntax: %s [-u|-d] [start-address-in-hex-format]\n", prog); + printf("Syntax: %s [-u|-d|-s] [start-address-in-hex-format]\n", prog); printf("\nThe following options are supported:\n"); if (cs_support(CS_ARCH_X86)) { @@ -215,7 +215,8 @@ static void usage(char *prog) printf("\nExtra options:\n"); printf(" -d show detailed information of the instructions\n"); - printf(" -u show immediates as unsigned\n\n"); + printf(" -u show immediates as unsigned\n"); + printf(" -s decode in SKIPDATA mode\n\n"); } static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins) @@ -290,10 +291,14 @@ int main(int argc, char **argv) cs_arch arch = CS_ARCH_ALL; bool detail_flag = false; bool unsigned_flag = false; + bool skipdata = false; int args_left; - while ((c = getopt (argc, argv, "udhv")) != -1) { + while ((c = getopt (argc, argv, "sudhv")) != -1) { switch (c) { + case 's': + skipdata = true; + break; case 'u': unsigned_flag = true; break; @@ -343,6 +348,10 @@ int main(int argc, char **argv) if (strstr (mode, "att")) { cs_option(handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT); } + + // turn on SKIPDATA mode + if (skipdata) + cs_option(handle, CS_OPT_SKIPDATA, CS_OPT_ON); } break; }