Merge branch 'next' into sh-build-warnings

This commit is contained in:
Wu ChenXu 2023-03-08 23:23:31 +08:00 committed by GitHub
commit 0a03edb202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 22 deletions

View File

@ -30,28 +30,28 @@ jobs:
matrix:
config:
- {
name: 'ubuntu-18.04 x64 python2.7 make',
name: 'ubuntu-18.04 x64 python2.7 cmake',
os: ubuntu-18.04,
arch: x64,
python-arch: x64,
python-version: '2.7',
build-system: 'make',
build-system: 'cmake',
}
- {
name: 'ubuntu-18.04 x64 python3.6 make',
name: 'ubuntu-18.04 x64 python3.6 cmake',
os: ubuntu-18.04,
arch: x64,
python-arch: x64,
python-version: '3.6',
build-system: 'make',
build-system: 'cmake',
}
- {
name: 'ubuntu-20.04 x64 python2.7 make',
name: 'ubuntu-20.04 x64 python2.7 cmake',
os: ubuntu-20.04,
arch: x64,
python-arch: x64,
python-version: '2.7',
build-system: 'make',
build-system: 'cmake',
}
- {
name: 'ubuntu-20.04 x64 python3.9 make',
@ -91,25 +91,28 @@ jobs:
if: startsWith(matrix.config.build-system, 'make')
shell: 'script -q -e -c "bash {0}"'
run: |
./make.sh
make check
sudo make install
./make.sh;
make check;
cp libcapstone.so.5 libcapstone.so.5.0
# sudo make install
- name: cmake
if: startsWith(matrix.config.build-system, 'cmake')
shell: 'script -q -e -c "bash {0}"'
run: |
mkdir build
cd build
cmake -DCAPSTONE_INSTALL=1 ..
cmake --build . --config Release
sudo make install
mkdir build && cd build;
cmake -DCAPSTONE_INSTALL=1 -DBUILD_SHARED_LIBS=1 ..;
cmake --build . --config Release;
cp libcapstone.* ../;
# sudo make install;
- name: build python binding
shell: 'script -q -e -c "bash {0}"'
run: |
cp libcapstone.so.* bindings/python/libcapstone.so
cd bindings/python && make check; cd ../..;
mkdir -p bindings/python/capstone/lib && cp libcapstone.so.5.* bindings/python/capstone/lib/libcapstone.so;
cd bindings/python;
make && make check ;
cd ../..;
- name: cstest
shell: 'script -q -e -c "bash {0}"'

View File

@ -28,7 +28,7 @@ cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0091 NEW)
project(capstone
VERSION 5.0.0
VERSION 5.0
)
# to configure the options specify them in in the command line or change them in the cmake UI.
@ -133,6 +133,7 @@ set(HEADERS_COMMON
include/capstone/mos65xx.h
include/capstone/bpf.h
include/capstone/riscv.h
include/capstone/sh.h
include/capstone/platform.h
)

View File

@ -672,7 +672,7 @@ class CsInsn(object):
arch = self._cs.arch
if arch == CS_ARCH_ARM:
(self.usermode, self.vector_size, self.vector_data, self.cps_mode, self.cps_flag, self.cc, self.update_flags, \
self.writeback, self.mem_barrier, self.operands) = arm.get_arch_info(self._raw.detail.contents.arch.arm)
self.writeback, self.post_index, self.mem_barrier, self.operands) = arm.get_arch_info(self._raw.detail.contents.arch.arm)
elif arch == CS_ARCH_ARM64:
(self.cc, self.update_flags, self.writeback, self.post_index, self.operands) = \
arm64.get_arch_info(self._raw.detail.contents.arch.arm64)

View File

@ -9,7 +9,7 @@ from distutils.command.build import build
from Cython.Distutils import build_ext
SYSTEM = sys.platform
VERSION = '4.0.0'
VERSION = '5.0.0'
# adapted from commit e504b81 of Nguyen Tan Cong
# Reference: https://docs.python.org/2/library/platform.html#cross-platform

View File

@ -82,7 +82,10 @@ def test_cs_disasm_quick():
def test_different_data_formats():
data = bytes.fromhex('4831C948F7E1043B48BB0A2F62696E2F2F736852530A545F5257545E0F05')
if _python3:
data = bytes.fromhex('4831C948F7E1043B48BB0A2F62696E2F2F736852530A545F5257545E0F05')
else:
data = bytes(bytearray.fromhex('4831C948F7E1043B48BB0A2F62696E2F2F736852530A545F5257545E0F05'))
mnemonics = ['xor', 'mul', 'add', 'movabs', 'push', 'pop', 'push', 'push', 'push', 'pop', 'syscall']
disassembler = Cs(CS_ARCH_X86, CS_MODE_64)
for name, code in (

2
cs.c
View File

@ -369,7 +369,7 @@ bool CAPSTONE_API cs_support(int query)
(1 << CS_ARCH_M68K) | (1 << CS_ARCH_TMS320C64X) |
(1 << CS_ARCH_M680X) | (1 << CS_ARCH_EVM) |
(1 << CS_ARCH_RISCV) | (1 << CS_ARCH_MOS65XX) |
(1 << CS_ARCH_WASM) | (1 << CS_ARCH_BPF) |
(1 << CS_ARCH_WASM) | (1 << CS_ARCH_BPF) |
(1 << CS_ARCH_SH));
if ((unsigned int)query < CS_ARCH_MAX)

View File

@ -2,6 +2,9 @@ import unittest
from capstone import *
from capstone.arm64 import *
_python3 = sys.version_info.major == 3
class SubRegTest(unittest.TestCase):
PATTERNS = [
@ -18,7 +21,10 @@ class SubRegTest(unittest.TestCase):
self.cs.detail = True
for pattern, asm in self.PATTERNS:
l = list(self.cs.disasm(bytes.fromhex(pattern), 0))
if _python3:
l = list(self.cs.disasm(bytes.fromhex(pattern), 0))
else:
l = list(self.cs.disasm(bytearray.fromhex(pattern), 0))
self.assertTrue(len(l) == 1)
_, expected_reg_written, expected_reg_read = asm.split()