Skip to content

Commit

Permalink
Merge pull request #1965 from kabeor/next
Browse files Browse the repository at this point in the history
  • Loading branch information
kabeor authored Mar 7, 2023
2 parents 7f1b396 + 824dc5e commit bce16c6
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/CITest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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}"'
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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.
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/setup_cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand Down
5 changes: 4 additions & 1 deletion bindings/python/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ 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_SH);
(1 << CS_ARCH_WASM) | (1 << CS_ARCH_BPF) |
(1 << CS_ARCH_SH));

if ((unsigned int)query < CS_ARCH_MAX)
return all_arch & (1 << query);
Expand Down
8 changes: 7 additions & 1 deletion suite/regress/test_arm64_ldr_registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from capstone import *
from capstone.arm64 import *

_python3 = sys.version_info.major == 3


class SubRegTest(unittest.TestCase):

PATTERNS = [
Expand All @@ -18,7 +21,10 @@ def setUp(self):
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()
Expand Down

0 comments on commit bce16c6

Please sign in to comment.