cstool_xcore.c
Go to the documentation of this file.
1 /* Capstone Disassembler Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
3 
4 #include <stdio.h>
5 #include <capstone/capstone.h>
6 
7 void print_string_hex(char *comment, unsigned char *str, size_t len);
8 
9 void print_insn_detail_xcore(csh handle, cs_insn *ins)
10 {
11  cs_xcore *xcore;
12  int i;
13 
14  // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
15  if (ins->detail == NULL)
16  return;
17 
18  xcore = &(ins->detail->xcore);
19  if (xcore->op_count)
20  printf("\top_count: %u\n", xcore->op_count);
21 
22  for (i = 0; i < xcore->op_count; i++) {
23  cs_xcore_op *op = &(xcore->operands[i]);
24  switch((int)op->type) {
25  default:
26  break;
27  case XCORE_OP_REG:
28  printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
29  break;
30  case XCORE_OP_IMM:
31  printf("\t\toperands[%u].type: IMM = 0x%x\n", i, op->imm);
32  break;
33  case XCORE_OP_MEM:
34  printf("\t\toperands[%u].type: MEM\n", i);
35  if (op->mem.base != XCORE_REG_INVALID)
36  printf("\t\t\toperands[%u].mem.base: REG = %s\n",
37  i, cs_reg_name(handle, op->mem.base));
38  if (op->mem.index != XCORE_REG_INVALID)
39  printf("\t\t\toperands[%u].mem.index: REG = %s\n",
40  i, cs_reg_name(handle, op->mem.index));
41  if (op->mem.disp != 0)
42  printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
43  if (op->mem.direct != 1)
44  printf("\t\t\toperands[%u].mem.direct: -1\n", i);
45 
46 
47  break;
48  }
49  }
50 
51  printf("\n");
52 }
xds_interop_client.str
str
Definition: xds_interop_client.py:487
print_insn_detail_xcore
void print_insn_detail_xcore(csh handle, cs_insn *ins)
Definition: cstool_xcore.c:9
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition: cs_driver.c:91
XCORE_OP_MEM
@ XCORE_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: xcore.h:22
capstone.h
cs_xcore
Instruction structure.
Definition: xcore.h:85
XCORE_REG_INVALID
@ XCORE_REG_INVALID
Definition: xcore.h:27
print_string_hex
void print_string_hex(char *comment, unsigned char *str, size_t len)
cs_reg_name
const CAPSTONE_EXPORT char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1176
XCORE_OP_REG
@ XCORE_OP_REG
= CS_OP_REG (Register operand).
Definition: xcore.h:20
xcore
Definition: test_winkernel.cpp:87
csh
size_t csh
Definition: capstone.h:71
cs_xcore_op
Instruction operand.
Definition: xcore.h:75
XCORE_OP_IMM
@ XCORE_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: xcore.h:21
handle
static csh handle
Definition: test_arm_regression.c:16
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:02