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 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 .__init__ import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OPT_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/tricore_const.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .__init__ import CS_OP_INVALID, CS_OP_REG, CS_OP_IMM, CS_OPT_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
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