Skip to content

Commit c6ca1f1

Browse files
authored
Merge pull request #4 from icicle-emu/fix-autocomplete
Fix autocomplete
2 parents 7ab27ed + 6e5d32f commit c6ca1f1

File tree

6 files changed

+157
-154
lines changed

6 files changed

+157
-154
lines changed

.github/workflows/CI.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
PYTHONUNBUFFERED: '1'
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
submodules: 'true'
1818

1919
- name: Python environment
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5
2121
with:
2222
python-version: '3.10'
2323

@@ -42,9 +42,9 @@ jobs:
4242
python tests/invalid.py
4343
4444
- name: Upload wheels
45-
uses: actions/upload-artifact@v3
45+
uses: actions/upload-artifact@v4
4646
with:
47-
name: wheels
47+
name: wheels-windows
4848
path: dist
4949

5050
macos:
@@ -56,12 +56,12 @@ jobs:
5656
PYTHONUNBUFFERED: '1'
5757
steps:
5858
- name: Checkout
59-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
6060
with:
6161
submodules: 'true'
6262

6363
- name: Python environment
64-
uses: actions/setup-python@v4
64+
uses: actions/setup-python@v5
6565
with:
6666
python-version: '3.10'
6767

@@ -90,22 +90,22 @@ jobs:
9090
python tests/invalid.py
9191
9292
- name: Upload wheels
93-
uses: actions/upload-artifact@v3
93+
uses: actions/upload-artifact@v4
9494
with:
95-
name: wheels
95+
name: wheels-macos
9696
path: dist
9797

9898
linux:
9999
# Skip building pull requests from the same repository
100100
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
101-
runs-on: ubuntu-latest
102-
container: quay.io/pypa/manylinux2014_x86_64
101+
runs-on: ubuntu-24.04
102+
container: quay.io/pypa/manylinux_2_28_x86_64
103103
env:
104104
# Disable output buffering in an attempt to get readable errors
105105
PYTHONUNBUFFERED: '1'
106106
steps:
107107
- name: Checkout
108-
uses: actions/checkout@v3
108+
uses: actions/checkout@v4
109109
with:
110110
submodules: 'true'
111111

@@ -116,7 +116,7 @@ jobs:
116116
export PATH="$PATH:$HOME/.cargo/bin"
117117
export PATH="/opt/python/cp38-cp38/bin:$PATH"
118118
pip install -r requirements.txt
119-
python setup.py bdist_wheel --py-limited-api=cp37 --plat-name manylinux2014_x86_64
119+
python setup.py bdist_wheel --py-limited-api=cp37 --plat-name manylinux_2_28_x86_64
120120
auditwheel show dist/*.whl
121121
pip install --force-reinstall dist/*.whl
122122
python -c "import icicle"
@@ -129,23 +129,24 @@ jobs:
129129
python tests/invalid.py
130130
131131
- name: Upload wheels
132-
uses: actions/upload-artifact@v3
132+
uses: actions/upload-artifact@v4
133133
with:
134-
name: wheels
134+
name: wheels-linux
135135
path: dist
136136

137137
release:
138138
if: ${{ startsWith(github.ref, 'refs/tags/') }}
139-
runs-on: ubuntu-latest
139+
runs-on: ubuntu-24.04
140140
needs: [windows, macos, linux]
141141
permissions:
142142
contents: write
143143
discussions: write
144144
steps:
145145
- name: Download wheels
146-
uses: actions/download-artifact@v3
146+
uses: actions/download-artifact@v4
147147
with:
148-
name: wheels
148+
pattern: wheels-*
149+
merge-multiple: true
149150
path: dist
150151

151152
- name: Publish to PyPI

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "icicle-python"
5-
version = "0.0.3"
5+
version = "0.0.4"
66
edition = "2021"
77

88
[lib]

python/icicle/__init__.py

Lines changed: 137 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,137 @@
1-
from .icicle import *
1+
from typing import List, Dict, Tuple
2+
from enum import Enum
3+
4+
class MemoryProtection(Enum):
5+
NoAccess = ...
6+
ReadOnly = ...
7+
ReadWrite = ...
8+
ExecuteOnly = ...
9+
ExecuteRead = ...
10+
ExecuteReadWrite = ...
11+
12+
class MemoryExceptionCode(Enum):
13+
Unallocated = ...
14+
Unmapped = ...
15+
UnmappedRegisters = ...
16+
Uninitialized = ...
17+
ReadViolation = ...
18+
WriteViolation = ...
19+
ExecViolation = ...
20+
ReadWatch = ...
21+
WriteWatch = ...
22+
Unaligned = ...
23+
OutOfMemory = ...
24+
SelfModifyingCode = ...
25+
AddressOverflow = ...
26+
Unknown = ...
27+
28+
class RunStatus(Enum):
29+
Running = ...
30+
InstructionLimit = ...
31+
Breakpoint = ...
32+
Interrupted = ...
33+
Halt = ...
34+
Killed = ...
35+
Deadlock = ...
36+
OutOfMemory = ...
37+
Unimplemented = ...
38+
UnhandledException = ...
39+
40+
class ExceptionCode(Enum):
41+
NoException = ...
42+
InstructionLimit = ...
43+
Halt = ...
44+
Sleep = ...
45+
Syscall = ...
46+
CpuStateChanged = ...
47+
DivisionException = ...
48+
ReadUnmapped = ...
49+
ReadPerm = ...
50+
ReadUnaligned = ...
51+
ReadWatch = ...
52+
ReadUninitialized = ...
53+
WriteUnmapped = ...
54+
WritePerm = ...
55+
WriteWatch = ...
56+
WriteUnaligned = ...
57+
ExecViolation = ...
58+
SelfModifyingCode = ...
59+
OutOfMemory = ...
60+
AddressOverflow = ...
61+
InvalidInstruction = ...
62+
UnknownInterrupt = ...
63+
UnknownCpuID = ...
64+
InvalidOpSize = ...
65+
InvalidFloatSize = ...
66+
CodeNotTranslated = ...
67+
ShadowStackOverflow = ...
68+
ShadowStackInvalid = ...
69+
InvalidTarget = ...
70+
UnimplementedOp = ...
71+
ExternalAddr = ...
72+
Environment = ...
73+
JitError = ...
74+
InternalError = ...
75+
UnmappedRegister = ...
76+
UnknownError = ...
77+
78+
class Icicle:
79+
def __init__(self, architecture: str, *,
80+
jit = True,
81+
jit_mem = True,
82+
shadow_stack = True,
83+
recompilation = True,
84+
track_uninitialized = False,
85+
optimize_instructions = True,
86+
optimize_block = True,
87+
tracing = False,
88+
) -> None: ...
89+
90+
@property
91+
def exception_code(self) -> ExceptionCode: ...
92+
93+
@property
94+
def exception_value(self) -> int: ...
95+
96+
icount: int
97+
98+
icount_limit: int
99+
100+
# TODO: API to get memory information?
101+
102+
def mem_map(self, address: int, size: int, protection: MemoryProtection): ...
103+
104+
def mem_unmap(self, address: int, size: int): ...
105+
106+
def mem_protect(self, address: int, size: int, protection: MemoryProtection): ...
107+
108+
def mem_read(self, address: int, size: int) -> bytes: ...
109+
110+
def mem_write(self, address: int, data: bytes) -> None: ...
111+
112+
def reg_list(self) -> Dict[str, Tuple[int, int]]: ...
113+
114+
def reg_offset(self, name: str) -> int: ...
115+
116+
def reg_size(self, name: str) -> int: ...
117+
118+
def reg_read(self, name: str) -> int: ...
119+
120+
def reg_write(self, name: str, value: int) -> None: ...
121+
122+
def reset(self): ...
123+
124+
def run(self) -> RunStatus: ...
125+
126+
def run_until(self, address: int) -> RunStatus: ...
127+
128+
def step(self, count: int) -> RunStatus: ...
129+
130+
def add_breakpoint(self, address: int) -> bool: ...
131+
132+
def remove_breakpoint(self, address: int) -> bool: ...
133+
134+
def architectures() -> List[str]: ...
2135

3136
class MemoryException(Exception):
4137
def __init__(self, message: str, code: MemoryExceptionCode):
@@ -19,3 +152,6 @@ def __ghidra_init():
19152
raise FileNotFoundError("Ghidra processor definitions not found")
20153

21154
__ghidra_init()
155+
156+
# NOTE: This overrides the stubs at runtime with the actual implementation
157+
from .icicle import *

0 commit comments

Comments
 (0)