mirror of
https://github.com/rizinorg/rz-bindgen.git
synced 2026-11-09 17:50:46 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8618b4051a |
No files matched your search
@@ -1,7 +0,0 @@
|
|||||||
version: 2
|
|
||||||
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
+18
-28
@@ -1,11 +1,6 @@
|
|||||||
name: build
|
name: build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- stable
|
|
||||||
- 'ci-*'
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -26,20 +21,20 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-24.04, windows-2022, macos-15]
|
os: [ubuntu-24.04, windows-2019, macos-14]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install SWIG with Homebrew
|
- name: Install SWIG with Homebrew
|
||||||
if: matrix.os == 'macos-15' && matrix.enabled
|
if: matrix.os == 'macos-14' && matrix.enabled
|
||||||
run: brew install swig
|
run: brew install swig
|
||||||
|
|
||||||
- name: Checkout rz-bindgen
|
- name: Checkout rz-bindgen
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# runned only from workflow_call
|
# runned only from workflow_call
|
||||||
- name: Checkout rizin
|
- name: Checkout rizin
|
||||||
if: ${{ inputs.external_call }}
|
if: ${{ inputs.external_call }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
@@ -47,7 +42,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout rizin (stable)
|
- name: Checkout rizin (stable)
|
||||||
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
@@ -55,23 +50,23 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout rizin (dev)
|
- name: Checkout rizin (dev)
|
||||||
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Build rz-bindgen
|
- name: Build rz-bindgen
|
||||||
uses: pypa/cibuildwheel@v4.3.5
|
uses: pypa/cibuildwheel@v2.22.0
|
||||||
|
|
||||||
- name: Upload sdist
|
- name: Upload sdist
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: sdist-${{ matrix.os }}
|
name: sdist-${{ matrix.os }}
|
||||||
path: dist/*.tar.gz
|
path: dist/*.tar.gz
|
||||||
|
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wheels-${{ matrix.os }}
|
name: wheels-${{ matrix.os }}
|
||||||
path: wheelhouse/*.whl
|
path: wheelhouse/*.whl
|
||||||
@@ -81,14 +76,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rz-bindgen
|
- name: Checkout rz-bindgen
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: rz-bindgen
|
path: rz-bindgen
|
||||||
|
|
||||||
# runned only from workflow_call
|
# runned only from workflow_call
|
||||||
- name: Checkout rizin
|
- name: Checkout rizin
|
||||||
if: ${{ inputs.external_call }}
|
if: ${{ inputs.external_call }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
@@ -96,7 +91,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout rizin (stable)
|
- name: Checkout rizin (stable)
|
||||||
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
@@ -104,7 +99,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout rizin (dev)
|
- name: Checkout rizin (dev)
|
||||||
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: rizinorg/rizin
|
repository: rizinorg/rizin
|
||||||
path: rizin
|
path: rizin
|
||||||
@@ -114,7 +109,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt update
|
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 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
|
- name: Install rizin
|
||||||
run: |
|
run: |
|
||||||
@@ -132,12 +127,7 @@ jobs:
|
|||||||
- name: Test python lang plugin
|
- name: Test python lang plugin
|
||||||
run: rizin -qc "Ll" | grep "Python SWIG"
|
run: rizin -qc "Ll" | grep "Python SWIG"
|
||||||
|
|
||||||
- name: Checkout our Testsuite Binaries
|
- name: Test rizin.py
|
||||||
uses: actions/checkout@v7
|
run: |
|
||||||
with:
|
echo "import rizin" > testimport.py
|
||||||
repository: rizinorg/rizin-testbins
|
python3 testimport.py
|
||||||
path: rz-bindgen/test/bins
|
|
||||||
|
|
||||||
- name: Run rz-test
|
|
||||||
run: rz-test -L db/examples
|
|
||||||
working-directory: rz-bindgen/test
|
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
name: lint
|
name: lint
|
||||||
on:
|
on: push
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- stable
|
|
||||||
- 'ci-*'
|
|
||||||
pull_request:
|
|
||||||
jobs:
|
jobs:
|
||||||
licenses:
|
licenses:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rz-bindgen
|
- name: Checkout rz-bindgen
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
- name: REUSE compliance check
|
- name: REUSE compliance check
|
||||||
uses: fsfe/reuse-action@v6
|
uses: fsfe/reuse-action@v1
|
||||||
|
|
||||||
python:
|
python:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rz-bindgen
|
- name: Checkout rz-bindgen
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: |
|
run: |
|
||||||
pip install mypy pyflakes pylint black
|
pip install mypy pyflakes pylint black
|
||||||
@@ -46,10 +40,10 @@ jobs:
|
|||||||
security-events: write
|
security-events: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rz-bindgen
|
- name: Checkout rz-bindgen
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v3
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: python
|
languages: python
|
||||||
- name: Run CodeQL
|
- name: Run CodeQL
|
||||||
uses: github/codeql-action/analyze@v4
|
uses: github/codeql-action/analyze@v2
|
||||||
@@ -25,16 +25,16 @@ jobs:
|
|||||||
needs: [build]
|
needs: [build]
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist
|
path: dist
|
||||||
- name: Download sdist
|
- name: Download sdist
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: sdist
|
name: sdist
|
||||||
path: dist
|
path: dist
|
||||||
- name: Publish wheels
|
- name: Publish wheels
|
||||||
uses: pypa/gh-action-pypi-publish@v1.14.3
|
uses: pypa/gh-action-pypi-publish@v1.5.1
|
||||||
with:
|
with:
|
||||||
password: ${{ secrets.PYPI_TOKEN }}
|
password: ${{ secrets.PYPI_TOKEN }}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: rz-bindgen
|
||||||
|
Upstream-Contact: wingdeans <[email protected]>
|
||||||
|
Source: https://github.com/rizinorg/rz-bindgen/
|
||||||
|
|
||||||
|
Files: src/clang/__init__.py src/clang/cindex.py src/clang/enumerations.py
|
||||||
|
Copyright: 2022 The LLVM Project
|
||||||
|
License: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
Files: src/snippets_swig/*
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
|
|
||||||
|
Files: .github/workflows/* .gitignore README.md src/README.md
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
|
|
||||||
|
Files: meson.build plugin/meson.build meson_options.txt
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
|
|
||||||
|
Files: pyproject.toml mypy.ini pylintrc
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
|
|
||||||
|
Files: cutter/PythonConsole.ui cutter/CMakeLists.txt .clang-format
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
|
|
||||||
|
Files: doc/*.md
|
||||||
|
Copyright: 2022 wingdeans <[email protected]>
|
||||||
|
License: LGPL-3.0-only
|
||||||
-64
@@ -1,64 +0,0 @@
|
|||||||
version = 1
|
|
||||||
SPDX-PackageName = "rz-bindgen"
|
|
||||||
SPDX-PackageSupplier = "wingdeans <[email protected]>"
|
|
||||||
SPDX-PackageDownloadLocation = "https://github.com/rizinorg/rz-bindgen/"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["src/clang/__init__.py", "src/clang/cindex.py", "src/clang/enumerations.py"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 The LLVM Project"
|
|
||||||
SPDX-License-Identifier = "Apache-2.0 WITH LLVM-exception"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = "src/snippets_swig/**"
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = [".github/workflows/**", ".gitignore", "README.md", "src/README.md"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["meson.build", "plugin/meson.build", "meson_options.txt"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["pyproject.toml", "mypy.ini", "pylintrc"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["cutter/PythonConsole.ui", "cutter/CMakeLists.txt", ".clang-format"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2022 wingdeans <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = "doc/**.md"
|
|
||||||
precedence = "aggregate"
|
|
||||||
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"
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ".github/**"
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2026 RizinOrg <[email protected]>"
|
|
||||||
SPDX-License-Identifier = "LGPL-3.0-only"
|
|
||||||
+3
-3
@@ -35,15 +35,15 @@ fi
|
|||||||
|
|
||||||
pushd rizin
|
pushd rizin
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ msys|cygwin ]]; then
|
if [[ "$OSTYPE" =~ msys* ]]; then
|
||||||
meson setup --buildtype=release --prefix='c:/rizin' --vsenv build
|
meson setup --buildtype=release --prefix='c:/rizin' --vsenv build
|
||||||
meson install -C build
|
meson install -C build
|
||||||
else
|
else
|
||||||
if [[ "$OSTYPE" == linux* ]]; then
|
if [[ "$OSTYPE" =~ linux* ]]; then
|
||||||
export CFLAGS="-include linux/limits.h"
|
export CFLAGS="-include linux/limits.h"
|
||||||
fi
|
fi
|
||||||
meson setup --buildtype=release --libdir=lib build
|
meson setup --buildtype=release --libdir=lib build
|
||||||
sudo PATH="$PATH" bash -c "meson install -C build"
|
sudo meson install -C build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
+18
-24
@@ -29,12 +29,12 @@ builder.enable_load_buffer = True
|
|||||||
plugin = builder.build(CustomBinPlugin())
|
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
|
```py
|
||||||
core = rizin.RzCore()
|
core = rizin.RzCore()
|
||||||
plugin.thisown = False
|
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`:
|
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()
|
core = rizin.RzCore()
|
||||||
plugin_struct.thisown = False
|
plugin_struct.thisown = False
|
||||||
core.bin.plugin_add(plugin_struct)
|
core.bin.plugins.append(plugin_struct)
|
||||||
|
|
||||||
# Run rizin and load binary
|
# Run rizin and load binary
|
||||||
core.bin.force_plugin(plugin.name)
|
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
|
```py
|
||||||
import rizin
|
import rizin
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
import cle # https://github.com/angr/cle
|
import cle # https://github.com/angr/cle
|
||||||
|
|
||||||
|
|
||||||
@@ -93,8 +92,8 @@ class RzBufferWrapper:
|
|||||||
def __init__(self, buf):
|
def __init__(self, buf):
|
||||||
self.buf = buf
|
self.buf = buf
|
||||||
|
|
||||||
def seek(self, where, whence=rizin.RZ_BUF_SET):
|
def seek(self, where):
|
||||||
self.buf.seek(where, whence)
|
self.buf.seek(where, 0)
|
||||||
|
|
||||||
def read(self, length=None):
|
def read(self, length=None):
|
||||||
if length is None:
|
if length is None:
|
||||||
@@ -106,8 +105,6 @@ class RzBufferWrapper:
|
|||||||
self.buf.read(b)
|
self.buf.read(b)
|
||||||
return b
|
return b
|
||||||
|
|
||||||
def tell(self):
|
|
||||||
return self.buf.tell()
|
|
||||||
|
|
||||||
class CLEBinPlugin(rizin.RzBinPluginDirector):
|
class CLEBinPlugin(rizin.RzBinPluginDirector):
|
||||||
name = "CLESWIGPlugin"
|
name = "CLESWIGPlugin"
|
||||||
@@ -118,8 +115,8 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
def load_buffer(self, bf, obj, buf, sdb):
|
def load_buffer(self, bf, obj, buf, sdb):
|
||||||
try:
|
try:
|
||||||
loader = cle.Loader(RzBufferWrapper(buf))
|
loader = cle.Loader(RzBufferWrapper(buf))
|
||||||
except Exception:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
print(e)
|
||||||
return False
|
return False
|
||||||
self.loader = loader
|
self.loader = loader
|
||||||
return True
|
return True
|
||||||
@@ -128,7 +125,7 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
return self.loader.main_object.linked_base
|
return self.loader.main_object.linked_base
|
||||||
|
|
||||||
def symbols(self, bf):
|
def symbols(self, bf):
|
||||||
syms = rizin.RzPVector_RzBinSymbol()
|
syms = rizin.RzList_RzBinSymbol()
|
||||||
|
|
||||||
for sym in self.loader.main_object.symbols:
|
for sym in self.loader.main_object.symbols:
|
||||||
binsym = rizin.RzBinSymbol()
|
binsym = rizin.RzBinSymbol()
|
||||||
@@ -138,11 +135,11 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
binsym.paddr = sym.linked_addr
|
binsym.paddr = sym.linked_addr
|
||||||
binsym.vaddr = sym.rebased_addr
|
binsym.vaddr = sym.rebased_addr
|
||||||
binsym.size = sym.size
|
binsym.size = sym.size
|
||||||
syms.push(binsym)
|
syms.append(binsym)
|
||||||
return syms
|
return syms
|
||||||
|
|
||||||
def sections(self, bf):
|
def sections(self, bf):
|
||||||
sections = rizin.RzPVector_RzBinSection()
|
sections = rizin.RzList_RzBinSection()
|
||||||
for section in self.loader.main_object.sections:
|
for section in self.loader.main_object.sections:
|
||||||
binsection = rizin.RzBinSection()
|
binsection = rizin.RzBinSection()
|
||||||
binsection.thisown = False
|
binsection.thisown = False
|
||||||
@@ -151,31 +148,28 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
binsection.vsize = section.memsize
|
binsection.vsize = section.memsize
|
||||||
binsection.paddr = section.offset
|
binsection.paddr = section.offset
|
||||||
binsection.vaddr = section.vaddr
|
binsection.vaddr = section.vaddr
|
||||||
sections.push(binsection)
|
sections.append(binsection)
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
def maps(self, bf):
|
def maps(self, bf):
|
||||||
# virtual memory mappings
|
# virtual memory mappings
|
||||||
maps = rizin.RzPVector_RzBinMap()
|
maps = rizin.RzList_RzBinMap()
|
||||||
for segment in self.loader.main_object.segments:
|
for segment in self.loader.main_object.segments:
|
||||||
binmap = rizin.RzBinMap()
|
binmap = rizin.RzBinMap()
|
||||||
binmap.thisown = False
|
binmap.thisown = False
|
||||||
binmap.perm = segment.flags # must be readable
|
binmap.perm = segment.flags # must be readable
|
||||||
binmap.paddr = segment.offset
|
binmap.paddr = segment.offset
|
||||||
binmap.psize = segment.filesize
|
binmap.psize = segment.filesize
|
||||||
binmap.vaddr = segment.vaddr
|
binmap.vaddr = segment.vaddr
|
||||||
binmap.vsize = segment.memsize
|
binmap.vsize = segment.memsize
|
||||||
maps.push(binmap)
|
maps.append(binmap)
|
||||||
return maps
|
return maps
|
||||||
|
|
||||||
def strings(self, bf):
|
def strings(self, bf):
|
||||||
# rz_bin_file_strings
|
# rz_bin_file_strings
|
||||||
# we search for strings only in data sections instead of everywhere
|
# the last parameter enables searching for strings everywhere,
|
||||||
opt = rizin.RzBinStringSearchOpt()
|
# which we disable to limit to searching only in data sections
|
||||||
opt.init()
|
return bf.strings(4, False)
|
||||||
opt.min_length = 4
|
|
||||||
opt.mode = rizin.RZ_BIN_STRING_SEARCH_MODE_AUTO
|
|
||||||
return bf.strings(opt)
|
|
||||||
|
|
||||||
def info(self, bf):
|
def info(self, bf):
|
||||||
info = rizin.RzBinInfo()
|
info = rizin.RzBinInfo()
|
||||||
@@ -187,7 +181,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CLEBinPlugin)
|
|||||||
|
|
||||||
core = rizin.RzCore()
|
core = rizin.RzCore()
|
||||||
plugin_struct.thisown = False
|
plugin_struct.thisown = False
|
||||||
core.bin.plugin_add(plugin_struct)
|
core.bin.plugins.append(plugin_struct)
|
||||||
|
|
||||||
# Run rizin and load binary
|
# Run rizin and load binary
|
||||||
core.bin.force_plugin(plugin.name)
|
core.bin.force_plugin(plugin.name)
|
||||||
|
|||||||
+3
-5
@@ -50,7 +50,6 @@ In the SWIG bindings, these functions are mapped to methods of RzCore.
|
|||||||
|
|
||||||
```py
|
```py
|
||||||
import rizin
|
import rizin
|
||||||
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
|
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
filename = argv[1]
|
filename = argv[1]
|
||||||
@@ -67,8 +66,8 @@ for i, corefile in enumerate(core.files):
|
|||||||
for binfile in corefile.binfiles:
|
for binfile in corefile.binfiles:
|
||||||
print(f" * {binfile.file}")
|
print(f" * {binfile.file}")
|
||||||
|
|
||||||
while core.flush(input("rizin> ")) != CMD_EXIT:
|
while True:
|
||||||
pass
|
core.flush(input("rizin> "))
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's an example session:
|
Here's an example session:
|
||||||
@@ -87,11 +86,10 @@ rizin> aaa
|
|||||||
[x] Applied 0 FLIRT signatures via sigdb
|
[x] Applied 0 FLIRT signatures via sigdb
|
||||||
[x] Propagate noreturn information
|
[x] Propagate noreturn information
|
||||||
[x] Use -AA or aaaa to perform additional experimental analysis.
|
[x] Use -AA or aaaa to perform additional experimental analysis.
|
||||||
rizin> afl
|
> afl
|
||||||
0x0040233e 1 6 entry0
|
0x0040233e 1 6 entry0
|
||||||
0x00402051 3 49 -> 16 sym.HelloWorld::Main
|
0x00402051 3 49 -> 16 sym.HelloWorld::Main
|
||||||
0x0040205f 99 24482 -> 31854 sym.HelloWorld::.ctor
|
0x0040205f 99 24482 -> 31854 sym.HelloWorld::.ctor
|
||||||
rizin> q
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ SPDX-License-Identifier: LGPL-3.0-only
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import rizin
|
import rizin
|
||||||
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
|
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
filename = argv[1]
|
filename = argv[1]
|
||||||
@@ -21,5 +20,5 @@ for i, corefile in enumerate(core.files):
|
|||||||
for binfile in corefile.binfiles:
|
for binfile in corefile.binfiles:
|
||||||
print(f" * {binfile.file}")
|
print(f" * {binfile.file}")
|
||||||
|
|
||||||
while core.flush(input("rizin> ")) != CMD_EXIT:
|
while True:
|
||||||
pass
|
core.flush(input("rizin> "))
|
||||||
@@ -8,10 +8,11 @@ SPDX-License-Identifier: LGPL-3.0-only
|
|||||||
# things, see `2b-rz_bin_plugin.py`
|
# things, see `2b-rz_bin_plugin.py`
|
||||||
|
|
||||||
import rizin
|
import rizin
|
||||||
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
import rizin
|
||||||
|
|
||||||
class CustomBinPlugin(rizin.RzBinPluginDirector):
|
class CustomBinPlugin(rizin.RzBinPluginDirector):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -22,7 +23,6 @@ class CustomBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
print("size: ", bf.size)
|
print("size: ", bf.size)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# Construct the director
|
# Construct the director
|
||||||
builder = rizin.RzBinPluginBuilder()
|
builder = rizin.RzBinPluginBuilder()
|
||||||
builder.name = "SWIGCustom"
|
builder.name = "SWIGCustom"
|
||||||
@@ -30,11 +30,11 @@ builder.enable_load_buffer = True
|
|||||||
plugin = builder.build(CustomBinPlugin())
|
plugin = builder.build(CustomBinPlugin())
|
||||||
|
|
||||||
core = rizin.RzCore()
|
core = rizin.RzCore()
|
||||||
core.bin.plugin_add(plugin)
|
core.bin.plugins.append(plugin)
|
||||||
|
|
||||||
# Run rizin and load binary
|
# Run rizin and load binary
|
||||||
core.bin.force_plugin(plugin.name)
|
core.bin.force_plugin(plugin.name)
|
||||||
core.file_open_load(sys.argv[1])
|
core.file_open_load(sys.argv[1])
|
||||||
|
|
||||||
while core.flush(input("rizin> ")) != CMD_EXIT:
|
while True:
|
||||||
pass
|
core.flush(input("> "))
|
||||||
@@ -4,7 +4,6 @@ SPDX-License-Identifier: LGPL-3.0-only
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import rizin
|
import rizin
|
||||||
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@@ -21,11 +20,11 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
|
|||||||
|
|
||||||
core = rizin.RzCore()
|
core = rizin.RzCore()
|
||||||
plugin_struct.thisown = False
|
plugin_struct.thisown = False
|
||||||
core.bin.plugin_add(plugin_struct)
|
core.bin.plugins.append(plugin_struct)
|
||||||
|
|
||||||
# Run rizin and load binary
|
# Run rizin and load binary
|
||||||
core.bin.force_plugin(plugin.name)
|
core.bin.force_plugin(plugin.name)
|
||||||
core.file_open_load(sys.argv[1])
|
core.file_open_load(sys.argv[1])
|
||||||
|
|
||||||
while core.flush(input("rizin> ")) != CMD_EXIT:
|
while True:
|
||||||
pass
|
core.flush(input("> "))
|
||||||
@@ -5,7 +5,6 @@ SPDX-License-Identifier: LGPL-3.0-only
|
|||||||
|
|
||||||
import rizin
|
import rizin
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
import cle # https://github.com/angr/cle
|
import cle # https://github.com/angr/cle
|
||||||
|
|
||||||
|
|
||||||
@@ -13,8 +12,8 @@ class RzBufferWrapper:
|
|||||||
def __init__(self, buf):
|
def __init__(self, buf):
|
||||||
self.buf = buf
|
self.buf = buf
|
||||||
|
|
||||||
def seek(self, where, whence=rizin.RZ_BUF_SET):
|
def seek(self, where):
|
||||||
self.buf.seek(where, whence)
|
self.buf.seek(where, 0)
|
||||||
|
|
||||||
def read(self, length=None):
|
def read(self, length=None):
|
||||||
if length is None:
|
if length is None:
|
||||||
@@ -26,8 +25,6 @@ class RzBufferWrapper:
|
|||||||
self.buf.read(b)
|
self.buf.read(b)
|
||||||
return b
|
return b
|
||||||
|
|
||||||
def tell(self):
|
|
||||||
return self.buf.tell()
|
|
||||||
|
|
||||||
class CLEBinPlugin(rizin.RzBinPluginDirector):
|
class CLEBinPlugin(rizin.RzBinPluginDirector):
|
||||||
name = "CLESWIGPlugin"
|
name = "CLESWIGPlugin"
|
||||||
@@ -38,8 +35,8 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
def load_buffer(self, bf, obj, buf, sdb):
|
def load_buffer(self, bf, obj, buf, sdb):
|
||||||
try:
|
try:
|
||||||
loader = cle.Loader(RzBufferWrapper(buf))
|
loader = cle.Loader(RzBufferWrapper(buf))
|
||||||
except Exception:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
print(e)
|
||||||
return False
|
return False
|
||||||
self.loader = loader
|
self.loader = loader
|
||||||
return True
|
return True
|
||||||
@@ -48,7 +45,7 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
return self.loader.main_object.linked_base
|
return self.loader.main_object.linked_base
|
||||||
|
|
||||||
def symbols(self, bf):
|
def symbols(self, bf):
|
||||||
syms = rizin.RzPVector_RzBinSymbol()
|
syms = rizin.RzList_RzBinSymbol()
|
||||||
|
|
||||||
for sym in self.loader.main_object.symbols:
|
for sym in self.loader.main_object.symbols:
|
||||||
binsym = rizin.RzBinSymbol()
|
binsym = rizin.RzBinSymbol()
|
||||||
@@ -58,11 +55,11 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
binsym.paddr = sym.linked_addr
|
binsym.paddr = sym.linked_addr
|
||||||
binsym.vaddr = sym.rebased_addr
|
binsym.vaddr = sym.rebased_addr
|
||||||
binsym.size = sym.size
|
binsym.size = sym.size
|
||||||
syms.push(binsym)
|
syms.append(binsym)
|
||||||
return syms
|
return syms
|
||||||
|
|
||||||
def sections(self, bf):
|
def sections(self, bf):
|
||||||
sections = rizin.RzPVector_RzBinSection()
|
sections = rizin.RzList_RzBinSection()
|
||||||
for section in self.loader.main_object.sections:
|
for section in self.loader.main_object.sections:
|
||||||
binsection = rizin.RzBinSection()
|
binsection = rizin.RzBinSection()
|
||||||
binsection.thisown = False
|
binsection.thisown = False
|
||||||
@@ -71,12 +68,12 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
binsection.vsize = section.memsize
|
binsection.vsize = section.memsize
|
||||||
binsection.paddr = section.offset
|
binsection.paddr = section.offset
|
||||||
binsection.vaddr = section.vaddr
|
binsection.vaddr = section.vaddr
|
||||||
sections.push(binsection)
|
sections.append(binsection)
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
def maps(self, bf):
|
def maps(self, bf):
|
||||||
# virtual memory mappings
|
# virtual memory mappings
|
||||||
maps = rizin.RzPVector_RzBinMap()
|
maps = rizin.RzList_RzBinMap()
|
||||||
for segment in self.loader.main_object.segments:
|
for segment in self.loader.main_object.segments:
|
||||||
binmap = rizin.RzBinMap()
|
binmap = rizin.RzBinMap()
|
||||||
binmap.thisown = False
|
binmap.thisown = False
|
||||||
@@ -85,17 +82,14 @@ class CLEBinPlugin(rizin.RzBinPluginDirector):
|
|||||||
binmap.psize = segment.filesize
|
binmap.psize = segment.filesize
|
||||||
binmap.vaddr = segment.vaddr
|
binmap.vaddr = segment.vaddr
|
||||||
binmap.vsize = segment.memsize
|
binmap.vsize = segment.memsize
|
||||||
maps.push(binmap)
|
maps.append(binmap)
|
||||||
return maps
|
return maps
|
||||||
|
|
||||||
def strings(self, bf):
|
def strings(self, bf):
|
||||||
# rz_bin_file_strings
|
# rz_bin_file_strings
|
||||||
# we search for strings only in data sections instead of everywhere
|
# the last parameter enables searching for strings everywhere,
|
||||||
opt = rizin.RzBinStringSearchOpt()
|
# which we disable to limit to searching only in data sections
|
||||||
opt.init()
|
return bf.strings(4, False)
|
||||||
opt.min_length = 4
|
|
||||||
opt.mode = rizin.RZ_BIN_STRING_SEARCH_MODE_AUTO
|
|
||||||
return bf.strings(opt)
|
|
||||||
|
|
||||||
def info(self, bf):
|
def info(self, bf):
|
||||||
info = rizin.RzBinInfo()
|
info = rizin.RzBinInfo()
|
||||||
@@ -107,7 +101,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CLEBinPlugin)
|
|||||||
|
|
||||||
core = rizin.RzCore()
|
core = rizin.RzCore()
|
||||||
plugin_struct.thisown = False
|
plugin_struct.thisown = False
|
||||||
core.bin.plugin_add(plugin_struct)
|
core.bin.plugins.append(plugin_struct)
|
||||||
|
|
||||||
# Run rizin and load binary
|
# Run rizin and load binary
|
||||||
core.bin.force_plugin(plugin.name)
|
core.bin.force_plugin(plugin.name)
|
||||||
|
|||||||
@@ -89,11 +89,6 @@ if target_swig or target_sphinx
|
|||||||
'src/lint.py',
|
'src/lint.py',
|
||||||
'src/main.py',
|
'src/main.py',
|
||||||
'src/writer.py',
|
'src/writer.py',
|
||||||
'src/snippets_swig/cmd_director.i',
|
|
||||||
'src/snippets_swig/iterators.py',
|
|
||||||
'src/snippets_swig/prologue.i',
|
|
||||||
'src/snippets_swig/register_command.py',
|
|
||||||
'src/snippets_swig/register_swig_command.cpp',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bindgen_outputs = custom_target(
|
bindgen_outputs = custom_target(
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ def install_files(scheme):
|
|||||||
elif file.endswith(".so"):
|
elif file.endswith(".so"):
|
||||||
dest_type = 'platlib'
|
dest_type = 'platlib'
|
||||||
install_dir = sysconfig.get_path(dest_type, scheme)
|
install_dir = sysconfig.get_path(dest_type, scheme)
|
||||||
os.makedirs(install_dir, exist_ok=True)
|
|
||||||
shutil.copy(file, install_dir)
|
shutil.copy(file, install_dir)
|
||||||
print(f"Installing {os.path.basename(file)} to {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"]
|
archs = ["x86_64"]
|
||||||
|
|
||||||
[tool.cibuildwheel.windows]
|
[tool.cibuildwheel.windows]
|
||||||
environment = { CMAKE_PREFIX_PATH="C:/rizin", PATH="C:/rizin/bin;$PATH" }
|
environment = { CMAKE_PREFIX_PATH="C:/rizin" }
|
||||||
archs = ["AMD64"]
|
archs = ["AMD64"]
|
||||||
|
|
||||||
[tool.cibuildwheel.macos]
|
[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]
|
[project]
|
||||||
name = "rz-bindings"
|
name = "rz-bindings"
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class Generic:
|
|||||||
|
|
||||||
specializations: Set[str]
|
specializations: Set[str]
|
||||||
|
|
||||||
c_methods: OrderedDict[str, List[str]]
|
|
||||||
python_methods: OrderedDict[str, List[str]]
|
python_methods: OrderedDict[str, List[str]]
|
||||||
specialization_extensions: DefaultDict[str, List[str]]
|
specialization_extensions: DefaultDict[str, List[str]]
|
||||||
|
|
||||||
@@ -50,7 +49,6 @@ class Generic:
|
|||||||
self.methods = OrderedDict()
|
self.methods = OrderedDict()
|
||||||
self.specializations = set()
|
self.specializations = set()
|
||||||
|
|
||||||
self.c_methods = OrderedDict()
|
|
||||||
self.python_methods = OrderedDict()
|
self.python_methods = OrderedDict()
|
||||||
self.specialization_extensions = DefaultDict(list)
|
self.specialization_extensions = DefaultDict(list)
|
||||||
|
|
||||||
@@ -133,15 +131,9 @@ class Generic:
|
|||||||
|
|
||||||
return specialization
|
return specialization
|
||||||
|
|
||||||
def add_c_method(self, name: str, *lines: str) -> None:
|
|
||||||
"""
|
|
||||||
Add C method for name
|
|
||||||
"""
|
|
||||||
self.c_methods[name] = list(lines)
|
|
||||||
|
|
||||||
def add_python_method(self, decl: str, *lines: str) -> None:
|
def add_python_method(self, decl: str, *lines: str) -> None:
|
||||||
"""
|
"""
|
||||||
Add python method with decl
|
Add python function with decl
|
||||||
"""
|
"""
|
||||||
self.python_methods[decl] = [f"def {decl}:"] + [f" {line}" for line in lines]
|
self.python_methods[decl] = [f"def {decl}:"] + [f" {line}" for line in lines]
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,11 @@ def gen_ctype_specializations(cursors: List[Cursor], ctype: CType) -> None:
|
|||||||
# eg. typedef RzVector /*<ut64>*/ (*func)(void)
|
# eg. typedef RzVector /*<ut64>*/ (*func)(void)
|
||||||
gen_ctype_specializations(cursors + [ctype.cursor], ctype.canonical)
|
gen_ctype_specializations(cursors + [ctype.cursor], ctype.canonical)
|
||||||
elif isinstance(ctype, CFunctionType):
|
elif isinstance(ctype, CFunctionType):
|
||||||
cursor_children = list(cursors[-1].get_children())
|
|
||||||
|
|
||||||
# Handle typedef of typedef of a function pointer
|
|
||||||
while (
|
|
||||||
len(cursor_children) == 1 and cursor_children[0].kind == CursorKind.TYPE_REF
|
|
||||||
):
|
|
||||||
cursor_children = list(
|
|
||||||
cursor_children[0].referenced.get_children() # type: ignore[attr-defined]
|
|
||||||
)
|
|
||||||
|
|
||||||
gen_ctype_specializations(cursors, ctype.result)
|
gen_ctype_specializations(cursors, ctype.result)
|
||||||
cursor_args = [
|
cursor_args = [
|
||||||
cursor for cursor in cursor_children if cursor.kind == CursorKind.PARM_DECL
|
cursor
|
||||||
|
for cursor in cursors[-1].get_children()
|
||||||
|
if cursor.kind == CursorKind.PARM_DECL
|
||||||
]
|
]
|
||||||
|
|
||||||
assert len(cursor_args) == len(ctype.args)
|
assert len(cursor_args) == len(ctype.args)
|
||||||
|
|||||||
+53
-49
@@ -63,15 +63,15 @@ def bind_list(list_h: Header) -> None:
|
|||||||
"""
|
"""
|
||||||
### RzListIter ###
|
### RzListIter ###
|
||||||
rz_list_iter = Generic(list_h, "RzListIter", pointer=True)
|
rz_list_iter = Generic(list_h, "RzListIter", pointer=True)
|
||||||
rz_list_iter.add_method("rz_list_next", rename="next", generic_ret=True)
|
rz_list_iter.add_method("rz_list_iter_get_next", rename="next", generic_ret=True)
|
||||||
rz_list_iter.add_method("rz_list_val", rename="data", generic_ret=True)
|
rz_list_iter.add_method("rz_list_iter_get_data", rename="data", generic_ret=True)
|
||||||
|
|
||||||
### RzList ###
|
### RzList ###
|
||||||
rz_list = Generic(list_h, "RzList", dependencies=[rz_list_iter], pointer=True)
|
rz_list = Generic(list_h, "RzList", dependencies=[rz_list_iter], pointer=True)
|
||||||
rz_list.add_method("rz_list_length", rename="length")
|
rz_list.add_method("rz_list_length", rename="length")
|
||||||
|
|
||||||
rz_list.add_method("rz_list_first_val", rename="first", generic_ret=True)
|
rz_list.add_method("rz_list_first", rename="first", generic_ret=True)
|
||||||
rz_list.add_method("rz_list_last_val", rename="last", generic_ret=True)
|
rz_list.add_method("rz_list_last", rename="last", generic_ret=True)
|
||||||
rz_list.add_method("rz_list_iterator", rename="iterator", generic_ret=True)
|
rz_list.add_method("rz_list_iterator", rename="iterator", generic_ret=True)
|
||||||
|
|
||||||
rz_list.add_method(
|
rz_list.add_method(
|
||||||
@@ -84,6 +84,26 @@ def bind_list(list_h: Header) -> None:
|
|||||||
rz_list.add_python_method("__len__(self)", "return self.length()")
|
rz_list.add_python_method("__len__(self)", "return self.length()")
|
||||||
rz_list.add_python_method("__iter__(self)", "return RzListIterator(self)")
|
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")
|
@threaded_header("rz_vector.h")
|
||||||
def bind_vector(vector_h: Header) -> None:
|
def bind_vector(vector_h: Header) -> None:
|
||||||
@@ -116,26 +136,6 @@ def bind_vector(vector_h: Header) -> None:
|
|||||||
rz_pvector.add_python_method("__len__(self)", "return self.length()")
|
rz_pvector.add_python_method("__len__(self)", "return self.length()")
|
||||||
rz_pvector.add_python_method("__iter__(self)", "return RzPVectorIterator(self)")
|
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);",
|
|
||||||
"}",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# HEADERS #
|
# HEADERS #
|
||||||
@@ -150,7 +150,8 @@ def bind_analysis(analysis_h: Header) -> None:
|
|||||||
rz_analysis = Class(
|
rz_analysis = Class(
|
||||||
analysis_h,
|
analysis_h,
|
||||||
typedef="RzAnalysis",
|
typedef="RzAnalysis",
|
||||||
struct="rz_analysis_t",
|
ignore_fields={"leaddrs"},
|
||||||
|
rename_fields={},
|
||||||
)
|
)
|
||||||
|
|
||||||
rz_analysis_function = Class(analysis_h, typedef="RzAnalysisFunction")
|
rz_analysis_function = Class(analysis_h, typedef="RzAnalysisFunction")
|
||||||
@@ -158,10 +159,12 @@ def bind_analysis(analysis_h: Header) -> None:
|
|||||||
rz_analysis_function.add_prefixed_methods("rz_analysis_function_")
|
rz_analysis_function.add_prefixed_methods("rz_analysis_function_")
|
||||||
|
|
||||||
rz_analysis.add_method("rz_analysis_reflines_get", rename="get_reflines")
|
rz_analysis.add_method("rz_analysis_reflines_get", rename="get_reflines")
|
||||||
rz_analysis.add_constructor("rz_analysis_new")
|
rz_analysis.add_prefixed_methods("rz_analysis_")
|
||||||
rz_analysis.add_destructor("rz_analysis_free")
|
rz_analysis.add_prefixed_funcs("rz_analysis_")
|
||||||
|
|
||||||
Class(analysis_h, typedef="RzAnalysisBlock", struct="rz_analysis_bb_t")
|
Class(analysis_h, typedef="RzAnalysisBlock")
|
||||||
|
Class(analysis_h, typedef="RzAnalysisEsil")
|
||||||
|
Class(analysis_h, typedef="RzAnalysisEsilInterState")
|
||||||
Class(analysis_h, typedef="RzAnalysisPlugin")
|
Class(analysis_h, typedef="RzAnalysisPlugin")
|
||||||
|
|
||||||
Class(
|
Class(
|
||||||
@@ -177,28 +180,17 @@ def bind_asm(asm_h: Header) -> None:
|
|||||||
"""
|
"""
|
||||||
RzAsm
|
RzAsm
|
||||||
"""
|
"""
|
||||||
|
Class(asm_h, typedef="RzAsm") # TODO: Add functions
|
||||||
rz_asm = Class(asm_h, typedef="RzAsm", struct="rz_asm_t") # TODO: Add functions
|
|
||||||
rz_asm.add_constructor("rz_asm_new")
|
|
||||||
rz_asm.add_destructor("rz_asm_free")
|
|
||||||
rz_asm.add_prefixed_methods("rz_asm_")
|
|
||||||
rz_asm.add_prefixed_funcs("rz_asm_")
|
|
||||||
|
|
||||||
Class(asm_h, typedef="RzAsmPlugin")
|
Class(asm_h, typedef="RzAsmPlugin")
|
||||||
|
|
||||||
|
|
||||||
@threaded_header("rz_bin.h")
|
@threaded_header("rz_bin.h")
|
||||||
def bind_bin(bin_h: Header) -> None:
|
def bind_bin(bin_h: Header) -> None:
|
||||||
"""
|
"""
|
||||||
RzBin, RzBinStringSearchOpt
|
RzBin
|
||||||
"""
|
"""
|
||||||
bin_h.ignore("rz_bin_version")
|
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 = Class(bin_h, typedef="RzBinFile")
|
||||||
rz_bin_file.add_prefixed_methods("rz_bin_file_")
|
rz_bin_file.add_prefixed_methods("rz_bin_file_")
|
||||||
|
|
||||||
@@ -335,17 +327,29 @@ def bind_core(core_h: Header) -> None:
|
|||||||
|
|
||||||
Class(core_h, typedef="RzCoreFile")
|
Class(core_h, typedef="RzCoreFile")
|
||||||
|
|
||||||
MacroEnum(core_h, prefix="RZ_CORE_CMD_")
|
@threaded_header("rz_util/rz_annotated_code.h")
|
||||||
|
def bind_annotated_code(annotated_code_h: Header) -> None:
|
||||||
|
|
||||||
@threaded_header("rz_esil/rz_esil.h")
|
|
||||||
def bind_esil(esil_h: Header) -> None:
|
|
||||||
"""
|
"""
|
||||||
RzAnalysisEsil
|
RzAnnotatedCode
|
||||||
"""
|
"""
|
||||||
Class(esil_h, typedef="RzAnalysisEsil")
|
rz_code_annotation = Class(
|
||||||
Class(esil_h, typedef="RzAnalysisEsilInterState")
|
annotated_code_h,
|
||||||
|
typedef="RzCodeAnnotation",
|
||||||
|
struct="rz_code_annotation_t",
|
||||||
|
)
|
||||||
|
rz_code_annotation.add_prefixed_methods("rz_annotation_")
|
||||||
|
rz_code_annotation.add_prefixed_funcs("rz_annotation_")
|
||||||
|
|
||||||
|
rz_annotated_code = Class(
|
||||||
|
annotated_code_h,
|
||||||
|
typedef="RzAnnotatedCode",
|
||||||
|
struct="rz_annotated_code_t",
|
||||||
|
)
|
||||||
|
rz_annotated_code.add_constructor("rz_annotated_code_new")
|
||||||
|
rz_annotated_code.add_destructor("rz_annotated_code_free")
|
||||||
|
|
||||||
|
rz_annotated_code.add_prefixed_methods("rz_annotated_code_")
|
||||||
|
rz_annotated_code.add_prefixed_funcs("rz_annotated_code_")
|
||||||
|
|
||||||
@threaded_header("rz_flag.h")
|
@threaded_header("rz_flag.h")
|
||||||
def bind_flag(flag_h: Header) -> None:
|
def bind_flag(flag_h: Header) -> None:
|
||||||
|
|||||||
+14
-14
@@ -110,23 +110,23 @@ class Token:
|
|||||||
extent: SourceRange
|
extent: SourceRange
|
||||||
|
|
||||||
class CursorKind(Enum):
|
class CursorKind(Enum):
|
||||||
INCLUSION_DIRECTIVE: CursorKind
|
INCLUSION_DIRECTIVE: TypeKind
|
||||||
MACRO_INSTANTIATION: CursorKind
|
MACRO_INSTANTIATION: TypeKind
|
||||||
|
|
||||||
ENUM_DECL: CursorKind
|
ENUM_DECL: TypeKind
|
||||||
MACRO_DEFINITION: CursorKind
|
MACRO_DEFINITION: TypeKind
|
||||||
STRUCT_DECL: CursorKind
|
STRUCT_DECL: TypeKind
|
||||||
TYPEDEF_DECL: CursorKind
|
TYPEDEF_DECL: TypeKind
|
||||||
FUNCTION_DECL: CursorKind
|
FUNCTION_DECL: TypeKind
|
||||||
|
|
||||||
FIELD_DECL: CursorKind
|
FIELD_DECL: TypeKind
|
||||||
UNION_DECL: CursorKind
|
UNION_DECL: TypeKind
|
||||||
PARM_DECL: CursorKind
|
PARM_DECL: TypeKind
|
||||||
ENUM_CONSTANT_DECL: CursorKind
|
ENUM_CONSTANT_DECL: TypeKind
|
||||||
|
|
||||||
ANNOTATE_ATTR: CursorKind
|
ANNOTATE_ATTR: TypeKind
|
||||||
TYPE_REF: CursorKind
|
TYPE_REF: TypeKind
|
||||||
PACKED_ATTR: CursorKind
|
PACKED_ATTR: TypeKind
|
||||||
|
|
||||||
class Cursor:
|
class Cursor:
|
||||||
kind: CursorKind
|
kind: CursorKind
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class CFunc(AttrCursor):
|
|||||||
|
|
||||||
|
|
||||||
### Configuration ###
|
### Configuration ###
|
||||||
rizin_include_path: Optional[str] = None # pylint: disable=invalid-name
|
rizin_include_path: Optional[str] = None
|
||||||
clang_args: List[str] = []
|
clang_args: List[str] = []
|
||||||
|
|
||||||
### Headers ###
|
### Headers ###
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ from binding_func import Func
|
|||||||
|
|
||||||
from writer import Writer
|
from writer import Writer
|
||||||
|
|
||||||
doxygen_path: Optional[str] = None # pylint: disable=invalid-name
|
doxygen_path: Optional[str] = None
|
||||||
|
|
||||||
DoxygenElements = Dict[str, Element]
|
DoxygenElements = Dict[str, Element]
|
||||||
|
|
||||||
|
|||||||
@@ -114,9 +114,6 @@ def write_generic(writer: Writer, generic: Generic) -> None:
|
|||||||
for name, method in generic.methods.items():
|
for name, method in generic.methods.items():
|
||||||
write_func(writer, method, name, FuncKind.GENERIC)
|
write_func(writer, method, name, FuncKind.GENERIC)
|
||||||
|
|
||||||
for c_lines in generic.c_methods.values():
|
|
||||||
writer.line(*c_lines)
|
|
||||||
|
|
||||||
for python_lines in generic.python_methods.values():
|
for python_lines in generic.python_methods.values():
|
||||||
writer.line("%pythoncode %{")
|
writer.line("%pythoncode %{")
|
||||||
with writer.indent():
|
with writer.indent():
|
||||||
|
|||||||
+5
-122
@@ -30,11 +30,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import shlex
|
import shlex
|
||||||
import re
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from clang.cindex import (
|
from clang.cindex import (
|
||||||
Config,
|
Config,
|
||||||
@@ -46,30 +44,6 @@ from clang.cindex import (
|
|||||||
SourceLocation,
|
SourceLocation,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Detect /** ... */ or /*! ... */ style Doxygen block comments
|
|
||||||
_DOXY_BLOCK_RE = re.compile(r"/\*[*!][\s\S]*?\*/")
|
|
||||||
|
|
||||||
# Detect consecutive /// or //! style Doxygen line comments
|
|
||||||
_DOXY_LINE_RE = re.compile(r"(?:(?:\/\/[\/!])[^\n]*\n?)+")
|
|
||||||
|
|
||||||
# Match any @-prefixed Doxygen command with word boundary
|
|
||||||
_DOXY_COMMAND_RE = re.compile(r"@(\w+)\b")
|
|
||||||
|
|
||||||
# Map of @-prefixed commands to their correct backslash equivalents
|
|
||||||
_DOXY_COMMANDS = {
|
|
||||||
"param": "\\param",
|
|
||||||
"return": "\\return",
|
|
||||||
"brief": "\\brief",
|
|
||||||
"ref": "\\ref",
|
|
||||||
"p": "\\p",
|
|
||||||
"see": "\\see",
|
|
||||||
"file": "\\file",
|
|
||||||
"ingroup": "\\ingroup",
|
|
||||||
"post": "\\post",
|
|
||||||
"sa": "\\sa",
|
|
||||||
"test": "\\test",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
warnings = set()
|
warnings = set()
|
||||||
|
|
||||||
@@ -83,14 +57,6 @@ def warn(warning: str) -> None:
|
|||||||
warnings.add(warning)
|
warnings.add(warning)
|
||||||
|
|
||||||
|
|
||||||
def location_get_filename(location: SourceLocation) -> str:
|
|
||||||
"""
|
|
||||||
Get filename for a SourceLocation
|
|
||||||
"""
|
|
||||||
path = Path(os.path.abspath(location.file.name))
|
|
||||||
return path.name
|
|
||||||
|
|
||||||
|
|
||||||
def stringify_location(location: SourceLocation) -> str:
|
def stringify_location(location: SourceLocation) -> str:
|
||||||
"""
|
"""
|
||||||
Get <relpath:filename:line> for a SourceLocation
|
Get <relpath:filename:line> for a SourceLocation
|
||||||
@@ -110,25 +76,7 @@ def cursor_get_annotations(cursor: Cursor) -> List[str]:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
generic_types = {
|
generic_types = {"RzList", "RzListIter", "RzPVector", "RzVector", "RzGraph"}
|
||||||
"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]:
|
def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]:
|
||||||
@@ -188,10 +136,7 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
|
|||||||
# Filter out other tokens
|
# Filter out other tokens
|
||||||
comment = token.spelling
|
comment = token.spelling
|
||||||
if not comment.startswith("/*") or not comment.endswith("*/"):
|
if not comment.startswith("/*") or not comment.endswith("*/"):
|
||||||
if (
|
if typeref_spelling in generic_types:
|
||||||
typeref_spelling in generic_types
|
|
||||||
and location_get_filename(cursor.location) not in skip_files
|
|
||||||
):
|
|
||||||
warn(
|
warn(
|
||||||
f"Missing type comment at {stringify_location(cursor.location)} "
|
f"Missing type comment at {stringify_location(cursor.location)} "
|
||||||
"(token is not a comment)"
|
"(token is not a comment)"
|
||||||
@@ -207,34 +152,20 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
|
|||||||
return comment
|
return comment
|
||||||
|
|
||||||
# Check pointer (or lack of) and space between pointer
|
# Check pointer (or lack of) and space between pointer
|
||||||
if typeref_spelling in {"RzList", "RzListIter", "RzPVector", "RzThreadQueue"}:
|
if typeref_spelling in {"RzList", "RzListIter", "RzPVector", "RzGraph"}:
|
||||||
if comment[-2] != "*":
|
if comment[-2] != "*":
|
||||||
warn(f"Type comment at {stringify_location(cursor.location)} lacks pointer")
|
warn(f"Type comment at {stringify_location(cursor.location)} lacks pointer")
|
||||||
elif comment[-3] != " ":
|
elif comment[-3] != " ":
|
||||||
warn(
|
warn(
|
||||||
f"Type comment at {stringify_location(cursor.location)} lacks space between pointer"
|
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] == "*":
|
if comment[-2] == "*":
|
||||||
warn(
|
warn(
|
||||||
f"Type comment at {stringify_location(cursor.location)} should not have pointer"
|
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,
|
|
||||||
):
|
|
||||||
if typeref_spelling == "RzGraph":
|
|
||||||
warn(
|
|
||||||
f"Type comment at {stringify_location(cursor.location)} must "
|
|
||||||
f"follow exactly the pattern '/*<NodeType *, EdgeType *>*/'. Is: '{comment}'"
|
|
||||||
)
|
|
||||||
elif typeref_spelling == "HtPP":
|
|
||||||
warn(
|
|
||||||
f"Type comment at {stringify_location(cursor.location)} must "
|
|
||||||
f"follow exactly the pattern '/*<KeyType *, ValueType *>*/'. Is: '{comment}'"
|
|
||||||
)
|
|
||||||
elif typeref_spelling in {
|
elif typeref_spelling in {
|
||||||
|
"HtPP",
|
||||||
"HtUP",
|
"HtUP",
|
||||||
"HtUU",
|
"HtUU",
|
||||||
"HtPU",
|
"HtPU",
|
||||||
@@ -334,51 +265,6 @@ class Function:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def check_doxygen_syntax(file_path: str, rizin_path: str) -> None:
|
|
||||||
"""
|
|
||||||
Check for incorrect Doxygen syntax in a file.
|
|
||||||
|
|
||||||
Rizin uses backslash syntax (\\param, \\return, etc.)
|
|
||||||
instead of at-sign syntax (@param, @return, etc.).
|
|
||||||
This function scans Doxygen comment blocks and reports any @-prefixed command usage.
|
|
||||||
"""
|
|
||||||
if not (file_path.endswith(".c") or file_path.endswith(".h")):
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
|
|
||||||
content = f.read()
|
|
||||||
except (OSError, IOError):
|
|
||||||
return
|
|
||||||
|
|
||||||
relpath = os.path.relpath(os.path.abspath(file_path), rizin_path)
|
|
||||||
|
|
||||||
comment_matches = list(_DOXY_BLOCK_RE.finditer(content)) + list(
|
|
||||||
_DOXY_LINE_RE.finditer(content)
|
|
||||||
)
|
|
||||||
|
|
||||||
comment_matches.sort(key=lambda m: m.start())
|
|
||||||
|
|
||||||
for match in comment_matches:
|
|
||||||
block_text = match.group(0)
|
|
||||||
block_start_pos = match.start()
|
|
||||||
|
|
||||||
line_offset = content[:block_start_pos].count("\n")
|
|
||||||
|
|
||||||
lines = block_text.splitlines()
|
|
||||||
for line_idx, line in enumerate(lines):
|
|
||||||
for cmd_match in _DOXY_COMMAND_RE.finditer(line):
|
|
||||||
command = cmd_match.group(1).lower()
|
|
||||||
if command in _DOXY_COMMANDS:
|
|
||||||
line_num = line_offset + line_idx + 1
|
|
||||||
column = cmd_match.start() + 1
|
|
||||||
correct_syntax = _DOXY_COMMANDS[command]
|
|
||||||
warn(
|
|
||||||
f"<{relpath}:{line_num}:{column}> "
|
|
||||||
f"Found @{command}, should use {correct_syntax}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def check_translation_unit(
|
def check_translation_unit(
|
||||||
translation_unit: TranslationUnit, *, skipped_paths: Set[str], rizin_path: str
|
translation_unit: TranslationUnit, *, skipped_paths: Set[str], rizin_path: str
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -423,7 +309,6 @@ def check_translation_unit(
|
|||||||
CursorKind.STRUCT_DECL,
|
CursorKind.STRUCT_DECL,
|
||||||
CursorKind.UNION_DECL,
|
CursorKind.UNION_DECL,
|
||||||
CursorKind.ENUM_DECL,
|
CursorKind.ENUM_DECL,
|
||||||
CursorKind.ALIGNED_ATTR,
|
|
||||||
]:
|
]:
|
||||||
warn(f"Unknown field cursor kind: {field.kind}")
|
warn(f"Unknown field cursor kind: {field.kind}")
|
||||||
|
|
||||||
@@ -500,8 +385,6 @@ def main() -> int:
|
|||||||
for include in includes
|
for include in includes
|
||||||
]
|
]
|
||||||
|
|
||||||
check_doxygen_syntax(abspath, rizin_path)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
check_translation_unit(
|
check_translation_unit(
|
||||||
TranslationUnit.from_source(abspath, clang_args),
|
TranslationUnit.from_source(abspath, clang_args),
|
||||||
|
|||||||
@@ -9,27 +9,22 @@ bool rizin_warn_deprecate_instructions = true;
|
|||||||
%{
|
%{
|
||||||
void rizin_try_warn_deprecate(const char *name, const char *c_name) {
|
void rizin_try_warn_deprecate(const char *name, const char *c_name) {
|
||||||
if (rizin_warn_deprecate) {
|
if (rizin_warn_deprecate) {
|
||||||
fprintf(stderr, "Warning: `%s` calls deprecated function `%s`\n", name, c_name);
|
printf("Warning: `%s` calls deprecated function `%s`\n", name, c_name);
|
||||||
if (rizin_warn_deprecate_instructions) {
|
if (rizin_warn_deprecate_instructions) {
|
||||||
fprintf(stderr,
|
puts("To disable this warning, set rizin_warn_deprecate to false");
|
||||||
"To disable this warning, set rizin_warn_deprecate to false\n"
|
puts("The way to do this depends on the SWIG language being used");
|
||||||
"The way to do this depends on the SWIG language being used\n"
|
puts("For python, do `rizin.cvar.rizin_warn_deprecate = False`");
|
||||||
"For python, do `rizin.cvar.rizin_warn_deprecate = False`\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// uint64_t, int64_t etc
|
|
||||||
%include <stdint.i>
|
|
||||||
|
|
||||||
// Buffer typemaps
|
// Buffer typemaps
|
||||||
%include <pybuffer.i>
|
%include <pybuffer.i>
|
||||||
%pybuffer_mutable_binary(unsigned char *buf, unsigned long long len);
|
%pybuffer_mutable_binary(unsigned char *buf, unsigned long long len);
|
||||||
%pybuffer_binary(const unsigned char *buf, unsigned long long len);
|
%pybuffer_binary(const unsigned char *buf, unsigned long long len);
|
||||||
%pybuffer_mutable_binary(unsigned char *buf, int len);
|
%pybuffer_mutable_binary(unsigned char *buf, int len);
|
||||||
%pybuffer_binary(const unsigned char *buf, int len);
|
%pybuffer_binary(const unsigned char *buf, int len);
|
||||||
%pybuffer_mutable_binary(uint8_t *buf, uint64_t len);
|
|
||||||
|
|
||||||
// CArrays
|
// CArrays
|
||||||
%include <carrays.i>
|
%include <carrays.i>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/bins
|
|
||||||
@@ -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
|
|
||||||
[2K␍␍[0m[33m[0x00000000]>[0m ␍[33m[0x00000000]>[0m [2K␍[2K␍␍[0m[33m[0x00000000]>[0m e␍[33m[0x00000000]>[0m e[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e ␍[33m[0x00000000]>[0m e [2K␍[2K␍␍[0m[33m[0x00000000]>[0m e s␍[33m[0x00000000]>[0m e s[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e sc␍[33m[0x00000000]>[0m e sc[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr␍[33m[0x00000000]>[0m e scr[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.␍[33m[0x00000000]>[0m e scr.[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.c␍[33m[0x00000000]>[0m e scr.c[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.co␍[33m[0x00000000]>[0m e scr.co[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.col␍[33m[0x00000000]>[0m e scr.col[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.colo␍[33m[0x00000000]>[0m e scr.colo[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.color␍[33m[0x00000000]>[0m e scr.color[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.color=␍[33m[0x00000000]>[0m e scr.color=[2K␍[2K␍␍[0m[33m[0x00000000]>[0m e scr.color=0␍[33m[0x00000000]>[0m e scr.color=0[2K␍␍[33m[0x00000000]>[0m e scr.color=0
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]> [2K␍[2K␍␍[0x00000000]> i␍[0x00000000]> i[2K␍␍[0x00000000]> i
|
|
||||||
fd 3
|
|
||||||
file bins/elf/ls
|
|
||||||
size 0x219a8
|
|
||||||
humansz 134.4K
|
|
||||||
mode r-x
|
|
||||||
format CLESWIGPlugin
|
|
||||||
iorw false
|
|
||||||
block 0x100
|
|
||||||
type
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]> [2K␍[2K␍␍[0x00000000]> i␍[0x00000000]> i[2K␍[2K␍␍[0x00000000]> is␍[0x00000000]> is[2K␍␍[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
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]> [2K␍[2K␍␍[0x00000000]> i␍[0x00000000]> i[2K␍[2K␍␍[0x00000000]> iS␍[0x00000000]> iS[2K␍␍[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
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]> [2K␍[2K␍␍[0x00000000]> o␍[0x00000000]> o[2K␍[2K␍␍[0x00000000]> om␍[0x00000000]> om[2K␍[2K␍␍[0x00000000]> oml␍[0x00000000]> oml[2K␍␍[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
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]> [2K␍[2K␍␍[0x00000000]> i␍[0x00000000]> i[2K␍[2K␍␍[0x00000000]> iz␍[0x00000000]> iz[2K␍␍[0x00000000]> iz
|
|
||||||
paddr vaddr len size section type string
|
|
||||||
―――――――――――――――――――――――――――――――――――――――――
|
|
||||||
[2K␍␍[0x00000000]> ␍[0x00000000]>
|
|
||||||
EOF
|
|
||||||
EXPECT_ERR=
|
|
||||||
RUN
|
|
||||||
Reference in new issue
Block a user