xcore_detail.c
Go to the documentation of this file.
1 /* Capstone testing regression */
2 /* By Do Minh Tuan <tuanit96@gmail.com>, 02-2019 */
3 
4 
5 #include "factory.h"
6 
7 char *get_detail_xcore(csh *handle, cs_mode mode, cs_insn *ins)
8 {
10  int i;
11  char *result;
12 
13  result = (char *)malloc(sizeof(char));
14  result[0] = '\0';
15 
16  if (ins->detail == NULL)
17  return result;
18 
19  xcore = &(ins->detail->xcore);
20  if (xcore->op_count)
21  add_str(&result, " ; op_count: %u", xcore->op_count);
22 
23  for (i = 0; i < xcore->op_count; i++) {
24  cs_xcore_op *op = &(xcore->operands[i]);
25  switch((int)op->type) {
26  default:
27  break;
28  case XCORE_OP_REG:
29  add_str(&result, " ; operands[%u].type: REG = %s", i, cs_reg_name(*handle, op->reg));
30  break;
31  case XCORE_OP_IMM:
32  add_str(&result, " ; operands[%u].type: IMM = 0x%x", i, op->imm);
33  break;
34  case XCORE_OP_MEM:
35  add_str(&result, " ; operands[%u].type: MEM", i);
36  if (op->mem.base != XCORE_REG_INVALID)
37  add_str(&result, " ; operands[%u].mem.base: REG = %s", i, cs_reg_name(*handle, op->mem.base));
38  if (op->mem.index != XCORE_REG_INVALID)
39  add_str(&result, " ; operands[%u].mem.index: REG = %s", i, cs_reg_name(*handle, op->mem.index));
40  if (op->mem.disp != 0)
41  add_str(&result, " ; operands[%u].mem.disp: 0x%x", i, op->mem.disp);
42  if (op->mem.direct != 1)
43  add_str(&result, " ; operands[%u].mem.direct: -1", i);
44 
45 
46  break;
47  }
48  }
49 
50  return result;
51 }
52 
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
factory.h
get_detail_xcore
char * get_detail_xcore(csh *handle, cs_mode mode, cs_insn *ins)
Definition: xcore_detail.c:7
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
XCORE_OP_MEM
@ XCORE_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: xcore.h:22
cs_mode
cs_mode
Mode type.
Definition: capstone.h:103
cs_xcore
Instruction structure.
Definition: xcore.h:85
XCORE_REG_INVALID
@ XCORE_REG_INVALID
Definition: xcore.h:27
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
add_str
void add_str(char **src, const char *format,...)
Definition: helper.c:89
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
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 Fri May 16 2025 03:00:56