mirror of
https://github.com/rizinorg/rz-bindgen.git
synced 2026-11-08 08:08:19 -10:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a49e69b19a | ||
|
|
8b84bc13e7 | ||
|
|
6a3641cb6d | ||
|
|
d74c39e6fa | ||
|
|
f36d5c4098 | ||
|
|
9463be9616 | ||
|
|
ca552d44d3 | ||
|
|
4d716bce6e | ||
|
|
ac2381b166 | ||
|
|
da60547435 | ||
|
|
4518ff76ec | ||
|
|
85e7952624 | ||
|
|
4b73d4b138 | ||
|
|
862f712852 |
No files matched your search
+19
-13
@@ -26,20 +26,20 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04, windows-2022, macos-14]
|
||||
os: [ubuntu-24.04, windows-2022, macos-15]
|
||||
|
||||
steps:
|
||||
- name: Install SWIG with Homebrew
|
||||
if: matrix.os == 'macos-14' && matrix.enabled
|
||||
if: matrix.os == 'macos-15' && matrix.enabled
|
||||
run: brew install swig
|
||||
|
||||
- name: Checkout rz-bindgen
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
# runned only from workflow_call
|
||||
- name: Checkout rizin
|
||||
if: ${{ inputs.external_call }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
|
||||
- name: Checkout rizin (stable)
|
||||
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
@@ -55,14 +55,14 @@ jobs:
|
||||
|
||||
- name: Checkout rizin (dev)
|
||||
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
ref: dev
|
||||
|
||||
- name: Build rz-bindgen
|
||||
uses: pypa/cibuildwheel@v3.4.1
|
||||
uses: pypa/cibuildwheel@v4.3.5
|
||||
|
||||
- name: Upload sdist
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -81,14 +81,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout rz-bindgen
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
path: rz-bindgen
|
||||
|
||||
# runned only from workflow_call
|
||||
- name: Checkout rizin
|
||||
if: ${{ inputs.external_call }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
|
||||
- name: Checkout rizin (stable)
|
||||
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
|
||||
- name: Checkout rizin (dev)
|
||||
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin
|
||||
path: rizin
|
||||
@@ -132,6 +132,12 @@ jobs:
|
||||
- name: Test python lang plugin
|
||||
run: rizin -qc "Ll" | grep "Python SWIG"
|
||||
|
||||
- name: Checkout our Testsuite Binaries
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: rizinorg/rizin-testbins
|
||||
path: rz-bindgen/test/bins
|
||||
|
||||
- name: Run rz-test
|
||||
run: rz-test -L tests/
|
||||
working-directory: rz-bindgen
|
||||
run: rz-test -L db/examples
|
||||
working-directory: rz-bindgen/test
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout rz-bindgen
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: REUSE compliance check
|
||||
uses: fsfe/reuse-action@v6
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout rz-bindgen
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Install tools
|
||||
run: |
|
||||
pip install mypy pyflakes pylint black
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout rz-bindgen
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
|
||||
@@ -35,6 +35,6 @@ jobs:
|
||||
name: sdist
|
||||
path: dist
|
||||
- name: Publish wheels
|
||||
uses: pypa/[email protected].0
|
||||
uses: pypa/[email protected].3
|
||||
with:
|
||||
password: ${{ secrets.PYPI_TOKEN }}
|
||||
+7
-1
@@ -46,7 +46,13 @@ SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/**"
|
||||
path = "test/db/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
|
||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
||||
|
||||
[[annotations]]
|
||||
path = "test/.gitignore"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
|
||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
||||
|
||||
+2
-2
@@ -35,11 +35,11 @@ fi
|
||||
|
||||
pushd rizin
|
||||
|
||||
if [[ "$OSTYPE" =~ msys* ]]; then
|
||||
if [[ "$OSTYPE" =~ msys|cygwin ]]; then
|
||||
meson setup --buildtype=release --prefix='c:/rizin' --vsenv build
|
||||
meson install -C build
|
||||
else
|
||||
if [[ "$OSTYPE" =~ linux* ]]; then
|
||||
if [[ "$OSTYPE" == linux* ]]; then
|
||||
export CFLAGS="-include linux/limits.h"
|
||||
fi
|
||||
meson setup --buildtype=release --libdir=lib build
|
||||
|
||||
+3
-3
@@ -29,12 +29,12 @@ builder.enable_load_buffer = True
|
||||
plugin = builder.build(CustomBinPlugin())
|
||||
```
|
||||
|
||||
`RzBinPluginBuilder::build` returns an `RzBinPlugin` struct which has the enabled function pointers set to custom C functions which call into the currently active director. Enabling functions is done using variables on the builder which are named the same as their corresponding struct function pointer prefixed with `enable_`. To use the plugin, simply append the struct to `core.bin.plugins`.
|
||||
`RzBinPluginBuilder::build` returns an `RzBinPlugin` struct which has the enabled function pointers set to custom C functions which call into the currently active director. Enabling functions is done using variables on the builder which are named the same as their corresponding struct function pointer prefixed with `enable_`. To use the plugin, simply add the plugin to `core.bin`.
|
||||
|
||||
```py
|
||||
core = rizin.RzCore()
|
||||
plugin.thisown = False
|
||||
core.bin.plugins.append(plugin)
|
||||
core.bin.plugin_add(plugin)
|
||||
```
|
||||
|
||||
Now it is possible to see the `SWIGCustom` plugin when listing the binary plugins with `iL`:
|
||||
@@ -72,7 +72,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
|
||||
|
||||
core = rizin.RzCore()
|
||||
plugin_struct.thisown = False
|
||||
core.bin.plugins.append(plugin_struct)
|
||||
core.bin.plugin_add(plugin_struct)
|
||||
|
||||
# Run rizin and load binary
|
||||
core.bin.force_plugin(plugin.name)
|
||||
|
||||
@@ -30,7 +30,7 @@ builder.enable_load_buffer = True
|
||||
plugin = builder.build(CustomBinPlugin())
|
||||
|
||||
core = rizin.RzCore()
|
||||
core.bin.plugins.append(plugin)
|
||||
core.bin.plugin_add(plugin)
|
||||
|
||||
# Run rizin and load binary
|
||||
core.bin.force_plugin(plugin.name)
|
||||
|
||||
@@ -21,7 +21,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
|
||||
|
||||
core = rizin.RzCore()
|
||||
plugin_struct.thisown = False
|
||||
core.bin.plugins.append(plugin_struct)
|
||||
core.bin.plugin_add(plugin_struct)
|
||||
|
||||
# Run rizin and load binary
|
||||
core.bin.force_plugin(plugin.name)
|
||||
|
||||
@@ -16,6 +16,7 @@ def install_files(scheme):
|
||||
elif file.endswith(".so"):
|
||||
dest_type = 'platlib'
|
||||
install_dir = sysconfig.get_path(dest_type, scheme)
|
||||
os.makedirs(install_dir, exist_ok=True)
|
||||
shutil.copy(file, install_dir)
|
||||
print(f"Installing {os.path.basename(file)} to {install_dir}")
|
||||
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@ environment = { PATH="/opt/rh/llvm-toolset-7.0/root/usr/bin:/opt/rh/llvm-toolset
|
||||
archs = ["x86_64"]
|
||||
|
||||
[tool.cibuildwheel.windows]
|
||||
environment = { CMAKE_PREFIX_PATH="C:/rizin" }
|
||||
environment = { CMAKE_PREFIX_PATH="C:/rizin", PATH="C:/rizin/bin;$PATH" }
|
||||
archs = ["AMD64"]
|
||||
|
||||
[tool.cibuildwheel.macos]
|
||||
environment = { PATH="/opt/homebrew/bin:$PATH", MACOSX_DEPLOYMENT_TARGET="14.0" }
|
||||
environment = { PATH="/opt/homebrew/bin:$PATH", MACOSX_DEPLOYMENT_TARGET="15.0" }
|
||||
|
||||
[project]
|
||||
name = "rz-bindings"
|
||||
|
||||
@@ -42,7 +42,6 @@ class Class:
|
||||
fields: OrderedDict[str, Field]
|
||||
funcs: OrderedDict[str, Func]
|
||||
methods: OrderedDict[str, Func]
|
||||
python_methods: OrderedDict[str, List[str]]
|
||||
|
||||
constructor: Optional[Func]
|
||||
destructor: Optional[Func]
|
||||
@@ -83,7 +82,6 @@ class Class:
|
||||
self.fields = OrderedDict()
|
||||
self.funcs = OrderedDict()
|
||||
self.methods = OrderedDict()
|
||||
self.python_methods = OrderedDict()
|
||||
self.constructor = None
|
||||
self.destructor = None
|
||||
|
||||
@@ -194,17 +192,6 @@ class Class:
|
||||
assert rename not in self.methods
|
||||
self.methods[rename] = method
|
||||
|
||||
def add_python_method(self, decl: str, *lines: str) -> None:
|
||||
"""
|
||||
Add a pure-python method with the given declaration
|
||||
|
||||
Used for protocol methods such as __iter__ and __len__ which
|
||||
have no direct C counterpart. The generated SWIG output wraps
|
||||
these in a %pythoncode block inside the class %extend.
|
||||
"""
|
||||
assert decl not in self.python_methods
|
||||
self.python_methods[decl] = [f"def {decl}:"] + [f" {line}" for line in lines]
|
||||
|
||||
def add_prefixed_methods(self, prefix: str) -> None:
|
||||
"""
|
||||
Add C functions with a given prefix, and that take a
|
||||
|
||||
+7
-57
@@ -51,20 +51,6 @@ def run() -> None:
|
||||
func(Header(translation_unit, builder))
|
||||
|
||||
|
||||
def bind_ht_iterators(ht: Class, prefix: str) -> None:
|
||||
"""
|
||||
Bind the RzIterator-returning helpers shared by every hashtable type
|
||||
(see ht_inc.h). These return an `RzIterator *`, which is bound as an
|
||||
iterable class by ``bind_iterator``.
|
||||
|
||||
``as_iter``/``as_iter_keys`` yield immutable values/keys; ``as_iter_mut``
|
||||
yields mutable values.
|
||||
"""
|
||||
ht.add_method(f"{prefix}as_iter", rename="as_iter")
|
||||
ht.add_method(f"{prefix}as_iter_keys", rename="as_iter_keys")
|
||||
ht.add_method(f"{prefix}as_iter_mut", rename="as_iter_mut")
|
||||
|
||||
|
||||
############
|
||||
# GENERICS #
|
||||
############
|
||||
@@ -151,35 +137,6 @@ def bind_vector(vector_h: Header) -> None:
|
||||
rz_pvector.add_python_method("__iter__(self)", "return RzPVectorIterator(self)")
|
||||
|
||||
|
||||
@threaded_header("rz_util/rz_iterator.h")
|
||||
def bind_iterator(iterator_h: Header) -> None:
|
||||
"""
|
||||
RzIterator
|
||||
|
||||
The generic, lazy Rizin iterator (see rz_iterator.h / iterator.c).
|
||||
Many Rizin functions return an `RzIterator *` (e.g. the hashtable
|
||||
`as_iter*` helpers, `rz_set_*_as_iter`, graph traversals, ...).
|
||||
|
||||
`RzIterator` is type-erased in C: `rz_iterator_next` returns a borrowed
|
||||
`void *`, so elements are yielded as opaque pointers. Binding it as a
|
||||
class makes every such return value directly usable from a `for` loop
|
||||
via the `RzIteratorIterator` python helper, and ties its lifetime to
|
||||
`rz_iterator_free` through the destructor.
|
||||
"""
|
||||
# rz_iterator_new takes C callbacks and cannot be bound
|
||||
iterator_h.ignore("rz_iterator_new")
|
||||
|
||||
rz_iterator = Class(
|
||||
iterator_h,
|
||||
typedef="RzIterator",
|
||||
# Internal state and callbacks, not useful from the guest language
|
||||
ignore_fields={"cur", "u", "next", "free", "free_u"},
|
||||
)
|
||||
rz_iterator.add_method("rz_iterator_next", rename="next")
|
||||
rz_iterator.add_destructor("rz_iterator_free")
|
||||
rz_iterator.add_python_method("__iter__(self)", "return RzIteratorIterator(self)")
|
||||
|
||||
|
||||
###########
|
||||
# HEADERS #
|
||||
###########
|
||||
@@ -477,8 +434,7 @@ def bind_ht_pp(ht_pp_h: Header) -> None:
|
||||
"""
|
||||
ht_pp
|
||||
"""
|
||||
ht_pp = Class(ht_pp_h, typedef="HtPP")
|
||||
bind_ht_iterators(ht_pp, "ht_pp_")
|
||||
Class(ht_pp_h, typedef="HtPP")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_pu.h")
|
||||
@@ -486,8 +442,7 @@ def bind_ht_pu(ht_pu_h: Header) -> None:
|
||||
"""
|
||||
ht_pu
|
||||
"""
|
||||
ht_pu = Class(ht_pu_h, typedef="HtPU")
|
||||
bind_ht_iterators(ht_pu, "ht_pu_")
|
||||
Class(ht_pu_h, typedef="HtPU")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_up.h")
|
||||
@@ -495,8 +450,7 @@ def bind_ht_up(ht_up_h: Header) -> None:
|
||||
"""
|
||||
ht_up
|
||||
"""
|
||||
ht_up = Class(ht_up_h, typedef="HtUP")
|
||||
bind_ht_iterators(ht_up, "ht_up_")
|
||||
Class(ht_up_h, typedef="HtUP")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_uu.h")
|
||||
@@ -504,8 +458,7 @@ def bind_ht_uu(ht_uu_h: Header) -> None:
|
||||
"""
|
||||
ht_uu
|
||||
"""
|
||||
ht_uu = Class(ht_uu_h, typedef="HtUU")
|
||||
bind_ht_iterators(ht_uu, "ht_uu_")
|
||||
Class(ht_uu_h, typedef="HtUU")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_sp.h")
|
||||
@@ -513,8 +466,7 @@ def bind_ht_sp(ht_sp_h: Header) -> None:
|
||||
"""
|
||||
ht_sp
|
||||
"""
|
||||
ht_sp = Class(ht_sp_h, typedef="HtSP")
|
||||
bind_ht_iterators(ht_sp, "ht_sp_")
|
||||
Class(ht_sp_h, typedef="HtSP")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_ss.h")
|
||||
@@ -522,8 +474,7 @@ def bind_ht_ss(ht_ss_h: Header) -> None:
|
||||
"""
|
||||
ht_ss
|
||||
"""
|
||||
ht_ss = Class(ht_ss_h, typedef="HtSS")
|
||||
bind_ht_iterators(ht_ss, "ht_ss_")
|
||||
Class(ht_ss_h, typedef="HtSS")
|
||||
|
||||
|
||||
@threaded_header("rz_util/ht_su.h")
|
||||
@@ -531,5 +482,4 @@ def bind_ht_su(ht_su_h: Header) -> None:
|
||||
"""
|
||||
ht_su
|
||||
"""
|
||||
ht_su = Class(ht_su_h, typedef="HtSU")
|
||||
bind_ht_iterators(ht_su, "ht_su_")
|
||||
Class(ht_su_h, typedef="HtSU")
|
||||
+1
-13
@@ -221,13 +221,7 @@ def write_class(writer: Writer, cls: Class) -> None:
|
||||
writer.line(f'%rename {cls.struct_name}::{field.name} "";')
|
||||
|
||||
# Extension
|
||||
if (
|
||||
len(cls.funcs) != 0
|
||||
or len(cls.methods) != 0
|
||||
or len(cls.python_methods) != 0
|
||||
or cls.constructor
|
||||
or cls.destructor
|
||||
):
|
||||
if len(cls.funcs) != 0 or len(cls.methods) != 0:
|
||||
writer.line(f"%extend {cls.struct_name} {{")
|
||||
with writer.indent():
|
||||
if cls.constructor:
|
||||
@@ -241,12 +235,6 @@ def write_class(writer: Writer, cls: Class) -> None:
|
||||
for name, method in cls.methods.items():
|
||||
write_func(writer, method, name, FuncKind.METHOD)
|
||||
|
||||
for python_lines in cls.python_methods.values():
|
||||
writer.line("%pythoncode %{")
|
||||
with writer.indent():
|
||||
writer.line(*python_lines)
|
||||
writer.line("%}")
|
||||
|
||||
writer.line("}")
|
||||
|
||||
|
||||
|
||||
+23
-33
@@ -110,28 +110,25 @@ def cursor_get_annotations(cursor: Cursor) -> List[str]:
|
||||
]
|
||||
|
||||
|
||||
generic_types = {"RzList", "RzListIter", "RzPVector", "RzVector", "RzGraph", "HtPP"}
|
||||
skip_files = {"ht_inc.c", "ht_inc.h", "rz_th_ht.h", "thread_hash_table.c"}
|
||||
|
||||
|
||||
def check_iterator_comment(comment: str, location: SourceLocation) -> None:
|
||||
"""
|
||||
Validate an RzIterator /*<type>*/ comment.
|
||||
|
||||
RzIterator is type-erased and takes a single element-type parameter
|
||||
(unlike the two-parameter RzGraph/HtPP form). The comment is optional in
|
||||
rizin -- the element type is often not known statically -- so RzIterator is
|
||||
deliberately kept out of `generic_types`. When present, the comment must
|
||||
name exactly one type.
|
||||
"""
|
||||
inner = comment[1:-1].strip()
|
||||
if not inner:
|
||||
warn(f"Type comment at {stringify_location(location)} for RzIterator is empty")
|
||||
elif "," in inner:
|
||||
warn(
|
||||
f"Type comment at {stringify_location(location)} for "
|
||||
f"RzIterator must name exactly one type. Is: '{comment}'"
|
||||
)
|
||||
generic_types = {
|
||||
"RzList",
|
||||
"RzListIter",
|
||||
"RzPVector",
|
||||
"RzVector",
|
||||
"RzGraph",
|
||||
"HtPP",
|
||||
"RzThreadRingBuf",
|
||||
"RzThreadQueue",
|
||||
}
|
||||
skip_files = {
|
||||
"ht_inc.c",
|
||||
"ht_inc.h",
|
||||
"rz_th_ht.h",
|
||||
"rz_th.h",
|
||||
"thread_hash_table.c",
|
||||
"thread_queue.c",
|
||||
"thread_ring_buf.c",
|
||||
}
|
||||
|
||||
|
||||
def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]:
|
||||
@@ -202,12 +199,6 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
|
||||
return None
|
||||
comment = comment[2:-2]
|
||||
|
||||
# Normalize surrounding whitespace so both the compact `/*<T>*/` style and
|
||||
# the space-padded `/* <T> */` style (used by RzIterator helpers) are
|
||||
# recognized. Existing annotations have no padding, so this is a no-op for
|
||||
# them.
|
||||
comment = comment.strip()
|
||||
|
||||
if not comment.startswith("<") or not comment.endswith(">"):
|
||||
if typeref_spelling in generic_types:
|
||||
warn(
|
||||
@@ -216,21 +207,22 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
|
||||
return comment
|
||||
|
||||
# Check pointer (or lack of) and space between pointer
|
||||
if typeref_spelling in {"RzList", "RzListIter", "RzPVector"}:
|
||||
if typeref_spelling in {"RzList", "RzListIter", "RzPVector", "RzThreadQueue"}:
|
||||
if comment[-2] != "*":
|
||||
warn(f"Type comment at {stringify_location(cursor.location)} lacks pointer")
|
||||
elif comment[-3] != " ":
|
||||
warn(
|
||||
f"Type comment at {stringify_location(cursor.location)} lacks space between pointer"
|
||||
)
|
||||
elif typeref_spelling in {"RzVector"}:
|
||||
elif typeref_spelling in {"RzVector", "RzThreadRingBuf"}:
|
||||
if comment[-2] == "*":
|
||||
warn(
|
||||
f"Type comment at {stringify_location(cursor.location)} should not have pointer"
|
||||
)
|
||||
elif typeref_spelling in {"RzGraph", "HtPP"}:
|
||||
if not re.match(
|
||||
r"<(struct )?[A-Za-z0-9_]+ \*, (struct )?[A-Za-z0-9_]+ \*>", comment
|
||||
r"<(struct |const )?[A-Za-z0-9_]+ \*, (struct |const )?[A-Za-z0-9_]+ \*>",
|
||||
comment,
|
||||
):
|
||||
if typeref_spelling == "RzGraph":
|
||||
warn(
|
||||
@@ -253,8 +245,6 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
|
||||
"SdbList",
|
||||
}:
|
||||
pass
|
||||
elif typeref_spelling == "RzIterator":
|
||||
check_iterator_comment(comment, cursor.location)
|
||||
else:
|
||||
warn(
|
||||
f"Type comment at {stringify_location(cursor.location)} "
|
||||
|
||||
@@ -34,23 +34,3 @@ class RzPVectorIterator:
|
||||
data = self.rzpvector.at(self.index)
|
||||
self.index += 1
|
||||
return data
|
||||
|
||||
|
||||
class RzIteratorIterator:
|
||||
def __init__(self, rziterator):
|
||||
self.iter = rziterator
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
if self.iter is None:
|
||||
raise StopIteration
|
||||
data = self.iter.next()
|
||||
if data is None:
|
||||
# Iteration is done: hand ownership of the RzIterator to SWIG so
|
||||
# rz_iterator_free is called once the last reference is dropped.
|
||||
self.iter.thisown = True
|
||||
self.iter = None
|
||||
raise StopIteration
|
||||
return data
|
||||
@@ -0,0 +1 @@
|
||||
/bins
|
||||
@@ -0,0 +1,42 @@
|
||||
NAME=1-rz_core.py =
|
||||
FILE=--
|
||||
CMDS=<<EOF
|
||||
!echo q | python3 ../examples/1-rz_core.py =
|
||||
echo
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
Loaded 1 file(s)
|
||||
Corefile #1 has 1 binfile(s)
|
||||
* malloc://512
|
||||
rizin>
|
||||
EOF
|
||||
EXPECT_ERR=
|
||||
RUN
|
||||
|
||||
NAME=2a-rz_bin_plugin.py
|
||||
FILE=--
|
||||
CMDS=<<EOF
|
||||
!echo q | python3 ../examples/2a-rz_bin_plugin.py bins/elf/analysis/ls-linux64
|
||||
echo
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
name: bins/elf/analysis/ls-linux64
|
||||
size: 121584
|
||||
rizin>
|
||||
EOF
|
||||
EXPECT_ERR=
|
||||
RUN
|
||||
|
||||
NAME=2b-rz_bin_plugin.py
|
||||
FILE=--
|
||||
CMDS=<<EOF
|
||||
!echo q | python3 ../examples/2b-rz_bin_plugin.py bins/pe/hello_world_arm/hello_world_arm64.exe
|
||||
echo
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
name: bins/pe/hello_world_arm/hello_world_arm64.exe
|
||||
size: 8704
|
||||
rizin>
|
||||
EOF
|
||||
EXPECT_ERR=
|
||||
RUN
|
||||
@@ -1,15 +0,0 @@
|
||||
NAME=1-rz_core.py =
|
||||
FILE=--
|
||||
CMDS=<<EOF
|
||||
!echo q | python3 examples/1-rz_core.py =
|
||||
echo
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
Loaded 1 file(s)
|
||||
Corefile #1 has 1 binfile(s)
|
||||
* malloc://512
|
||||
rizin>
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
EOF
|
||||
RUN
|
||||
Reference in new issue
Block a user