30 {
"arm", CS_ARCH_ARM, CS_MODE_ARM },
31 {
"armbe", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_BIG_ENDIAN },
32 {
"arm64", CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN },
33 {
"arm64be", CS_ARCH_ARM64, CS_MODE_BIG_ENDIAN },
34 {
"cortexm", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_MCLASS },
35 {
"thumb", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB },
38 {
"riscv32", CS_ARCH_RISCV, CS_MODE_RISCV32 | CS_MODE_RISCVC },
39 {
"riscv64", CS_ARCH_RISCV, CS_MODE_RISCV64 | CS_MODE_RISCVC },
56 for (uint16_t i = 0; i < insn->size; i++)
57 sprintf(&opcode[3 * i],
" %02" PRIx8, insn->bytes[i]);
60 insn->address, opcode, insn->mnemonic,
61 insn->op_str[0] ?
"\t" :
"", insn->op_str);
65 uint64_t
address,
unsigned int count,
const char *insn_set)
74 command_print(
cmd,
"Instruction set \"%s\" not supported by Capstone", insn_set);
80 if (csret != CS_ERR_OK) {
85 csret = cs_option(handle, CS_OPT_SKIPDATA, CS_OPT_ON);
86 if (csret != CS_ERR_OK) {
92 cs_insn *insn = cs_malloc(handle);
109 size_t size =
sizeof(buf);
110 const uint8_t *tmp = buf;
111 bool csbool = cs_disasm_iter(handle, &tmp, &
size, &
address, insn);
113 command_print(
cmd,
"Capstone cs_disasm_iter() failed: %s", cs_strerror(csret));
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
void command_print(struct command_invocation *cmd, const char *format,...)
uint32_t size
Size of dw_spi_transaction::buffer.
uint32_t address
Starting address. Sector aligned.
int oocd_cs_disassemble(struct command_invocation *cmd, struct target *target, uint64_t address, unsigned int count, const char *insn_set)
int oocd_cs_list_insn_types(struct command_invocation *cmd)
static void print_opcode(struct command_invocation *cmd, const cs_insn *insn)
static struct @119 all_archs[]
When run_command is called, a new instance will be created on the stack, filled with the proper value...
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.