Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix capstone_test.c #2059 #2060

Merged
merged 4 commits into from
Jun 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion bindings/const_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
'comment_close': '',
},
'python': {
'header': "# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [%s_const.py]\n",
'header': "from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM\n"
"# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [%s_const.py]\n",
'footer': "",
'line_format': '%s = %s\n',
'out_file': './python/capstone/%s_const.py',
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/capstone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
'CS_OPT_ON',
'CS_OPT_OFF',

'CS_OPT_MEM',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be CS_OP_MEM?

Copy link
Contributor Author

@imbillow imbillow Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that this has been fixed in your autosync branch.

My mistake, I was too careless.


'CS_ERR_OK',
'CS_ERR_MEM',
'CS_ERR_ARCH',
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/arm64_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [arm64_const.py]

ARM64_SFT_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/arm_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [arm_const.py]

ARM_SFT_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/bpf_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [bpf_const.py]

BPF_OP_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/evm_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [evm_const.py]

EVM_INS_STOP = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/m680x_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [m680x_const.py]
M680X_OPERAND_COUNT = 9

Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/m68k_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [m68k_const.py]
M68K_OPERAND_COUNT = 4

Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/mips_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [mips_const.py]

MIPS_OP_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/mos65xx_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [mos65xx_const.py]

MOS65XX_REG_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/ppc_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [ppc_const.py]

PPC_BC_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/riscv_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [riscv_const.py]

# Operand type for instruction's operands
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/sparc_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [sparc_const.py]

SPARC_CC_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/sysz_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [sysz_const.py]

SYSZ_CC_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/tms320c64x_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [tms320c64x_const.py]

TMS320C64X_OP_INVALID = 0
Expand Down
3 changes: 2 additions & 1 deletion bindings/python/capstone/tricore_const.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [tricore_const.py]
TRICORE_OP_INVALID = CS_OP_INVALID
TRICORE_OP_REG = CS_OP_REG
TRICORE_OP_IMM = CS_OP_IMM
TRICORE_OP_MEM = CS_OPT_MEM
TRICORE_OP_MEM = CS_OP_MEM
TRICORE_OP_COUNT = 8

TRICORE_REG_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/wasm_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [wasm_const.py]

WASM_OP_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/x86_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [x86_const.py]

X86_REG_INVALID = 0
Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/xcore_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OP_MEM
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [xcore_const.py]

XCORE_OP_INVALID = 0
Expand Down
2 changes: 1 addition & 1 deletion include/capstone/tricore.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef enum tricore_op_type {
TRICORE_OP_INVALID = CS_OP_INVALID, ///< CS_OP_INVALID (Uninitialized).
TRICORE_OP_REG = CS_OP_REG, ///< CS_OP_REG (Register operand).
TRICORE_OP_IMM = CS_OP_IMM, ///< CS_OP_IMM (Immediate operand).
TRICORE_OP_MEM = CS_OPT_MEM, ///< CS_OP_MEM (Memory operand).
TRICORE_OP_MEM = CS_OP_MEM, ///< CS_OP_MEM (Memory operand).
} tricore_op_type;

/// Instruction's operand referring to memory
Expand Down
7 changes: 2 additions & 5 deletions suite/cstest/src/capstone_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ void test_single_issue(csh *handle, cs_mode mode, char *line, int detail)
{
char **list_part, **list_byte, **list_part_issue_result;
int size_part, size_byte, size_part_issue_result;
char *tmptmp;
int i, count, j;
unsigned char *code;
cs_insn *insn;
Expand Down Expand Up @@ -255,9 +254,7 @@ void test_single_issue(csh *handle, cs_mode mode, char *line, int detail)

for (i = 0; i < size_part_issue_result; ++i) {
trim_str(list_part_issue_result[i]);
memset(tmptmp, 0, MAXMEM);

tmptmp = (char *)malloc(sizeof(char));
char *tmptmp = (char *)malloc(sizeof(char));
tmptmp[0] = '\0';
add_str(&tmptmp, "%s", list_part_issue_result[i]);
add_str(&tmptmp, " ;");
Expand All @@ -270,9 +267,9 @@ void test_single_issue(csh *handle, cs_mode mode, char *line, int detail)
free(cs_result);
// free_strs(list_part_cs_result, size_part_cs_result);
free_strs(list_part_issue_result, size_part_issue_result);
free(tmptmp);
_fail(__FILE__, __LINE__);
}
free(tmptmp);
}

cs_free(insn, count);
Expand Down