Skip to content

Commit b8f8851

Browse files
committed
Minor fixes
1 parent c2b67d2 commit b8f8851

File tree

7 files changed

+46
-51
lines changed

7 files changed

+46
-51
lines changed

.github/workflows/build-wheels-publish.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
python3 -m wheel tags --python-tag='py2' --abi-tag=none wheelhouse/*cp38*.whl
123123
124124
- uses: LizardByte/[email protected]
125-
if: (matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' && matrix.cibw_build == 'cp38-manylinux') || matrix.os == 'macos-latest' || (matrix.os == 'windows-2019' && matrix.arch == 'AMD64')
125+
if: (matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' && matrix.cibw_build == 'cp38-manylinux*') || matrix.os == 'macos-latest' || (matrix.os == 'windows-2019' && matrix.arch == 'AMD64')
126126
with:
127127
python-version: 2.7
128128

@@ -136,7 +136,7 @@ jobs:
136136
137137
# NOTE: no python2.7 support for macos-13: https://github.com/LizardByte/setup-python-action/issues/2
138138
- name: 'Python 2.7 tests - Non-Windows'
139-
if: (matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' && matrix.cibw_build == 'cp38-manylinux') || matrix.os == 'macos-latest'
139+
if: (matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' && matrix.cibw_build == 'cp38-manylinux*') || matrix.os == 'macos-latest'
140140
run: |
141141
python2 -m pip install capstone==4.0.2 wheelhouse/*py2*.whl
142142
python2 -m unittest discover tests/regress "*.py"
@@ -262,8 +262,8 @@ jobs:
262262
steps:
263263
- uses: actions/checkout@v4
264264
with:
265-
fetch-depth: 0 # Optional, use if you use setuptools_scm
266-
submodules: true # Optional, use if you have submodules
265+
fetch-depth: 0
266+
submodules: true
267267

268268
- name: Build SDist
269269
run: |

bindings/python/pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Changelog = "https://github.com/unicorn-engine/unicorn/blob/master/ChangeLog"
3333

3434
[project.optional-dependencies]
3535
test = [
36-
"capstone==6.0.0a2"
36+
"capstone==6.0.0a2;python_version>'3.7'",
37+
"capstone==5.0.1;python_version<='3.7'"
3738
]
3839

3940
[tool.setuptools.packages.find]

bindings/python/setup.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ def build_libraries():
103103
has_msbuild = shutil.which('msbuild') is not None
104104
conf = 'Debug' if int(os.getenv('DEBUG', 0)) else 'Release'
105105
cmake_args = ['cmake', '-B', BUILD_DIR, "-DCMAKE_BUILD_TYPE=" + conf]
106-
if ut := os.getenv("UNICORN_TRACER"):
107-
cmake_args += [f"-DUNICORN_TRACER={ut.upper()}"]
108-
if ul := os.getenv("UNICORN_LOGGING"):
109-
cmake_args += [f"-DUNICORN_LOGGING={ul.upper()}"]
106+
if os.getenv("UNICORN_TRACER"):
107+
cmake_args += ["-DUNICORN_TRACER=on"]
108+
if conf == 'Debug':
109+
cmake_args += ["-DUNICORN_LOGGING=on"]
110110

111111
if has_msbuild and sys.platform == 'win32':
112112
generators = os.getenv('GENERATORS') or 'Visual Studio 16 2019'

tests/regress/arm_memcpy_neon.py

+23-24
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,30 @@
55
from unicorn.arm_const import *
66

77
SHELLCODE = (
8-
b'\x03\xF0\x8F\xE0', # 0001F894 ADD PC, PC, R3
9-
b'\x0D\x07\x21\xF4', # 0001F898 VLD1.8 {D0}, [R1]!
10-
b'\x0D\x07\x0C\xF4', # 0001F89C VST1.8 {D0}, [R12]!
11-
b'\x0D\x07\x21\xF4', # 0001F8A0 VLD1.8 {D0}, [R1]!
12-
b'\x0D\x07\x0C\xF4', # 0001F8A4 VST1.8 {D0}, [R12]!
13-
b'\x0D\x07\x21\xF4', # 0001F8A8 VLD1.8 {D0}, [R1]!
14-
b'\x0D\x07\x0C\xF4', # 0001F8AC VST1.8 {D0}, [R12]!
15-
b'\x0D\x07\x21\xF4', # 0001F8B0 VLD1.8 {D0}, [R1]!
16-
b'\x0D\x07\x0C\xF4', # 0001F8B4 VST1.8 {D0}, [R12]!
17-
b'\x0D\x07\x21\xF4', # 0001F8B8 VLD1.8 {D0}, [R1]!
18-
b'\x0D\x07\x0C\xF4', # 0001F8BC VST1.8 {D0}, [R12]!
19-
b'\x0D\x07\x21\xF4', # 0001F8C0 VLD1.8 {D0}, [R1]!
20-
b'\x0D\x07\x0C\xF4', # 0001F8C4 VST1.8 {D0}, [R12]!
21-
b'\x0D\x07\x21\xF4', # 0001F8C8 VLD1.8 {D0}, [R1]!
22-
b'\x0D\x07\x0C\xF4', # 0001F8CC VST1.8 {D0}, [R12]!
23-
b'\x04\x00\x12\xE3', # 0001F8D0 TST R2, #4
24-
b'\x04\x30\x91\x14', # 0001F8D4 LDRNE R3, [R1],#4
25-
b'\x04\x30\x8C\x14', # 0001F8D8 STRNE R3, [R12],#4
26-
b'\x82\x2F\xB0\xE1', # 0001F8DC MOVS R2, R2,LSL#31
27-
b'\xB2\x30\xD1\x20', # 0001F8E0 LDRHCS R3, [R1],#2
28-
b'\x00\x10\xD1\x15', # 0001F8E4 LDRBNE R1, [R1]
29-
b'\xB2\x30\xCC\x20', # 0001F8E8 STRHCS R3, [R12],#2
30-
b'\x00\x10\xCC\x15', # 0001F8EC STRBNE R1, [R12]
8+
b'\x03\xF0\x8F\xE0' # 0001F894 ADD PC, PC, R3
9+
b'\x0D\x07\x21\xF4' # 0001F898 VLD1.8 {D0}, [R1]!
10+
b'\x0D\x07\x0C\xF4' # 0001F89C VST1.8 {D0}, [R12]!
11+
b'\x0D\x07\x21\xF4' # 0001F8A0 VLD1.8 {D0}, [R1]!
12+
b'\x0D\x07\x0C\xF4' # 0001F8A4 VST1.8 {D0}, [R12]!
13+
b'\x0D\x07\x21\xF4' # 0001F8A8 VLD1.8 {D0}, [R1]!
14+
b'\x0D\x07\x0C\xF4' # 0001F8AC VST1.8 {D0}, [R12]!
15+
b'\x0D\x07\x21\xF4' # 0001F8B0 VLD1.8 {D0}, [R1]!
16+
b'\x0D\x07\x0C\xF4' # 0001F8B4 VST1.8 {D0}, [R12]!
17+
b'\x0D\x07\x21\xF4' # 0001F8B8 VLD1.8 {D0}, [R1]!
18+
b'\x0D\x07\x0C\xF4' # 0001F8BC VST1.8 {D0}, [R12]!
19+
b'\x0D\x07\x21\xF4' # 0001F8C0 VLD1.8 {D0}, [R1]!
20+
b'\x0D\x07\x0C\xF4' # 0001F8C4 VST1.8 {D0}, [R12]!
21+
b'\x0D\x07\x21\xF4' # 0001F8C8 VLD1.8 {D0}, [R1]!
22+
b'\x0D\x07\x0C\xF4' # 0001F8CC VST1.8 {D0}, [R12]!
23+
b'\x04\x00\x12\xE3' # 0001F8D0 TST R2, #4
24+
b'\x04\x30\x91\x14' # 0001F8D4 LDRNE R3, [R1],#4
25+
b'\x04\x30\x8C\x14' # 0001F8D8 STRNE R3, [R12],#4
26+
b'\x82\x2F\xB0\xE1' # 0001F8DC MOVS R2, R2,LSL#31
27+
b'\xB2\x30\xD1\x20' # 0001F8E0 LDRHCS R3, [R1],#2
28+
b'\x00\x10\xD1\x15' # 0001F8E4 LDRBNE R1, [R1]
29+
b'\xB2\x30\xCC\x20' # 0001F8E8 STRHCS R3, [R12],#2
30+
b'\x00\x10\xCC\x15' # 0001F8EC STRBNE R1, [R12]
3131
)
32-
SHELLCODE = b''.join(SHELLCODE)
3332
BASE = 0x1F894
3433
COPY_SRC = 0x1000
3534
COPY_DST = 0x2000

tests/regress/emu_clear_errors.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
from unicorn.x86_const import *
44

55
CODE = (
6-
b'\x8B\x74\x01\x28', # mov esi, dword ptr [ecx + eax + 0x28] mapped: 0x1000
7-
b'\x03\xF0', # add esi, eax 0x1004
8-
b'\x8D\x45\xFC', # lea eax, dword ptr [ebp - 4] 0x1006
9-
b'\x50', # push eax 0x1009
10-
b'\x6A\x40', # push 0x40 0x100A
11-
b'\x6A\x10', # push 0x10 0x100C
12-
b'\x56', # push esi 0x100E
6+
b'\x8B\x74\x01\x28' # mov esi, dword ptr [ecx + eax + 0x28] mapped: 0x1000
7+
b'\x03\xF0' # add esi, eax 0x1004
8+
b'\x8D\x45\xFC' # lea eax, dword ptr [ebp - 4] 0x1006
9+
b'\x50' # push eax 0x1009
10+
b'\x6A\x40' # push 0x40 0x100A
11+
b'\x6A\x10' # push 0x10 0x100C
12+
b'\x56' # push esi 0x100E
1313
)
14-
CODE = b''.join(CODE)
1514
BASE = 0x1000
1615
STACK = 0x4000
1716

tests/regress/invalid_insn.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
21
import regress
3-
42
from unicorn import *
53
from unicorn.x86_const import *
6-
74
from capstone import *
85

9-
10-
CODE = bytes.fromhex(
11-
'48 31 c0' # xor rax,rax
12-
'48 0f c7 f0' # rdrand rax
13-
'f4' # hlt
6+
CODE = (
7+
b'\x48\x31\xc0' # xor rax,rax
8+
b'\x48\x0f\xc7\xf0' # rdrand rax
9+
b'\xf4' # hlt
1410
)
1511

1612
BASE = 0x100000
@@ -41,7 +37,7 @@ def hook_invalid_insn(uc, ud):
4137

4238
# signal uc we are ok
4339
return True
44-
40+
4541
# not handled, uc will crash
4642
return False
4743

tests/regress/regress.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ def __setup_logger(name):
2727

2828

2929
logger = __setup_logger('UnicornRegress')
30-
logger.setLevel(getattr(logging, (os.getenv('REGRESS_LOG_LEVEL') or 'INFO').upper()))
30+
logger.setLevel((os.getenv('REGRESS_LOG_LEVEL') or 'INFO').upper())

0 commit comments

Comments
 (0)