1 Commits
Author SHA1 Message Date
Anton Kochkov 93c028f00c Add RzIterator support to the bindgen and linter 2026-06-20 20:40:16 +04:00
20 changed files with 227 additions and 507 deletions

No files matched your search

+14 -20
View File
@@ -26,20 +26,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022, macos-15]
os: [ubuntu-24.04, windows-2022, macos-14]
steps:
- name: Install SWIG with Homebrew
if: matrix.os == 'macos-15' && matrix.enabled
if: matrix.os == 'macos-14' && matrix.enabled
run: brew install swig
- name: Checkout rz-bindgen
uses: actions/checkout@v7
uses: actions/checkout@v6
# runned only from workflow_call
- name: Checkout rizin
if: ${{ inputs.external_call }}
uses: actions/checkout@v7
uses: actions/checkout@v6
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@v7
uses: actions/checkout@v6
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@v7
uses: actions/checkout@v6
with:
repository: rizinorg/rizin
path: rizin
ref: dev
- name: Build rz-bindgen
uses: pypa/cibuildwheel@v4.3.5
uses: pypa/cibuildwheel@v3.4.1
- name: Upload sdist
uses: actions/upload-artifact@v7
@@ -81,14 +81,14 @@ jobs:
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v7
uses: actions/checkout@v6
with:
path: rz-bindgen
# runned only from workflow_call
- name: Checkout rizin
if: ${{ inputs.external_call }}
uses: actions/checkout@v7
uses: actions/checkout@v6
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@v7
uses: actions/checkout@v6
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@v7
uses: actions/checkout@v6
with:
repository: rizinorg/rizin
path: rizin
@@ -114,7 +114,7 @@ jobs:
run: |
sudo apt update
sudo apt-get --assume-yes install cmake swig pkg-config clang libclang-dev llvm wget unzip python3-wheel python3-setuptools build-essential python3-pip
sudo pip3 install meson ninja cle
sudo pip3 install meson ninja
- name: Install rizin
run: |
@@ -132,12 +132,6 @@ 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 db/examples
working-directory: rz-bindgen/test
run: rz-test -L tests/
working-directory: rz-bindgen
+3 -3
View File
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v7
uses: actions/checkout@v6
- 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@v7
uses: actions/checkout@v6
- 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@v7
uses: actions/checkout@v6
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
+1 -1
View File
@@ -35,6 +35,6 @@ jobs:
name: sdist
path: dist
- name: Publish wheels
uses: pypa/[email protected].3
uses: pypa/[email protected].0
with:
password: ${{ secrets.PYPI_TOKEN }}
+1 -7
View File
@@ -46,13 +46,7 @@ SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
SPDX-License-Identifier = "LGPL-3.0-only"
[[annotations]]
path = "test/db/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
SPDX-License-Identifier = "LGPL-3.0-only"
[[annotations]]
path = "test/.gitignore"
path = "tests/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
SPDX-License-Identifier = "LGPL-3.0-only"
+2 -2
View File
@@ -35,11 +35,11 @@ fi
pushd rizin
if [[ "$OSTYPE" =~ msys|cygwin ]]; then
if [[ "$OSTYPE" =~ msys* ]]; 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
+18 -24
View File
@@ -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 add the plugin to `core.bin`.
`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`.
```py
core = rizin.RzCore()
plugin.thisown = False
core.bin.plugin_add(plugin)
core.bin.plugins.append(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.plugin_add(plugin_struct)
core.bin.plugins.append(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
@@ -85,7 +85,6 @@ Here's an example which uses the angr cle binary loader to populate the symbols
```py
import rizin
import sys
import traceback
import cle # https://github.com/angr/cle
@@ -93,8 +92,8 @@ class RzBufferWrapper:
def __init__(self, buf):
self.buf = buf
def seek(self, where, whence=rizin.RZ_BUF_SET):
self.buf.seek(where, whence)
def seek(self, where):
self.buf.seek(where, 0)
def read(self, length=None):
if length is None:
@@ -106,8 +105,6 @@ class RzBufferWrapper:
self.buf.read(b)
return b
def tell(self):
return self.buf.tell()
class CLEBinPlugin(rizin.RzBinPluginDirector):
name = "CLESWIGPlugin"
@@ -118,8 +115,8 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
def load_buffer(self, bf, obj, buf, sdb):
try:
loader = cle.Loader(RzBufferWrapper(buf))
except Exception:
traceback.print_exc()
except Exception as e:
print(e)
return False
self.loader = loader
return True
@@ -128,7 +125,7 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
return self.loader.main_object.linked_base
def symbols(self, bf):
syms = rizin.RzPVector_RzBinSymbol()
syms = rizin.RzList_RzBinSymbol()
for sym in self.loader.main_object.symbols:
binsym = rizin.RzBinSymbol()
@@ -138,11 +135,11 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
binsym.paddr = sym.linked_addr
binsym.vaddr = sym.rebased_addr
binsym.size = sym.size
syms.push(binsym)
syms.append(binsym)
return syms
def sections(self, bf):
sections = rizin.RzPVector_RzBinSection()
sections = rizin.RzList_RzBinSection()
for section in self.loader.main_object.sections:
binsection = rizin.RzBinSection()
binsection.thisown = False
@@ -151,31 +148,28 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
binsection.vsize = section.memsize
binsection.paddr = section.offset
binsection.vaddr = section.vaddr
sections.push(binsection)
sections.append(binsection)
return sections
def maps(self, bf):
# virtual memory mappings
maps = rizin.RzPVector_RzBinMap()
maps = rizin.RzList_RzBinMap()
for segment in self.loader.main_object.segments:
binmap = rizin.RzBinMap()
binmap.thisown = False
binmap.perm = segment.flags # must be readable
binmap.perm = segment.flags # must be readable
binmap.paddr = segment.offset
binmap.psize = segment.filesize
binmap.vaddr = segment.vaddr
binmap.vsize = segment.memsize
maps.push(binmap)
maps.append(binmap)
return maps
def strings(self, bf):
# rz_bin_file_strings
# we search for strings only in data sections instead of everywhere
opt = rizin.RzBinStringSearchOpt()
opt.init()
opt.min_length = 4
opt.mode = rizin.RZ_BIN_STRING_SEARCH_MODE_AUTO
return bf.strings(opt)
# the last parameter enables searching for strings everywhere,
# which we disable to limit to searching only in data sections
return bf.strings(4, False)
def info(self, bf):
info = rizin.RzBinInfo()
@@ -187,7 +181,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CLEBinPlugin)
core = rizin.RzCore()
plugin_struct.thisown = False
core.bin.plugin_add(plugin_struct)
core.bin.plugins.append(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
+1 -1
View File
@@ -30,7 +30,7 @@ builder.enable_load_buffer = True
plugin = builder.build(CustomBinPlugin())
core = rizin.RzCore()
core.bin.plugin_add(plugin)
core.bin.plugins.append(plugin)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
+1 -1
View File
@@ -21,7 +21,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
core = rizin.RzCore()
plugin_struct.thisown = False
core.bin.plugin_add(plugin_struct)
core.bin.plugins.append(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
+14 -20
View File
@@ -5,7 +5,6 @@ SPDX-License-Identifier: LGPL-3.0-only
import rizin
import sys
import traceback
import cle # https://github.com/angr/cle
@@ -13,8 +12,8 @@ class RzBufferWrapper:
def __init__(self, buf):
self.buf = buf
def seek(self, where, whence=rizin.RZ_BUF_SET):
self.buf.seek(where, whence)
def seek(self, where):
self.buf.seek(where, 0)
def read(self, length=None):
if length is None:
@@ -26,8 +25,6 @@ class RzBufferWrapper:
self.buf.read(b)
return b
def tell(self):
return self.buf.tell()
class CLEBinPlugin(rizin.RzBinPluginDirector):
name = "CLESWIGPlugin"
@@ -38,8 +35,8 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
def load_buffer(self, bf, obj, buf, sdb):
try:
loader = cle.Loader(RzBufferWrapper(buf))
except Exception:
traceback.print_exc()
except Exception as e:
print(e)
return False
self.loader = loader
return True
@@ -48,7 +45,7 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
return self.loader.main_object.linked_base
def symbols(self, bf):
syms = rizin.RzPVector_RzBinSymbol()
syms = rizin.RzList_RzBinSymbol()
for sym in self.loader.main_object.symbols:
binsym = rizin.RzBinSymbol()
@@ -58,11 +55,11 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
binsym.paddr = sym.linked_addr
binsym.vaddr = sym.rebased_addr
binsym.size = sym.size
syms.push(binsym)
syms.append(binsym)
return syms
def sections(self, bf):
sections = rizin.RzPVector_RzBinSection()
sections = rizin.RzList_RzBinSection()
for section in self.loader.main_object.sections:
binsection = rizin.RzBinSection()
binsection.thisown = False
@@ -71,12 +68,12 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
binsection.vsize = section.memsize
binsection.paddr = section.offset
binsection.vaddr = section.vaddr
sections.push(binsection)
sections.append(binsection)
return sections
def maps(self, bf):
# virtual memory mappings
maps = rizin.RzPVector_RzBinMap()
maps = rizin.RzList_RzBinMap()
for segment in self.loader.main_object.segments:
binmap = rizin.RzBinMap()
binmap.thisown = False
@@ -85,17 +82,14 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
binmap.psize = segment.filesize
binmap.vaddr = segment.vaddr
binmap.vsize = segment.memsize
maps.push(binmap)
maps.append(binmap)
return maps
def strings(self, bf):
# rz_bin_file_strings
# we search for strings only in data sections instead of everywhere
opt = rizin.RzBinStringSearchOpt()
opt.init()
opt.min_length = 4
opt.mode = rizin.RZ_BIN_STRING_SEARCH_MODE_AUTO
return bf.strings(opt)
# the last parameter enables searching for strings everywhere,
# which we disable to limit to searching only in data sections
return bf.strings(4, False)
def info(self, bf):
info = rizin.RzBinInfo()
@@ -107,7 +101,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CLEBinPlugin)
core = rizin.RzCore()
plugin_struct.thisown = False
core.bin.plugin_add(plugin_struct)
core.bin.plugins.append(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
-1
View File
@@ -16,7 +16,6 @@ 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
View File
@@ -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", PATH="C:/rizin/bin;$PATH" }
environment = { CMAKE_PREFIX_PATH="C:/rizin" }
archs = ["AMD64"]
[tool.cibuildwheel.macos]
environment = { PATH="/opt/homebrew/bin:$PATH", MACOSX_DEPLOYMENT_TARGET="15.0" }
environment = { PATH="/opt/homebrew/bin:$PATH", MACOSX_DEPLOYMENT_TARGET="14.0" }
[project]
name = "rz-bindings"
+13
View File
@@ -42,6 +42,7 @@ 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]
@@ -82,6 +83,7 @@ class Class:
self.fields = OrderedDict()
self.funcs = OrderedDict()
self.methods = OrderedDict()
self.python_methods = OrderedDict()
self.constructor = None
self.destructor = None
@@ -192,6 +194,17 @@ 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
+76 -31
View File
@@ -51,6 +51,20 @@ 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 #
############
@@ -84,6 +98,26 @@ def bind_list(list_h: Header) -> None:
rz_list.add_python_method("__len__(self)", "return self.length()")
rz_list.add_python_method("__iter__(self)", "return RzListIterator(self)")
# Specialized constructors
rz_list.add_specialization_extension(
"RzBinSymbol",
"RzList_RzBinSymbol() {",
" return rz_list_newf((RzListFree)rz_bin_symbol_free);",
"}",
)
rz_list.add_specialization_extension(
"RzBinSection",
"RzList_RzBinSection() {",
" return rz_list_newf((RzListFree)rz_bin_section_free);",
"}",
)
rz_list.add_specialization_extension(
"RzBinMap",
"RzList_RzBinMap() {",
" return rz_list_newf((RzListFree)rz_bin_map_free);",
"}",
)
@threaded_header("rz_vector.h")
def bind_vector(vector_h: Header) -> None:
@@ -116,25 +150,34 @@ def bind_vector(vector_h: Header) -> None:
rz_pvector.add_python_method("__len__(self)", "return self.length()")
rz_pvector.add_python_method("__iter__(self)", "return RzPVectorIterator(self)")
# Specialized constructors
rz_pvector.add_specialization_extension(
"RzBinSymbol",
"RzPVector_RzBinSymbol() {",
" return rz_pvector_new((RzPVectorFree)rz_bin_symbol_free);",
"}",
)
rz_pvector.add_specialization_extension(
"RzBinSection",
"RzPVector_RzBinSection() {",
" return rz_pvector_new((RzPVectorFree)rz_bin_section_free);",
"}",
)
rz_pvector.add_specialization_extension(
"RzBinMap",
"RzPVector_RzBinMap() {",
" return rz_pvector_new((RzPVectorFree)rz_bin_map_free);",
"}",
@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)")
###########
@@ -190,15 +233,10 @@ def bind_asm(asm_h: Header) -> None:
@threaded_header("rz_bin.h")
def bind_bin(bin_h: Header) -> None:
"""
RzBin, RzBinStringSearchOpt
RzBin
"""
bin_h.ignore("rz_bin_version")
rz_bin_string_search_opt = Class(bin_h, typedef="RzBinStringSearchOpt")
rz_bin_string_search_opt.add_prefixed_methods("rz_bin_string_search_opt_")
Enum(bin_h, typedef="RzBinStringSearchMode")
rz_bin_file = Class(bin_h, typedef="RzBinFile")
rz_bin_file.add_prefixed_methods("rz_bin_file_")
@@ -439,7 +477,8 @@ def bind_ht_pp(ht_pp_h: Header) -> None:
"""
ht_pp
"""
Class(ht_pp_h, typedef="HtPP")
ht_pp = Class(ht_pp_h, typedef="HtPP")
bind_ht_iterators(ht_pp, "ht_pp_")
@threaded_header("rz_util/ht_pu.h")
@@ -447,7 +486,8 @@ def bind_ht_pu(ht_pu_h: Header) -> None:
"""
ht_pu
"""
Class(ht_pu_h, typedef="HtPU")
ht_pu = Class(ht_pu_h, typedef="HtPU")
bind_ht_iterators(ht_pu, "ht_pu_")
@threaded_header("rz_util/ht_up.h")
@@ -455,7 +495,8 @@ def bind_ht_up(ht_up_h: Header) -> None:
"""
ht_up
"""
Class(ht_up_h, typedef="HtUP")
ht_up = Class(ht_up_h, typedef="HtUP")
bind_ht_iterators(ht_up, "ht_up_")
@threaded_header("rz_util/ht_uu.h")
@@ -463,7 +504,8 @@ def bind_ht_uu(ht_uu_h: Header) -> None:
"""
ht_uu
"""
Class(ht_uu_h, typedef="HtUU")
ht_uu = Class(ht_uu_h, typedef="HtUU")
bind_ht_iterators(ht_uu, "ht_uu_")
@threaded_header("rz_util/ht_sp.h")
@@ -471,7 +513,8 @@ def bind_ht_sp(ht_sp_h: Header) -> None:
"""
ht_sp
"""
Class(ht_sp_h, typedef="HtSP")
ht_sp = Class(ht_sp_h, typedef="HtSP")
bind_ht_iterators(ht_sp, "ht_sp_")
@threaded_header("rz_util/ht_ss.h")
@@ -479,7 +522,8 @@ def bind_ht_ss(ht_ss_h: Header) -> None:
"""
ht_ss
"""
Class(ht_ss_h, typedef="HtSS")
ht_ss = Class(ht_ss_h, typedef="HtSS")
bind_ht_iterators(ht_ss, "ht_ss_")
@threaded_header("rz_util/ht_su.h")
@@ -487,4 +531,5 @@ def bind_ht_su(ht_su_h: Header) -> None:
"""
ht_su
"""
Class(ht_su_h, typedef="HtSU")
ht_su = Class(ht_su_h, typedef="HtSU")
bind_ht_iterators(ht_su, "ht_su_")
+13 -1
View File
@@ -221,7 +221,13 @@ 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:
if (
len(cls.funcs) != 0
or len(cls.methods) != 0
or len(cls.python_methods) != 0
or cls.constructor
or cls.destructor
):
writer.line(f"%extend {cls.struct_name} {{")
with writer.indent():
if cls.constructor:
@@ -235,6 +241,12 @@ 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("}")
+33 -23
View File
@@ -110,25 +110,28 @@ def cursor_get_annotations(cursor: Cursor) -> List[str]:
]
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",
}
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}'"
)
def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]:
@@ -199,6 +202,12 @@ 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(
@@ -207,22 +216,21 @@ 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", "RzThreadQueue"}:
if typeref_spelling in {"RzList", "RzListIter", "RzPVector"}:
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", "RzThreadRingBuf"}:
elif typeref_spelling in {"RzVector"}:
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 |const )?[A-Za-z0-9_]+ \*, (struct |const )?[A-Za-z0-9_]+ \*>",
comment,
r"<(struct )?[A-Za-z0-9_]+ \*, (struct )?[A-Za-z0-9_]+ \*>", comment
):
if typeref_spelling == "RzGraph":
warn(
@@ -245,6 +253,8 @@ 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)} "
+20
View File
@@ -34,3 +34,23 @@ 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
-1
View File
@@ -29,7 +29,6 @@ void rizin_try_warn_deprecate(const char *name, const char *c_name) {
%pybuffer_binary(const unsigned char *buf, unsigned long long len);
%pybuffer_mutable_binary(unsigned char *buf, int len);
%pybuffer_binary(const unsigned char *buf, int len);
%pybuffer_mutable_binary(uint8_t *buf, uint64_t len);
// CArrays
%include <carrays.i>
-1
View File
@@ -1 +0,0 @@
/bins
-368
View File
@@ -1,368 +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=
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
NAME=3-cle_bin_plugin.py
FILE=--
CMDS=<<EOF
!echo -e "e scr.color=0\ni\nis\niS\noml\niz" | python3 ../examples/3-cle_bin_plugin.py bins/elf/ls
echo
EOF
EXPECT=<<EOF
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> e␍[0x00000000]> e␍␍␍[0x00000000]> e ␍[0x00000000]> e ␍␍␍[0x00000000]> e s␍[0x00000000]> e s␍␍␍[0x00000000]> e sc␍[0x00000000]> e sc␍␍␍[0x00000000]> e scr␍[0x00000000]> e scr␍␍␍[0x00000000]> e scr.␍[0x00000000]> e scr.␍␍␍[0x00000000]> e scr.c␍[0x00000000]> e scr.c␍␍␍[0x00000000]> e scr.co␍[0x00000000]> e scr.co␍␍␍[0x00000000]> e scr.col␍[0x00000000]> e scr.col␍␍␍[0x00000000]> e scr.colo␍[0x00000000]> e scr.colo␍␍␍[0x00000000]> e scr.color␍[0x00000000]> e scr.color␍␍␍[0x00000000]> e scr.color=␍[0x00000000]> e scr.color=␍␍␍[0x00000000]> e scr.color=0␍[0x00000000]> e scr.color=0␍␍[0x00000000]> e scr.color=0
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> i␍[0x00000000]> i␍␍[0x00000000]> i
fd 3
file bins/elf/ls
size 0x219a8
humansz 134.4K
mode r-x
format CLESWIGPlugin
iorw false
block 0x100
type
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> i␍[0x00000000]> i␍␍␍[0x00000000]> is␍[0x00000000]> is␍␍[0x00000000]> is
nth paddr vaddr bind type size lib name
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
0 0x00000000 0x00400000 NONE FUNC 0
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_toupper_loc
0 0x00000000 0x00400000 NONE FUNC 0 getenv
0 0x00000000 0x00400000 NONE FUNC 0 cap_to_text
0 0x00000000 0x00400000 NONE FUNC 0 sigprocmask
0 0x00000000 0x00400000 NONE FUNC 0 __snprintf_chk
0 0x00000000 0x00400000 NONE FUNC 0 raise
0 0x00000000 0x00400000 NONE FUNC 0 free
0 0x00000000 0x00400000 NONE FUNC 0 abort
0 0x00000000 0x00400000 NONE FUNC 0 __errno_location
0 0x00000000 0x00400000 NONE FUNC 0 strncmp
0 0x00000000 0x00400000 NONE FUNC 0 _ITM_deregisterTMCloneTable
0 0x00000000 0x00400000 NONE FUNC 0 localtime_r
0 0x00000000 0x00400000 NONE FUNC 0 _exit
0 0x00000000 0x00400000 NONE FUNC 0 strcpy
0 0x00000000 0x00400000 NONE FUNC 0 __fpending
0 0x00000000 0x00400000 NONE FUNC 0 isatty
0 0x00000000 0x00400000 NONE FUNC 0 sigaction
0 0x00000000 0x00400000 NONE FUNC 0 iswcntrl
0 0x00000000 0x00400000 NONE FUNC 0 wcswidth
0 0x00000000 0x00400000 NONE FUNC 0 localeconv
0 0x00000000 0x00400000 NONE FUNC 0 mbstowcs
0 0x00000000 0x00400000 NONE FUNC 0 readlink
0 0x00000000 0x00400000 NONE FUNC 0 clock_gettime
0 0x00000000 0x00400000 NONE FUNC 0 setenv
0 0x00000000 0x00400000 NONE FUNC 0 textdomain
0 0x00000000 0x00400000 NONE FUNC 0 fclose
0 0x00000000 0x00400000 NONE FUNC 0 opendir
0 0x00000000 0x00400000 NONE FUNC 0 getpwuid
0 0x00000000 0x00400000 NONE FUNC 0 bindtextdomain
0 0x00000000 0x00400000 NONE FUNC 0 dcgettext
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_get_mb_cur_max
0 0x00000000 0x00400000 NONE FUNC 0 strlen
0 0x00000000 0x00400000 NONE FUNC 0 __lxstat
0 0x00000000 0x00400000 NONE FUNC 0 __stack_chk_fail
0 0x00000000 0x00400000 NONE FUNC 0 getopt_long
0 0x00000000 0x00400000 NONE FUNC 0 mbrtowc
0 0x00000000 0x00400000 NONE FUNC 0 strchr
0 0x00000000 0x00400000 NONE FUNC 0 getgrgid
0 0x00000000 0x00400000 NONE FUNC 0 __fxstatat
0 0x00000000 0x00400000 NONE FUNC 0 snprintf
0 0x00000000 0x00400000 NONE FUNC 0 __overflow
0 0x00000000 0x00400000 NONE FUNC 0 strrchr
0 0x00000000 0x00400000 NONE FUNC 0 gmtime_r
0 0x00000000 0x00400000 NONE FUNC 0 lseek
0 0x00000000 0x00400000 NONE FUNC 0 gettimeofday
0 0x00000000 0x00400000 NONE FUNC 0 __assert_fail
0 0x00000000 0x00400000 NONE FUNC 0 __strtoul_internal
0 0x00000000 0x00400000 NONE FUNC 0 fnmatch
0 0x00000000 0x00400000 NONE FUNC 0 memset
0 0x00000000 0x00400000 NONE FUNC 0 ioctl
0 0x00000000 0x00400000 NONE FUNC 0 getcwd
0 0x00000000 0x00400000 NONE FUNC 0 strspn
0 0x00000000 0x00400000 NONE FUNC 0 closedir
0 0x00000000 0x00400000 NONE FUNC 0 __libc_start_main
0 0x00000000 0x00400000 NONE FUNC 0 memcmp
0 0x00000000 0x00400000 NONE FUNC 0 _setjmp
0 0x00000000 0x00400000 NONE FUNC 0 fputs_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 calloc
0 0x00000000 0x00400000 NONE FUNC 0 strcmp
0 0x00000000 0x00400000 NONE FUNC 0 signal
0 0x00000000 0x00400000 NONE FUNC 0 dirfd
0 0x00000000 0x00400000 NONE FUNC 0 getpwnam
0 0x00000000 0x00400000 NONE FUNC 0 __memcpy_chk
0 0x00000000 0x00400000 NONE FUNC 0 sigemptyset
0 0x00000000 0x00400000 NONE FUNC 0 __gmon_start__
0 0x00000000 0x00400000 NONE FUNC 0 memcpy
0 0x00000000 0x00400000 NONE FUNC 0 getgrnam
0 0x00000000 0x00400000 NONE FUNC 0 tzset
0 0x00000000 0x00400000 NONE FUNC 0 fileno
0 0x00000000 0x00400000 NONE FUNC 0 tcgetpgrp
0 0x00000000 0x00400000 NONE FUNC 0 __xstat
0 0x00000000 0x00400000 NONE FUNC 0 readdir
0 0x00000000 0x00400000 NONE FUNC 0 wcwidth
0 0x00000000 0x00400000 NONE FUNC 0 malloc
0 0x00000000 0x00400000 NONE FUNC 0 fflush
0 0x00000000 0x00400000 NONE FUNC 0 nl_langinfo
0 0x00000000 0x00400000 NONE FUNC 0 __fxstat
0 0x00000000 0x00400000 NONE FUNC 0 strcoll
0 0x00000000 0x00400000 NONE FUNC 0 mktime
0 0x00000000 0x00400000 NONE FUNC 0 __freading
0 0x00000000 0x00400000 NONE FUNC 0 fwrite_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 realloc
0 0x00000000 0x00400000 NONE FUNC 0 stpncpy
0 0x00000000 0x00400000 NONE FUNC 0 setlocale
0 0x00000000 0x00400000 NONE FUNC 0 __printf_chk
0 0x00000000 0x00400000 NONE FUNC 0 timegm
0 0x00000000 0x00400000 NONE FUNC 0 strftime
0 0x00000000 0x00400000 NONE FUNC 0 mempcpy
0 0x00000000 0x00400000 NONE FUNC 0 memmove
0 0x00000000 0x00400000 NONE FUNC 0 error
0 0x00000000 0x00400000 NONE FUNC 0 fseeko
0 0x00000000 0x00400000 NONE FUNC 0 cap_get_file
0 0x00000000 0x00400000 NONE FUNC 0 unsetenv
0 0x00000000 0x00400000 NONE FUNC 0 cap_free
0 0x00000000 0x00400000 NONE FUNC 0 strtoul
0 0x00000000 0x00400000 NONE FUNC 0 __cxa_atexit
0 0x00000000 0x00400000 NONE FUNC 0 wcstombs
0 0x00000000 0x00400000 NONE FUNC 0 getxattr
0 0x00000000 0x00400000 NONE FUNC 0 gethostname
0 0x00000000 0x00400000 NONE FUNC 0 sigismember
0 0x00000000 0x00400000 NONE FUNC 0 exit
0 0x00000000 0x00400000 NONE FUNC 0 fwrite
0 0x00000000 0x00400000 NONE FUNC 0 __fprintf_chk
0 0x00000000 0x00400000 NONE FUNC 0 _ITM_registerTMCloneTable
0 0x00000000 0x00400000 NONE FUNC 0 fflush_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 mbsinit
0 0x00000000 0x00400000 NONE FUNC 0 iswprint
0 0x00000000 0x00400000 NONE FUNC 0 __cxa_finalize
0 0x00000000 0x00400000 NONE FUNC 0 sigaddset
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_tolower_loc
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_b_loc
0 0x00000000 0x00400000 NONE FUNC 0 __sprintf_chk
0 0x00000000 0x00400000 NONE FUNC 0
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_toupper_loc
0 0x00000000 0x00400000 NONE FUNC 0 getenv
0 0x00000000 0x00400000 NONE FUNC 0 cap_to_text
0 0x00000000 0x00400000 NONE FUNC 0 sigprocmask
0 0x00000000 0x00400000 NONE FUNC 0 __snprintf_chk
0 0x00000000 0x00400000 NONE FUNC 0 raise
0 0x00000000 0x00400000 NONE FUNC 0 free
0 0x00000000 0x00400000 NONE FUNC 0 abort
0 0x00000000 0x00400000 NONE FUNC 0 __errno_location
0 0x00000000 0x00400000 NONE FUNC 0 strncmp
0 0x00000000 0x00400000 NONE FUNC 0 _ITM_deregisterTMCloneTable
0 0x00000000 0x00400000 NONE FUNC 0 localtime_r
0 0x00000000 0x00400000 NONE FUNC 0 _exit
0 0x00000000 0x00400000 NONE FUNC 0 strcpy
0 0x00000000 0x00400000 NONE FUNC 0 __fpending
0 0x00000000 0x00400000 NONE FUNC 0 isatty
0 0x00000000 0x00400000 NONE FUNC 0 sigaction
0 0x00000000 0x00400000 NONE FUNC 0 iswcntrl
0 0x00000000 0x00400000 NONE FUNC 0 wcswidth
0 0x00000000 0x00400000 NONE FUNC 0 localeconv
0 0x00000000 0x00400000 NONE FUNC 0 mbstowcs
0 0x00000000 0x00400000 NONE FUNC 0 readlink
0 0x00000000 0x00400000 NONE FUNC 0 clock_gettime
0 0x00000000 0x00400000 NONE FUNC 0 setenv
0 0x00000000 0x00400000 NONE FUNC 0 textdomain
0 0x00000000 0x00400000 NONE FUNC 0 fclose
0 0x00000000 0x00400000 NONE FUNC 0 opendir
0 0x00000000 0x00400000 NONE FUNC 0 getpwuid
0 0x00000000 0x00400000 NONE FUNC 0 bindtextdomain
0 0x00000000 0x00400000 NONE FUNC 0 dcgettext
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_get_mb_cur_max
0 0x00000000 0x00400000 NONE FUNC 0 strlen
0 0x00000000 0x00400000 NONE FUNC 0 __lxstat
0 0x00000000 0x00400000 NONE FUNC 0 __stack_chk_fail
0 0x00000000 0x00400000 NONE FUNC 0 getopt_long
0 0x00000000 0x00400000 NONE FUNC 0 mbrtowc
0 0x00000000 0x00400000 NONE FUNC 0 strchr
0 0x00000000 0x00400000 NONE FUNC 0 getgrgid
0 0x00000000 0x00400000 NONE FUNC 0 __fxstatat
0 0x00000000 0x00400000 NONE FUNC 0 snprintf
0 0x00000000 0x00400000 NONE FUNC 0 __overflow
0 0x00000000 0x00400000 NONE FUNC 0 strrchr
0 0x00000000 0x00400000 NONE FUNC 0 gmtime_r
0 0x00000000 0x00400000 NONE FUNC 0 lseek
0 0x00000000 0x00400000 NONE FUNC 0 gettimeofday
0 0x00000000 0x00400000 NONE FUNC 0 __assert_fail
0 0x00000000 0x00400000 NONE FUNC 0 __strtoul_internal
0 0x00000000 0x00400000 NONE FUNC 0 fnmatch
0 0x00000000 0x00400000 NONE FUNC 0 memset
0 0x00000000 0x00400000 NONE FUNC 0 ioctl
0 0x00000000 0x00400000 NONE FUNC 0 getcwd
0 0x00000000 0x00400000 NONE FUNC 0 strspn
0 0x00000000 0x00400000 NONE FUNC 0 closedir
0 0x00000000 0x00400000 NONE FUNC 0 __libc_start_main
0 0x00000000 0x00400000 NONE FUNC 0 memcmp
0 0x00000000 0x00400000 NONE FUNC 0 _setjmp
0 0x00000000 0x00400000 NONE FUNC 0 fputs_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 calloc
0 0x00000000 0x00400000 NONE FUNC 0 strcmp
0 0x00000000 0x00400000 NONE FUNC 0 signal
0 0x00000000 0x00400000 NONE FUNC 0 dirfd
0 0x00000000 0x00400000 NONE FUNC 0 getpwnam
0 0x00000000 0x00400000 NONE FUNC 0 __memcpy_chk
0 0x00000000 0x00400000 NONE FUNC 0 sigemptyset
0 0x00000000 0x00400000 NONE FUNC 0 __gmon_start__
0 0x00000000 0x00400000 NONE FUNC 0 memcpy
0 0x00000000 0x00400000 NONE FUNC 0 getgrnam
0 0x00000000 0x00400000 NONE FUNC 0 tzset
0 0x00000000 0x00400000 NONE FUNC 0 fileno
0 0x00000000 0x00400000 NONE FUNC 0 tcgetpgrp
0 0x00000000 0x00400000 NONE FUNC 0 __xstat
0 0x00000000 0x00400000 NONE FUNC 0 readdir
0 0x00000000 0x00400000 NONE FUNC 0 wcwidth
0 0x00000000 0x00400000 NONE FUNC 0 malloc
0 0x00000000 0x00400000 NONE FUNC 0 fflush
0 0x00000000 0x00400000 NONE FUNC 0 nl_langinfo
0 0x00000000 0x00400000 NONE FUNC 0 __fxstat
0 0x00000000 0x00400000 NONE FUNC 0 strcoll
0 0x00000000 0x00400000 NONE FUNC 0 mktime
0 0x00000000 0x00400000 NONE FUNC 0 __freading
0 0x00000000 0x00400000 NONE FUNC 0 fwrite_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 realloc
0 0x00000000 0x00400000 NONE FUNC 0 stpncpy
0 0x00000000 0x00400000 NONE FUNC 0 setlocale
0 0x00000000 0x00400000 NONE FUNC 0 __printf_chk
0 0x00000000 0x00400000 NONE FUNC 0 timegm
0 0x00000000 0x00400000 NONE FUNC 0 strftime
0 0x00000000 0x00400000 NONE FUNC 0 mempcpy
0 0x00000000 0x00400000 NONE FUNC 0 memmove
0 0x00000000 0x00400000 NONE FUNC 0 error
0 0x00000000 0x00400000 NONE FUNC 0 fseeko
0 0x00000000 0x00400000 NONE FUNC 0 cap_get_file
0 0x00000000 0x00400000 NONE FUNC 0 unsetenv
0 0x00000000 0x00400000 NONE FUNC 0 cap_free
0 0x00000000 0x00400000 NONE FUNC 0 strtoul
0 0x00000000 0x00400000 NONE FUNC 0 __cxa_atexit
0 0x00000000 0x00400000 NONE FUNC 0 wcstombs
0 0x00000000 0x00400000 NONE FUNC 0 getxattr
0 0x00000000 0x00400000 NONE FUNC 0 gethostname
0 0x00000000 0x00400000 NONE FUNC 0 sigismember
0 0x00000000 0x00400000 NONE FUNC 0 exit
0 0x00000000 0x00400000 NONE FUNC 0 fwrite
0 0x00000000 0x00400000 NONE FUNC 0 __fprintf_chk
0 0x00000000 0x00400000 NONE FUNC 0 _ITM_registerTMCloneTable
0 0x00000000 0x00400000 NONE FUNC 0 fflush_unlocked
0 0x00000000 0x00400000 NONE FUNC 0 mbsinit
0 0x00000000 0x00400000 NONE FUNC 0 iswprint
0 0x00000000 0x00400000 NONE FUNC 0 __cxa_finalize
0 0x00000000 0x00400000 NONE FUNC 0 sigaddset
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_tolower_loc
0 0x00000000 0x00400000 NONE FUNC 0 __ctype_b_loc
0 0x00000000 0x00400000 NONE FUNC 0 __sprintf_chk
0 0x00015c80 0x00415c80 NONE FUNC 17 _obstack_begin
0 0x00015c80 0x00415c80 NONE FUNC 17 _obstack_begin
0 0x00015ca0 0x00415ca0 NONE FUNC 21 _obstack_begin_1
0 0x00015ca0 0x00415ca0 NONE FUNC 21 _obstack_begin_1
0 0x00015cc0 0x00415cc0 NONE FUNC 251 _obstack_newchunk
0 0x00015cc0 0x00415cc0 NONE FUNC 251 _obstack_newchunk
0 0x00015dc0 0x00415dc0 NONE FUNC 55 _obstack_allocated_p
0 0x00015dc0 0x00415dc0 NONE FUNC 55 _obstack_allocated_p
0 0x00015e00 0x00415e00 NONE FUNC 101 _obstack_free
0 0x00015e00 0x00415e00 NONE FUNC 101 _obstack_free
0 0x00015e70 0x00415e70 NONE FUNC 41 _obstack_memory_used
0 0x00015e70 0x00415e70 NONE FUNC 41 _obstack_memory_used
0 0x00022260 0x00422260 NONE FUNC 8 obstack_alloc_failed_handler
0 0x00022260 0x00422260 NONE FUNC 8 obstack_alloc_failed_handler
0 0x00022268 0x00422268 NONE FUNC 0 _edata
0 0x00022268 0x00422268 NONE FUNC 0 __bss_start
0 0x00022268 0x00422268 NONE FUNC 0 _edata
0 0x00022268 0x00422268 NONE FUNC 0 __bss_start
0 0x00022280 0x00422280 NONE FUNC 8 __progname
0 0x00022280 0x00422280 NONE FUNC 8 program_invocation_short_name
0 0x00022280 0x00422280 NONE FUNC 8 __progname
0 0x00022280 0x00422280 NONE FUNC 8 program_invocation_short_name
0 0x00022288 0x00422288 NONE FUNC 8 stdout
0 0x00022288 0x00422288 NONE FUNC 8 stdout
0 0x00022290 0x00422290 NONE FUNC 4 optind
0 0x00022290 0x00422290 NONE FUNC 4 optind
0 0x00022298 0x00422298 NONE FUNC 8 optarg
0 0x00022298 0x00422298 NONE FUNC 8 optarg
0 0x000222a0 0x004222a0 NONE FUNC 8 program_invocation_name
0 0x000222a0 0x004222a0 NONE FUNC 8 __progname_full
0 0x000222a0 0x004222a0 NONE FUNC 8 program_invocation_name
0 0x000222a0 0x004222a0 NONE FUNC 8 __progname_full
0 0x000222c0 0x004222c0 NONE FUNC 8 stderr
0 0x000222c0 0x004222c0 NONE FUNC 8 stderr
0 0x00023558 0x00423558 NONE FUNC 0 _end
0 0x00023558 0x00423558 NONE FUNC 0 _end
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> i␍[0x00000000]> i␍␍␍[0x00000000]> iS␍[0x00000000]> iS␍␍[0x00000000]> iS
paddr size vaddr vsize align perm name type flags
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
0x00000000 0x0 0x00400000 0x0 0x0 ----
0x000002a8 0x1c 0x004002a8 0x1c 0x0 ---- .interp
0x000002c4 0x20 0x004002c4 0x20 0x0 ---- .note.ABI-tag
0x000002e4 0x24 0x004002e4 0x24 0x0 ---- .note.gnu.build-id
0x00000308 0xc8 0x00400308 0xc8 0x0 ---- .gnu.hash
0x000003d0 0xc48 0x004003d0 0xc48 0x0 ---- .dynsym
0x00001018 0x5ca 0x00401018 0x5ca 0x0 ---- .dynstr
0x000015e2 0x106 0x004015e2 0x106 0x0 ---- .gnu.version
0x000016e8 0x70 0x004016e8 0x70 0x0 ---- .gnu.version_r
0x00001758 0x1d28 0x00401758 0x1d28 0x0 ---- .rela.dyn
0x00004000 0x1b 0x00404000 0x1b 0x0 ---- .init
0x00004020 0x12763 0x00404020 0x12763 0x0 ---- .text
0x00016784 0xd 0x00416784 0xd 0x0 ---- .fini
0x00017000 0x5109 0x00417000 0x5109 0x0 ---- .rodata
0x0001c10c 0x8c4 0x0041c10c 0x8c4 0x0 ---- .eh_frame_hdr
0x0001c9d0 0x2df0 0x0041c9d0 0x2df0 0x0 ---- .eh_frame
0x00020050 0x8 0x00421050 0x8 0x0 ---- .init_array
0x00020058 0x8 0x00421058 0x8 0x0 ---- .fini_array
0x00020060 0xa38 0x00421060 0xa38 0x0 ---- .data.rel.ro
0x00020a98 0x1c0 0x00421a98 0x1c0 0x0 ---- .dynamic
0x00020c58 0x398 0x00421c58 0x398 0x0 ---- .got
0x00021000 0x268 0x00422000 0x268 0x0 ---- .data
0x00021268 0x12d8 0x00422280 0x12d8 0x0 ---- .bss
0x00021268 0x11 0x00400000 0x11 0x0 ---- .comment
0x00021279 0xed 0x00400000 0xed 0x0 ---- .shstrtab
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> o␍[0x00000000]> o␍␍␍[0x00000000]> om␍[0x00000000]> om␍␍␍[0x00000000]> oml␍[0x00000000]> oml␍␍[0x00000000]> oml
1 fd: 3 +0x00000000 0x00400000 - 0x0040347f r-- fmap.3
2 fd: 3 +0x00004000 0x00404000 - 0x00416790 r-x fmap.3
3 fd: 3 +0x00017000 0x00417000 - 0x0041f7bf r-- fmap.3
4 fd: 3 +0x00020050 0x00421050 - 0x00421fff r-- fmap.3
5 fd: 4 +0x00000000 0x00422268 - 0x00423557 rw-
6 fd: 3 +0x00021000 0x00422000 - 0x00422267 r-- fmap.3
␍␍[0x00000000]> ␍[0x00000000]> ␍␍␍[0x00000000]> i␍[0x00000000]> i␍␍␍[0x00000000]> iz␍[0x00000000]> iz␍␍[0x00000000]> iz
paddr vaddr len size section type string
―――――――――――――――――――――――――――――――――――――――――
␍␍[0x00000000]> ␍[0x00000000]>
EOF
EXPECT_ERR=
RUN
+15
View File
@@ -0,0 +1,15 @@
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