100 Commits
Author SHA1 Message Date
dependabot[bot] 8b84bc13e7 Bump pypa/cibuildwheel from 4.3.4 to 4.3.5 (#137)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 4.3.4 to 4.3.5.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v4.3.4...v4.3.5)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 4.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-02 22:32:19 +08:00
Khairul Azhar Kasmiran 6a3641cb6d Add test for examples/2b-rz_bin_plugin.py (#136) 2026-10-31 10:51:55 +08:00
dependabot[bot] d74c39e6fa Bump pypa/cibuildwheel from 4.3.1 to 4.3.4 (#134)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 4.3.1 to 4.3.4.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v4.3.1...v4.3.4)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 4.3.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-26 18:56:47 +08:00
dependabot[bot] f36d5c4098 Bump pypa/gh-action-pypi-publish from 1.14.2 to 1.14.3 (#135)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.14.2 to 1.14.3.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.14.2...v1.14.3)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.14.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-26 18:54:50 +08:00
Khairul Azhar Kasmiran 9463be9616 Add test for examples/2a-rz_bin_plugin.py (#133)
* Run tests from inside `tests/`
* Add test for examples/2a-rz_bin_plugin.py
* Move tests to `db/`
* Add `.gitignore` to test dir
* Rename `tests/` dir to `test/`
2026-10-24 14:16:18 +08:00
dependabot[bot] ca552d44d3 Bump pypa/cibuildwheel from 4.2.0 to 4.3.1 (#132)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 4.2.0 to 4.3.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v4.2.0...v4.3.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 4.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-19 18:21:27 +08:00
Khairul Azhar Kasmiran 4d716bce6e py_install.py: Ensure install dir exists (#131) 2026-10-18 19:45:45 +08:00
dependabot[bot]andKhairul Azhar Kasmiran ac2381b166 Bump pypa/cibuildwheel from 3.4.1 to 4.2.0 (#126)
* Bump pypa/cibuildwheel from 3.4.1 to 4.2.0

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 3.4.1 to 4.2.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.4.1...v4.2.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add `C:/rizin/bin` to Windows PATH

* Try using the Linux way for PATH

* Try the Windows way again

* Try combining both Windows and Linux ways

* Use forward slashes instead

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khairul Azhar Kasmiran <[email protected]>
2026-10-15 00:18:16 +08:00
dependabot[bot] da60547435 Bump pypa/gh-action-pypi-publish from 1.14.0 to 1.14.2 (#125)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.14.0 to 1.14.2.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.14.0...v1.14.2)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.14.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-14 18:45:20 +08:00
dependabot[bot] 4518ff76ec Bump actions/checkout from 6 to 7 (#122)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-13 19:42:00 +08:00
Khairul Azhar Kasmiran 85e7952624 Check for cygwin also on Windows build (#130) 2026-10-12 22:40:27 +08:00
Rot127 4b73d4b138 Allow for const qualifiers in linter. (#129) 2026-10-11 16:57:56 +00:00
Rot127 862f712852 Add RzThreadRingBuf and RzThreadQueue to bindgen linter (#127)
* Add RzThreadRingBuf and RzThreadQueue to bindgen linter

* Add rb and queue source files to exception list.
2026-09-23 17:19:59 +00:00
dependabot[bot] 6e305d6fab Bump pypa/cibuildwheel from 3.4.0 to 3.4.1 (#115)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.4.0...v3.4.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.4.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-01 07:42:47 +08:00
Khairul Azhar Kasmiran 6444185df7 Support stdint.h definitions (#118) 2026-05-01 07:39:49 +08:00
dependabot[bot] a0b71b09db Bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0 (#116)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 21:54:01 +08:00
Khairul Azhar Kasmiran 4a31374a3b Fix build due to ESIL refactor (#117) 2026-04-18 20:26:48 +08:00
Rot127 380f6e229c Add type linting for HtPP and RzGraph + fix CI (#114)
* Add type linting for HtPP and RzGraph.

* Add struct, constructor, and destructor of RzAsm to fix forward declaration error.

* Add struct, constructor, and destructor of RzAnalysis to fix forward declaration error.

* Fix incorrect type annotation (they are CursorKind not TypeKind in cindex.py).
2026-04-07 10:58:27 +00:00
dependabot[bot]andKhairul Azhar Kasmiran b2a1f44b82 Bump pypa/cibuildwheel from 3.3.1 to 3.4.0 (#113)
* Bump pypa/cibuildwheel from 3.3.1 to 3.4.0

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v3.3.1...v3.4.0)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Use `build-frontend = "build[uv]"` for faster builds

* Revert "Use `build-frontend = "build[uv]"` for faster builds"

This reverts commit be5566bd2f.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khairul Azhar Kasmiran <[email protected]>
2026-03-09 22:16:08 +08:00
Khairul Azhar Kasmiran b378684805 Add branches filter to on: push: CI (#112) 2026-03-06 19:10:23 +08:00
Khairul Azhar Kasmiran 8aaf3011bd Update CI to windows-2022 (#110) 2026-03-05 22:04:26 +08:00
Khairul Azhar Kasmiran e0ec4912c1 Support typedef of typedef of a function pointer (#111) 2026-03-05 21:25:42 +08:00
dependabot[bot] f7c5a16028 Bump actions/download-artifact from 7 to 8 (#109)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 22:14:56 +08:00
dependabot[bot] fc409dfa10 Bump actions/upload-artifact from 6 to 7 (#108)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 22:13:36 +08:00
Khairul Azhar Kasmiran 220d7a8405 Make bindings to rz_list_val() instead of rz_list_iter_get_data() (#107) 2026-02-11 23:56:50 +08:00
Khairul Azhar Kasmiran 6a7efaab4e rz_list_next: Simplify binding generation (#106) 2026-02-08 14:44:11 +08:00
Khairul Azhar Kasmiran 69302758c8 RzListIter.next: Use rz_list_next() macro instead (#105) 2026-02-05 22:19:13 +08:00
Khairul Azhar Kasmiran 3885561032 Add bindings for RZ_CORE_CMD_ constants (#104) 2026-02-02 19:23:51 +08:00
Khairul Azhar Kasmiran 6fe53b3f73 examples: Allow q to exit prompt loop (#103) 2026-02-01 13:15:01 +08:00
Khairul Azhar Kasmiran 0215843fa6 Remove -C . from CI rz-test invocation (#102) 2026-01-31 16:38:31 +08:00
Khairul Azhar Kasmiran d856543253 Show deprecated warning on stderr instead (#101) 2026-01-29 22:00:44 +08:00
Khairul Azhar Kasmiran ff0cc4a7f8 Add src/snippets_swig/ files to meson.build (#100) 2026-01-28 22:23:17 +08:00
dependabot[bot]andKhairul Azhar Kasmiran e8070500bf Bump fsfe/reuse-action from 1 to 6 (#98)
* Bump fsfe/reuse-action from 1 to 6

Bumps [fsfe/reuse-action](https://github.com/fsfe/reuse-action) from 1 to 6.
- [Release notes](https://github.com/fsfe/reuse-action/releases)
- [Commits](https://github.com/fsfe/reuse-action/compare/v1...v6)

---
updated-dependencies:
- dependency-name: fsfe/reuse-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Upgrade to REUSE.toml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khairul Azhar Kasmiran <[email protected]>
2026-01-26 22:01:42 +08:00
dependabot[bot] 114bd35d25 Bump actions/upload-artifact from 4 to 6 (#99)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-26 19:28:05 +08:00
dependabot[bot]andKhairul Azhar Kasmiran 68e8cd3ad0 Bump pypa/cibuildwheel from 2.22.0 to 3.3.1 (#96)
* Bump pypa/cibuildwheel from 2.22.0 to 3.3.1

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.22.0 to 3.3.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.22.0...v3.3.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 3.3.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

* Pass `PATH` to `sudo`

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khairul Azhar Kasmiran <[email protected]>
2026-01-25 20:48:54 +08:00
dependabot[bot] f51f476a5d Bump github/codeql-action from 2 to 4 (#97)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-25 17:15:16 +08:00
dependabot[bot] b6d4757eba Bump actions/download-artifact from 3 to 7 (#94)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-25 16:50:05 +08:00
dependabot[bot] dc1add8fc3 Bump actions/checkout from 3 to 6 (#93)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-25 16:48:18 +08:00
dependabot[bot] 2610bd4b8e Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.13.0 (#95)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.1 to 1.13.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.1...v1.13.0)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-version: 1.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-25 15:39:49 +08:00
Khairul Azhar Kasmiran f45f5687b1 Add Dependabot for GitHub Actions (#92) 2026-01-25 15:31:23 +08:00
Khairul Azhar Kasmiran 7e7a790d3c Add test for examples/1-rz_core.py (#91) 2026-01-24 17:25:28 +08:00
bubblepipe 8b6d71f3fd add support for alignment (#89) 2026-01-06 17:59:11 +08:00
Khairul Azhar Kasmiran 3f898ed6e6 Run CI on non-rizinorg pull requests (#88) 2026-01-03 00:33:10 +08:00
NOT XVilka 7cb30e15d1 lint: fix formatting (#87) 2026-01-02 23:52:23 +08:00
Khairul Azhar Kasmiran ae7bf29fbf Rename rz_list_iter_get_next() to rz_list_get_next() (#86) 2026-01-02 23:28:38 +08:00
Ayush adf1025286 Add Doxygen syntax linter checking for @ commands (#84) 2026-01-01 23:55:06 +08:00
Khairul Azhar Kasmiran e9fdf80685 Suppress pylint's invalid-name warning (#83) 2025-12-23 20:22:07 +08:00
Khairul Azhar Kasmiran 9fdba22e35 Rename rz_list_first(last) to rz_list_first(last)_val (#82) 2025-12-22 19:38:07 +08:00
Khairul Azhar Kasmiran 318cfbc9b3 Cleanup inclusion of linux/limits.h (#80) 2025-03-16 14:53:25 +08:00
Khairul Azhar Kasmiran 05ce528bc2 ci: Upgrade to Ubuntu 24.04 (Noble) (#79)
* ci: Upgrade to Ubuntu 24.04 (Noble)
* Remove `pip3 --break-system-packages`
* Use `-include linux/limits.h` for Alpine build
2025-03-14 20:18:43 +08:00
Giovanni d9b84f46e7 Fix compilation (#77)
* Fix compilation due defines being redefined
* Add support for TypeKind.FUNCTIONNOPROTO
2025-02-18 15:40:17 +08:00
Anton Kochkov fe8468ea29 ci: use corresponding rizin branch 2024-12-21 20:44:59 +08:00
Anton Kochkov 4e324800d8 ci: use corresponding rizin branch (#75) 2024-12-21 20:11:59 +08:00
Anton Kochkov eecc6bb442 ci/mypy: disable unnecessary warning (#73) 2024-12-21 18:57:35 +08:00
Khairul Azhar Kasmiran b93006e24b Use / instead of \\ in CMAKE_PREFIX_PATH for Windows (#72) 2024-12-21 18:33:10 +08:00
wargio f1dbe864e6 Ensure argument name never matches the function name 2024-12-20 21:51:55 +08:00
wargio 1723f6e06e Revert "Fix wrong check on nonnull args which are inner not outer."
This reverts commit c527db8fcb.
2024-12-20 21:51:55 +08:00
wargio c527db8fcb Fix wrong check on nonnull args which are inner not outer. 2024-12-20 19:47:10 +08:00
Anton Kochkov 918136cbc2 ci: support pip3 for python 3.12 and later 2024-12-20 19:47:10 +08:00
Anton Kochkov 84a9542c9e ci: use macOS 14 as macOS 12 is deprecated 2024-12-20 19:47:10 +08:00
Anton Kochkov b47d3071c2 Update pypa/cibuildwheel to 2.22.0 2024-12-20 19:47:10 +08:00
Anton Kochkov 66f06da3cf Remove lastline from RzCons bindings 2024-12-20 19:47:10 +08:00
Anton Kochkov 8d233afef2 Remove SdbList as it was removed in Rizin (#64) 2024-05-22 22:48:05 +08:00
wargio 3fc9aedc2b Print filename when assert. 2024-05-22 20:35:27 +08:00
Khairul Azhar Kasmiran 046a905246 Uniquify artifact names (#63) 2024-04-19 19:03:47 +08:00
Khairul Azhar Kasmiran d00a7e9174 Use manylinux2014 base image instead (#62)
* Use `manylinux2014` base image instead
* Drop i686 support
2024-04-18 23:40:18 +08:00
Anton Kochkov 52d315929b Fix SWIG snippet example (#61) 2024-04-16 23:38:52 +08:00
pelijah 97d3a2d579 Add missing ht_* headers into cparser_header.py (#60) 2024-04-16 23:20:43 +08:00
Anton Kochkov 4d92885261 ci: update used pypa/cibuildwheel version (#59) 2024-04-16 20:57:16 +08:00
pelijah e106047c66 Add missing HT types to lint.py (#58) 2024-04-16 12:05:27 +03:00
wargio 23dcdda1b0 Revert "Format via black & fix lint check"
This reverts commit aa3340800e.
2024-04-16 11:39:00 +08:00
wargio aa3340800e Format via black & fix lint check 2024-04-16 11:36:06 +08:00
pelijah 438499c470 Add bindings for HtSP, HtSS, HtSU (#57) 2024-04-16 06:30:40 +08:00
Giovanni 1caa6237ee Merge pull request #55 from rizinorg/meson-wheel-option
Add meson option for wheel build
2024-03-15 22:32:29 +08:00
Khairul Azhar Kasmiran 70b2c55651 Add meson option for wheel build 2024-03-15 18:37:56 +08:00
Khairul Azhar Kasmiran 7da2b62917 Fix build fail due to missing rz_analysis_version (#52) 2024-03-11 19:46:09 +08:00
Khairul Azhar Kasmiran a33dca2316 Reformat according to black 24 (#51) 2024-03-10 18:23:05 +08:00
Khairul Azhar Kasmiran d5a3644dde Support user install of swig python module (#50) 2024-03-09 22:50:01 +08:00
Khairul Azhar Kasmiran 6da1edb1fe Fix missing rz_analysis_esil_inter_state_t key (#49) 2024-01-25 14:58:29 +08:00
Giovanni c001b1e7d2 Merge pull request #48 from rizinorg/meson-0.62.2
Bump minimum meson version to 0.62.2
2023-12-06 21:16:33 +08:00
Khairul Azhar Kasmiran 31a887b66d Bump minimum meson version to 0.62.2 2023-12-06 20:11:05 +08:00
Khairul Azhar Kasmiran 012c7073ae Use fetch-depth of 1 (#47) 2023-12-05 20:18:37 +08:00
Giovanni 1afe440947 Merge pull request #46 from rizinorg/ubuntu-default-llvm
Use default LLVM in Ubuntu build
2023-12-03 11:58:55 +08:00
Khairul Azhar Kasmiran 7cb3b801a1 Use gcc to compile 2023-12-03 10:54:06 +08:00
Khairul Azhar Kasmiran 23fe3cdf08 Use default LLVM in Ubuntu build 2023-12-03 10:27:18 +08:00
Khairul Azhar Kasmiran 98ec55469e Add build job ubuntu-llvm-15 (#44) 2023-12-02 22:27:01 +08:00
Khairul Azhar Kasmiran 39c4c75144 Revert "Fix Meson to 1.2.3 (#42)" (#43)
This reverts commit 5f60421e19.
2023-12-02 10:26:30 +08:00
Khairul Azhar Kasmiran 5f60421e19 Fix Meson to 1.2.3 (#42) 2023-11-21 21:27:40 +08:00
Khairul Azhar Kasmiran 4ea002e837 Fix CI images to ubuntu-22.04 and macos-12 (#41) 2023-11-18 22:59:09 +08:00
Khairul Azhar Kasmiran 673bdc320a Make CI job names shorter and more consistent (#40) 2023-11-15 19:01:17 +08:00
Khairul Azhar Kasmiran 601d3025c3 Fix Windows build (#39)
* Add quotation marks around `resource-dir`
* For redefinitions, check also `cursor.kind`
* wrap_type: For non-primitive types, wrap original type
2023-10-30 21:05:20 +08:00
Khairul Azhar Kasmiran b3d654aa08 Disable pylint too-many-arguments warning (#38) 2023-10-27 20:15:29 +08:00
Khairul Azhar Kasmiran 48d8602525 Fix build due to ht_*.h move and non-use of llvm-config (#37) 2023-10-26 23:00:27 +08:00
Anton Kochkov e0f4cb5cea Remove typelink remnants (#33) 2023-08-04 12:37:16 +08:00
Riccardo Schirone 19f9fad430 Fix CI builds (#29)
Change `apt` sources because manylinux_2_24 uses Debian Stretch and the repos are not available anymore
2023-08-02 17:18:07 +08:00
Riccardo Schirone 19b165c789 build: handle the cmake dependency too 2023-04-19 20:59:58 +02:00
Riccardo Schirone 5ab96866a1 Use default llvm/clang in cibw_before_all.sh 2023-04-19 17:26:25 +02:00
Riccardo Schirone b6df7168e1 Use llvm-15 and increase project version 2023-04-17 21:58:35 +02:00
wingdeans c09e93e06e Activate pybuffer typemaps by default
Rather than requiring typemap argument in add_function/add_method
2023-04-14 11:17:30 +02:00
Riccardo Schirone ab25a61ee7 Improve ci release (#25)
* Avoid duplicated workflows
* meson: do not use v prefix
* create sdist on linux
2023-03-07 21:14:39 +01:00
37 changed files with 687 additions and 272 deletions

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
+123 -18
View File
@@ -1,38 +1,143 @@
name: run-rz-bindgen
name: build
on:
push:
paths:
- 'src/**.py'
- 'src/**.pyi'
- 'src/**.i'
- 'meson.build'
- 'meson_options.txt'
branches:
- dev
- stable
- 'ci-*'
pull_request:
workflow_dispatch:
workflow_call:
inputs:
external_call:
description: 'To distinguish workflow_call from regular push'
type: boolean
required: false
default: true
rizin_ref:
required: false
type: string
default: 'dev'
jobs:
run-bindgen:
name: Run bindgen
pypa-wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019, macos-latest]
os: [ubuntu-24.04, windows-2022, macos-14]
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v3
- name: Install SWIG with Homebrew
if: matrix.os == 'macos-14' && matrix.enabled
run: brew install swig
- name: Checkout rz-bindgen
uses: actions/checkout@v7
# runned only from workflow_call
- name: Checkout rizin
uses: actions/checkout@v3
if: ${{ inputs.external_call }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: ${{ inputs.rizin_ref }}
- name: Run rz-bindgen
uses: pypa/[email protected]
- name: Upload artifacts
uses: actions/upload-artifact@v3
- name: Checkout rizin (stable)
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: stable
- name: Checkout rizin (dev)
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: dev
- name: Build rz-bindgen
uses: pypa/[email protected]
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: sdist-${{ matrix.os }}
path: dist/*.tar.gz
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
ubuntu-default-llvm:
runs-on: ubuntu-24.04
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v7
with:
path: rz-bindgen
# runned only from workflow_call
- name: Checkout rizin
if: ${{ inputs.external_call }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: ${{ inputs.rizin_ref }}
- name: Checkout rizin (stable)
if: ${{ !inputs.external_call && ((github.ref_name == 'stable') || (github.base_ref == 'stable')) }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: stable
- name: Checkout rizin (dev)
if: ${{ !inputs.external_call && ((github.ref_name != 'stable') && (github.base_ref != 'stable')) }}
uses: actions/checkout@v7
with:
repository: rizinorg/rizin
path: rizin
ref: dev
- name: Install dependencies
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
- name: Install rizin
run: |
export PATH=$PATH:/usr/local/bin
meson setup --prefix=/usr --buildtype=release build && ninja -C build && sudo ninja -C build install
working-directory: rizin
- name: Build rz-bindgen
run: |
meson setup --prefix=/usr -Dplugin=enabled build
meson compile -C build
sudo meson install -C build
working-directory: rz-bindgen
- 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
+18 -12
View File
@@ -1,25 +1,31 @@
name: linting
on: push
name: lint
on:
push:
branches:
- dev
- stable
- 'ci-*'
pull_request:
jobs:
licenses:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: REUSE compliance check
uses: fsfe/reuse-action@v1
uses: fsfe/reuse-action@v6
python:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Install tools
run: |
pip install mypy pyflakes pylint black
- name: Run mypy
run: |
mypy src/main.py
mypy --disable-error-code misc src/main.py
if: ${{ always() }}
- name: Run pyflakes
run: |
@@ -35,15 +41,15 @@ jobs:
if: ${{ always() }}
codeql:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
security-events: write
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v4
with:
languages: python
- name: Run CodeQL
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v4
+23 -33
View File
@@ -1,50 +1,40 @@
name: release-rz-bindgen
name: release
on:
push:
tags:
- v*
- rizin-v*_*
workflow_dispatch:
jobs:
run-bindgen:
name: Run bindgen
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019, macos-latest]
extract-rizin-version:
runs-on: ubuntu-24.04
outputs:
rizin_version: ${{ steps.extract_version.outputs.result }}
steps:
- name: Checkout rz-bindgen
uses: actions/checkout@v3
- id: extract_version
run: echo "result=$(echo ${{ github.ref }} | cut -d'_' -f1 | cut -d'-' -f2-)" >> "$GITHUB_OUTPUT"
- name: Checkout rizin
uses: actions/checkout@v3
with:
repository: rizinorg/rizin
path: rizin
ref: ${{ github.ref }}
- name: Run rz-bindgen
uses: pypa/[email protected]
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
build:
uses: ./.github/workflows/ci.yml
needs: [extract-rizin-version]
with:
rizin_ref: ${{ needs.extract-rizin-version.outputs.rizin_version }}
publish-pypi:
name: Publish PyPi
runs-on: ubuntu-latest
needs: [run-bindgen]
runs-on: ubuntu-24.04
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v8
with:
name: artifact
name: wheels
path: dist
- name: Download sdist
uses: actions/download-artifact@v8
with:
name: sdist
path: dist
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@v1.5.1
uses: pypa/gh-action-pypi-publish@v1.14.3
with:
password: ${{ secrets.PYPI_TOKEN }}
-32
View File
@@ -1,32 +0,0 @@
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
+2 -2
View File
@@ -9,9 +9,9 @@ For usage information, see [the documentation](doc/README.md).
## Building python plugin
Requirements:
- rizin > 0.4.1 (needs commit [59b38e6](https://github.com/rizinorg/rizin/commit/59b38e6efaf00b9b9869e0ec5baba4f1b9605f37))
- meson
- meson >= 1.1.0
- ninja
- python >= 3.7
- python >= 3.10
- libclang
- SWIG
+64
View File
@@ -0,0 +1,64 @@
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"
+37 -6
View File
@@ -4,21 +4,52 @@
set -ex
# Install deps
pip3 install meson ninja meson-python
pygt311=$(python3 -c 'import sys; print(0) if sys.version_info.minor > 11 else print(1)' 2>&1)
if [[ $pygt311 == '0' ]]; then
pip3 install --break-system-packages meson ninja meson-python build
else
pip3 install meson ninja meson-python build
fi
if command -v apt; then
apt update && apt install --assume-yes libclang-7-dev clang-7 llvm-7
if command -v brew; then
brew install --require-sha swig
elif command -v apt; then
set +e
grep VERSION_CODENAME=stretch /etc/os-release >/dev/null 2>/dev/null
if [[ $? == 0 ]] ; then
# Required because manylinux_2_24 uses Debian Stretch and the repos are not available anymore
echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
echo "Acquire::Check-Valid-Until no;" > /etc/apt/apt.conf.d/99no-check-valid-until
fi
set -e
apt update && apt install --assume-yes libclang-7-dev clang-7 llvm-7 sudo
elif command -v apk; then
apk update && apk add clang-dev
apk update && apk add clang-dev sudo
elif command -v yum; then
yum -y install llvm-toolset-7.0 llvm-toolset-7.0-llvm-devel sudo
# (CentOS 7) Uncomment following lines to see required paths in build log:
# yum -y install centos-release-scl
# source scl_source enable llvm-toolset-7.0 || true
fi
pushd rizin
if [[ "$OSTYPE" =~ msys* ]]; then
if [[ "$OSTYPE" =~ msys|cygwin ]]; then
meson setup --buildtype=release --prefix='c:/rizin' --vsenv build
meson install -C build
else
if [[ "$OSTYPE" == linux* ]]; then
export CFLAGS="-include linux/limits.h"
fi
meson setup --buildtype=release --libdir=lib build
sudo PATH="$PATH" bash -c "meson install -C build"
fi
meson install -C build
popd
if command -v apt; then
if [ ! -e dist/*.tar.gz ] ; then
python3 -m build --sdist
fi
fi
+3 -3
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 append the struct to `core.bin.plugins`.
`RzBinPluginBuilder::build` returns an `RzBinPlugin` struct which has the enabled function pointers set to custom C functions which call into the currently active director. Enabling functions is done using variables on the builder which are named the same as their corresponding struct function pointer prefixed with `enable_`. To use the plugin, simply add the plugin to `core.bin`.
```py
core = rizin.RzCore()
plugin.thisown = False
core.bin.plugins.append(plugin)
core.bin.plugin_add(plugin)
```
Now it is possible to see the `SWIGCustom` plugin when listing the binary plugins with `iL`:
@@ -72,7 +72,7 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
core = rizin.RzCore()
plugin_struct.thisown = False
core.bin.plugins.append(plugin_struct)
core.bin.plugin_add(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
+5 -3
View File
@@ -50,6 +50,7 @@ In the SWIG bindings, these functions are mapped to methods of RzCore.
```py
import rizin
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
from sys import argv
filename = argv[1]
@@ -66,8 +67,8 @@ for i, corefile in enumerate(core.files):
for binfile in corefile.binfiles:
print(f" * {binfile.file}")
while True:
core.flush(input("rizin> "))
while core.flush(input("rizin> ")) != CMD_EXIT:
pass
```
Here's an example session:
@@ -86,10 +87,11 @@ rizin> aaa
[x] Applied 0 FLIRT signatures via sigdb
[x] Propagate noreturn information
[x] Use -AA or aaaa to perform additional experimental analysis.
> afl
rizin> afl
0x0040233e 1 6 entry0
0x00402051 3 49 -> 16 sym.HelloWorld::Main
0x0040205f 99 24482 -> 31854 sym.HelloWorld::.ctor
rizin> q
```
### Plugins
+3 -2
View File
@@ -4,6 +4,7 @@ SPDX-License-Identifier: LGPL-3.0-only
"""
import rizin
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
from sys import argv
filename = argv[1]
@@ -20,5 +21,5 @@ for i, corefile in enumerate(core.files):
for binfile in corefile.binfiles:
print(f" * {binfile.file}")
while True:
core.flush(input("rizin> "))
while core.flush(input("rizin> ")) != CMD_EXIT:
pass
+5 -5
View File
@@ -8,11 +8,10 @@ SPDX-License-Identifier: LGPL-3.0-only
# things, see `2b-rz_bin_plugin.py`
import rizin
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
import sys
import rizin
class CustomBinPlugin(rizin.RzBinPluginDirector):
def __init__(self):
super().__init__()
@@ -23,6 +22,7 @@ class CustomBinPlugin(rizin.RzBinPluginDirector):
print("size: ", bf.size)
return True
# Construct the director
builder = rizin.RzBinPluginBuilder()
builder.name = "SWIGCustom"
@@ -30,11 +30,11 @@ builder.enable_load_buffer = True
plugin = builder.build(CustomBinPlugin())
core = rizin.RzCore()
core.bin.plugins.append(plugin)
core.bin.plugin_add(plugin)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
core.file_open_load(sys.argv[1])
while True:
core.flush(input("> "))
while core.flush(input("rizin> ")) != CMD_EXIT:
pass
+4 -3
View File
@@ -4,6 +4,7 @@ SPDX-License-Identifier: LGPL-3.0-only
"""
import rizin
from rizin import RZ_CORE_CMD_EXIT as CMD_EXIT
import sys
@@ -20,11 +21,11 @@ plugin, plugin_struct = rizin.register_RzBinPlugin(CustomBinPlugin)
core = rizin.RzCore()
plugin_struct.thisown = False
core.bin.plugins.append(plugin_struct)
core.bin.plugin_add(plugin_struct)
# Run rizin and load binary
core.bin.force_plugin(plugin.name)
core.file_open_load(sys.argv[1])
while True:
core.flush(input("> "))
while core.flush(input("rizin> ")) != CMD_EXIT:
pass
+18 -9
View File
@@ -1,7 +1,7 @@
project('rz-bindgen', 'c', 'cpp',
version: 'v0.5.0dev',
version: '0.6.0',
license: 'LGPL3',
meson_version: '>=0.53.0',
meson_version: '>=0.62.2',
default_options: ['python.install_env=auto'])
pymod = import('python')
@@ -19,9 +19,9 @@ target_sphinx = targets.contains('sphinx')
doxygen_path = get_option('doxygen_path')
if clang_path == ''
llvm = dependency('llvm', required: false)
if llvm.found()
clang_path = llvm.get_variable(configtool: 'libdir', default_value: 'none')
llvm_config = find_program('llvm-config', 'llvm-config-7', required: false)
if llvm_config.found()
clang_path = run_command(llvm_config, '--libdir', check: true).stdout().strip()
elif build_machine.system() == 'darwin'
clang_path = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/'
elif build_machine.system() == 'windows'
@@ -49,7 +49,7 @@ if clang_args == ''
clang = find_program('clang', 'clang-7', required: false)
if clang.found()
clang_args += ' -resource-dir='
clang_args += run_command(clang, '-print-resource-dir', check: true).stdout().strip()
clang_args += '"' + run_command(clang, '-print-resource-dir', check: true).stdout().strip() + '"'
endif
if build_machine.system() == 'darwin'
clang_args += ' -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
@@ -89,6 +89,11 @@ if target_swig or target_sphinx
'src/lint.py',
'src/main.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(
@@ -108,6 +113,7 @@ if target_swig or target_sphinx
endif
if target_swig
wheel = get_option('wheel')
swig_output = custom_target(
'swig_output',
input: bindgen_outputs[swig_source_idx],
@@ -117,7 +123,7 @@ if target_swig
'-python', '-c++',
'-outdir', '@OUTDIR@', '@INPUT@'
],
install: true,
install: wheel or host_machine.system() == 'windows',
install_dir: [py.get_install_dir(), false]
)
swig_py = swig_output[0]
@@ -127,15 +133,18 @@ if target_swig
rz_core = dependency('rz_core')
endif
py.extension_module(
ext_mod = py.extension_module(
'_rizin',
swig_wrap,
dependencies: [
py.dependency(),
rz_core,
],
install: true,
install: wheel or host_machine.system() == 'windows',
)
if host_machine.system() != 'windows'
meson.add_install_script('py_install.py', swig_py.full_path(), ext_mod.full_path())
endif
endif
if target_sphinx
+1
View File
@@ -4,5 +4,6 @@ option('rizin_include_path', type: 'string', value: '')
option('targets', type: 'array', choices: ['SWIG', 'sphinx'], value: ['SWIG'])
option('plugin', type: 'feature', value: 'disabled')
option('wheel', type: 'boolean', value: false, description: 'Set up for pypa wheel build')
option('doxygen_path', type: 'string', value: '')
+7
View File
@@ -2,6 +2,13 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <Python.h>
/**
* Some defines in rz_userconf.h are conflicting with the ones in python.h
**/
#undef HAVE_EXPLICIT_BZERO
#undef HAVE_SIGACTION
#undef HAVE_REALPATH
#include <rz_core.h>
#include <rz_util/rz_file.h>
#include <swig_runtime.h>
Executable
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""
SPDX-FileCopyrightText: 2024 kazarmy <[email protected]>
SPDX-License-Identifier: LGPL-3.0-only
"""
import os
import shutil
import sys
import sysconfig
def install_files(scheme):
for file in sys.argv[1:]:
if file.endswith(".py"):
dest_type = 'purelib'
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}")
try:
install_files(sysconfig.get_default_scheme())
except PermissionError:
print("Installing to user site-packages since normal site-packages is not writeable")
install_files(f"{os.name}_user")
+2 -1
View File
@@ -1,8 +1,9 @@
[MESSAGES CONTROL]
disable=too-many-instance-attributes,
too-few-public-methods,
too-few-public-methods,
too-many-branches,
too-many-return-statements,
too-many-locals,
too-many-arguments,
broad-exception-raised,
fixme
+16 -5
View File
@@ -5,19 +5,30 @@ requires = [
]
build-backend = "mesonpy"
[tool.meson-python.args]
setup = ['-Dwheel=true']
[tool.cibuildwheel]
build-verbosity = 3
before-all = "bash {project}/cibw_before_all.sh"
manylinux-x86_64-image = "manylinux_2_24"
manylinux-i686-image = "manylinux_2_24"
manylinux-x86_64-image = "manylinux2014"
skip = "pp*"
[tool.cibuildwheel.linux]
environment = { PATH="/opt/rh/llvm-toolset-7.0/root/usr/bin:/opt/rh/llvm-toolset-7.0/root/usr/sbin:$PATH", LD_LIBRARY_PATH="/opt/rh/llvm-toolset-7.0/root/usr/lib64:$LD_LIBRARY_PATH" }
archs = ["x86_64"]
[tool.cibuildwheel.windows]
environment = { CMAKE_PREFIX_PATH="C:\\rizin" }
environment = { CMAKE_PREFIX_PATH="C:/rizin", PATH="C:/rizin/bin;$PATH" }
archs = ["AMD64"]
[tool.cibuildwheel.macos]
environment = { PATH="/opt/homebrew/bin:$PATH", MACOSX_DEPLOYMENT_TARGET="14.0" }
[project]
name = "rz-bindings"
version = "0.5.0"
requires-python = ">=3.8"
dynamic = [
'version',
]
requires-python = ">=3.9"
readme = "README.md"
+2 -4
View File
@@ -54,8 +54,7 @@ class Class:
typedef: str,
ignore_fields: Optional[Set[str]] = ...,
rename_fields: Optional[Dict[str, str]] = ...,
):
...
): ...
@overload
def __init__(
@@ -66,8 +65,7 @@ class Class:
struct: str,
ignore_fields: Optional[Set[str]] = ...,
rename_fields: Optional[Dict[str, str]] = ...,
):
...
): ...
def __init__(
self,
+2 -4
View File
@@ -46,12 +46,10 @@ class MacroEnum:
defines: OrderedDict[str, str]
@overload
def __init__(self, header: Header, *defines: str):
...
def __init__(self, header: Header, *defines: str): ...
@overload
def __init__(self, header: Header, *, prefix: str):
...
def __init__(self, header: Header, *, prefix: str): ...
def __init__(
self,
+2 -4
View File
@@ -28,8 +28,7 @@ class Func:
*,
default_args: Optional[Dict[str, str]] = ...,
typemaps: Optional[List[Typemap]] = ...,
):
...
): ...
@overload
def __init__(
@@ -39,8 +38,7 @@ class Func:
cfunc: "CFunc",
default_args: Optional[Dict[str, str]] = ...,
typemaps: Optional[List[Typemap]] = ...,
):
...
): ...
def __init__(
self,
+9 -1
View File
@@ -29,6 +29,7 @@ class Generic:
specializations: Set[str]
c_methods: OrderedDict[str, List[str]]
python_methods: OrderedDict[str, List[str]]
specialization_extensions: DefaultDict[str, List[str]]
@@ -49,6 +50,7 @@ class Generic:
self.methods = OrderedDict()
self.specializations = set()
self.c_methods = OrderedDict()
self.python_methods = OrderedDict()
self.specialization_extensions = DefaultDict(list)
@@ -131,9 +133,15 @@ class Generic:
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:
"""
Add python function with decl
Add python method with decl
"""
self.python_methods[decl] = [f"def {decl}:"] + [f" {line}" for line in lines]
+12 -3
View File
@@ -2,6 +2,7 @@
SPDX-FileCopyrightText: 2022 wingdeans <[email protected]>
SPDX-License-Identifier: LGPL-3.0-only
"""
from typing import List, Dict, TYPE_CHECKING
from clang.cindex import Cursor, CursorKind
@@ -41,11 +42,19 @@ def gen_ctype_specializations(cursors: List[Cursor], ctype: CType) -> None:
# eg. typedef RzVector /*<ut64>*/ (*func)(void)
gen_ctype_specializations(cursors + [ctype.cursor], ctype.canonical)
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)
cursor_args = [
cursor
for cursor in cursors[-1].get_children()
if cursor.kind == CursorKind.PARM_DECL
cursor for cursor in cursor_children if cursor.kind == CursorKind.PARM_DECL
]
assert len(cursor_args) == len(ctype.args)
-14
View File
@@ -55,17 +55,3 @@ class Typemap:
f"Function {func.cfunc.cursor.spelling} did not match typemap `{self.args}`. "
f"Contents were: {args}"
)
buffer_len_typemap = Typemap(
"buffer_len",
[TypemapArg("unsigned char *", "buf"), TypemapArg("unsigned long long", "len")],
)
const_buffer_len_typemap = Typemap(
"const_buffer_len",
[
TypemapArg("const unsigned char *", "buf"),
TypemapArg("unsigned long long", "len"),
],
)
+55 -48
View File
@@ -12,7 +12,6 @@ from binding_class import Class
from binding_director import Director
from binding_enum import Enum, MacroEnum
from binding_generic import Generic
from binding_typemap import buffer_len_typemap, const_buffer_len_typemap
HeaderFunc = Callable[[Header], None]
threaded_headers: OrderedDict[str, HeaderFunc] = OrderedDict()
@@ -64,15 +63,15 @@ def bind_list(list_h: Header) -> None:
"""
### RzListIter ###
rz_list_iter = Generic(list_h, "RzListIter", pointer=True)
rz_list_iter.add_method("rz_list_iter_get_next", rename="next", generic_ret=True)
rz_list_iter.add_method("rz_list_iter_get_data", rename="data", generic_ret=True)
rz_list_iter.add_method("rz_list_next", rename="next", generic_ret=True)
rz_list_iter.add_method("rz_list_val", rename="data", generic_ret=True)
### RzList ###
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_first", rename="first", generic_ret=True)
rz_list.add_method("rz_list_last", rename="last", generic_ret=True)
rz_list.add_method("rz_list_first_val", rename="first", generic_ret=True)
rz_list.add_method("rz_list_last_val", rename="last", generic_ret=True)
rz_list.add_method("rz_list_iterator", rename="iterator", generic_ret=True)
rz_list.add_method(
@@ -148,13 +147,10 @@ def bind_analysis(analysis_h: Header) -> None:
"""
RzAnalysis
"""
analysis_h.ignore("rz_analysis_version")
rz_analysis = Class(
analysis_h,
typedef="RzAnalysis",
ignore_fields={"leaddrs"},
rename_fields={"type_links": "_type_links"},
struct="rz_analysis_t",
)
rz_analysis_function = Class(analysis_h, typedef="RzAnalysisFunction")
@@ -162,11 +158,10 @@ def bind_analysis(analysis_h: Header) -> None:
rz_analysis_function.add_prefixed_methods("rz_analysis_function_")
rz_analysis.add_method("rz_analysis_reflines_get", rename="get_reflines")
rz_analysis.add_prefixed_methods("rz_analysis_")
rz_analysis.add_prefixed_funcs("rz_analysis_")
rz_analysis.add_constructor("rz_analysis_new")
rz_analysis.add_destructor("rz_analysis_free")
Class(analysis_h, typedef="RzAnalysisBlock")
Class(analysis_h, typedef="RzAnalysisEsil")
Class(analysis_h, typedef="RzAnalysisBlock", struct="rz_analysis_bb_t")
Class(analysis_h, typedef="RzAnalysisPlugin")
Class(
@@ -182,7 +177,13 @@ def bind_asm(asm_h: Header) -> None:
"""
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")
@@ -221,27 +222,7 @@ def bind_buf(buf_h: Header) -> None:
RzBuf
"""
rz_buf = Class(buf_h, typedef="RzBuffer")
# const ut8 *buffer, ut64 len
for name in [
"append_bytes",
"prepend_bytes",
"set_bytes",
"insert_bytes",
"write",
"write_at",
]:
rz_buf.add_method(
f"rz_buf_{name}",
rename=name,
typemaps=[const_buffer_len_typemap],
)
# ut8 *buffer, ut64 len
rz_buf.add_method("rz_buf_read", rename="read", typemaps=[buffer_len_typemap])
rz_buf.add_method("rz_buf_read_at", rename="read_at", typemaps=[buffer_len_typemap])
rz_buf.add_method("rz_buf_seek", rename="seek")
rz_buf.add_prefixed_methods("rz_buf_")
MacroEnum(buf_h, "RZ_BUF_SET", "RZ_BUF_CUR", "RZ_BUF_END")
@@ -280,7 +261,6 @@ def bind_cons(cons_h: Header) -> None:
typedef="RzCons",
ignore_fields={"term_raw", "term_buf"}, # struct termios
rename_fields={
"lastline": "_lastline",
"echo": "_echo",
"highlight": "_highlight",
"newline": "_newline",
@@ -350,6 +330,17 @@ def bind_core(core_h: Header) -> None:
Class(core_h, typedef="RzCoreFile")
MacroEnum(core_h, prefix="RZ_CORE_CMD_")
@threaded_header("rz_esil/rz_esil.h")
def bind_esil(esil_h: Header) -> None:
"""
RzAnalysisEsil
"""
Class(esil_h, typedef="RzAnalysisEsil")
Class(esil_h, typedef="RzAnalysisEsilInterState")
@threaded_header("rz_flag.h")
def bind_flag(flag_h: Header) -> None:
@@ -438,15 +429,7 @@ def bind_sdb(sdb_h: Header) -> None:
Class(sdb_h, typedef="Sdb", ignore_fields={"db", "m"})
@threaded_header("sdb/ls.h")
def bind_ls(ls_h: Header) -> None:
"""
ls
"""
Class(ls_h, typedef="SdbList")
@threaded_header("sdb/ht_pp.h")
@threaded_header("rz_util/ht_pp.h")
def bind_ht_pp(ht_pp_h: Header) -> None:
"""
ht_pp
@@ -454,7 +437,7 @@ def bind_ht_pp(ht_pp_h: Header) -> None:
Class(ht_pp_h, typedef="HtPP")
@threaded_header("sdb/ht_pu.h")
@threaded_header("rz_util/ht_pu.h")
def bind_ht_pu(ht_pu_h: Header) -> None:
"""
ht_pu
@@ -462,7 +445,7 @@ def bind_ht_pu(ht_pu_h: Header) -> None:
Class(ht_pu_h, typedef="HtPU")
@threaded_header("sdb/ht_up.h")
@threaded_header("rz_util/ht_up.h")
def bind_ht_up(ht_up_h: Header) -> None:
"""
ht_up
@@ -470,9 +453,33 @@ def bind_ht_up(ht_up_h: Header) -> None:
Class(ht_up_h, typedef="HtUP")
@threaded_header("sdb/ht_uu.h")
@threaded_header("rz_util/ht_uu.h")
def bind_ht_uu(ht_uu_h: Header) -> None:
"""
ht_uu
"""
Class(ht_uu_h, typedef="HtUU")
@threaded_header("rz_util/ht_sp.h")
def bind_ht_sp(ht_sp_h: Header) -> None:
"""
ht_sp
"""
Class(ht_sp_h, typedef="HtSP")
@threaded_header("rz_util/ht_ss.h")
def bind_ht_ss(ht_ss_h: Header) -> None:
"""
ht_ss
"""
Class(ht_ss_h, typedef="HtSS")
@threaded_header("rz_util/ht_su.h")
def bind_ht_su(ht_su_h: Header) -> None:
"""
ht_su
"""
Class(ht_su_h, typedef="HtSU")
+2 -2
View File
@@ -2224,7 +2224,7 @@ class Type(Structure):
return result
assert self.kind == TypeKind.FUNCTIONPROTO
assert self.kind in (TypeKind.FUNCTIONPROTO, TypeKind.FUNCTIONNOPROTO)
return ArgumentsIterator(self)
@property
@@ -2320,7 +2320,7 @@ class Type(Structure):
def is_function_variadic(self):
"""Determine whether this function Type is a variadic function type."""
assert self.kind == TypeKind.FUNCTIONPROTO
assert self.kind in (TypeKind.FUNCTIONPROTO, TypeKind.FUNCTIONNOPROTO)
return conf.lib.clang_isFunctionTypeVariadic(self)
+16 -14
View File
@@ -38,6 +38,7 @@ class TypeKind(Enum):
POINTER: TypeKind
CONSTANTARRAY: TypeKind
FUNCTIONPROTO: TypeKind
FUNCTIONNOPROTO: TypeKind
INCOMPLETEARRAY: TypeKind
RECORD: TypeKind
@@ -86,6 +87,7 @@ class Type:
class SourceLocation:
class File:
name: str
file: File
line: int
column: int
@@ -108,23 +110,23 @@ class Token:
extent: SourceRange
class CursorKind(Enum):
INCLUSION_DIRECTIVE: TypeKind
MACRO_INSTANTIATION: TypeKind
INCLUSION_DIRECTIVE: CursorKind
MACRO_INSTANTIATION: CursorKind
ENUM_DECL: TypeKind
MACRO_DEFINITION: TypeKind
STRUCT_DECL: TypeKind
TYPEDEF_DECL: TypeKind
FUNCTION_DECL: TypeKind
ENUM_DECL: CursorKind
MACRO_DEFINITION: CursorKind
STRUCT_DECL: CursorKind
TYPEDEF_DECL: CursorKind
FUNCTION_DECL: CursorKind
FIELD_DECL: TypeKind
UNION_DECL: TypeKind
PARM_DECL: TypeKind
ENUM_CONSTANT_DECL: TypeKind
FIELD_DECL: CursorKind
UNION_DECL: CursorKind
PARM_DECL: CursorKind
ENUM_CONSTANT_DECL: CursorKind
ANNOTATE_ATTR: TypeKind
TYPE_REF: TypeKind
PACKED_ATTR: TypeKind
ANNOTATE_ATTR: CursorKind
TYPE_REF: CursorKind
PACKED_ATTR: CursorKind
class Cursor:
kind: CursorKind
+14 -10
View File
@@ -76,7 +76,7 @@ class CFunc(AttrCursor):
### Configuration ###
rizin_include_path: Optional[str] = None
rizin_include_path: Optional[str] = None # pylint: disable=invalid-name
clang_args: List[str] = []
### Headers ###
@@ -98,18 +98,20 @@ class HeaderBuilder:
assert rizin_include_path
filename = os.path.abspath(os.path.join(rizin_include_path, *name_segments))
# Fix sdb path if using source librz/include
if name_segments[0] == "sdb" and not os.path.exists(filename):
name_segments = ["..", "util", "sdb", "src"] + name_segments[1:]
filename = os.path.abspath(os.path.join(rizin_include_path, *name_segments))
assert os.path.exists(filename)
assert os.path.exists(filename), f"File {filename} does not exist"
self.filename = filename
# Parse ht_inc.h if importing SDB hashtable header
self.extra_filename = None
if name_segments[-1] in ["ht_pp.h", "ht_pu.h", "ht_up.h", "ht_uu.h"]:
if name_segments[-1] in [
"ht_pp.h",
"ht_pu.h",
"ht_up.h",
"ht_uu.h",
"ht_sp.h",
"ht_ss.h",
"ht_su.h",
]:
self.extra_filename = "ht_inc.h"
def translation_unit(self) -> TranslationUnit:
@@ -179,7 +181,9 @@ class Header:
continue
# Check for redefinitions
if name in self.cursor_kinds: # Redefinition
if (
name in self.cursor_kinds and cursor.kind == self.cursor_kinds[name]
): # Redefinition
prev = self.cursors[cursor.kind][name]
if cursor.kind == CursorKind.STRUCT_DECL:
assert prev.kind == CursorKind.STRUCT_DECL
+9 -6
View File
@@ -100,29 +100,32 @@ def wrap_type(type_: Type) -> CType:
"""
Wrap a type
"""
orig_type = type_
while type_.kind == TypeKind.ELABORATED:
type_ = type_.get_named_type()
# Complex types
if type_.kind == TypeKind.POINTER:
return CPointerType(type_, pointee=wrap_type(type_.get_pointee()))
return CPointerType(orig_type, pointee=wrap_type(type_.get_pointee()))
if type_.kind in [TypeKind.CONSTANTARRAY, TypeKind.INCOMPLETEARRAY]:
array_t = CArrayType(type_, element=wrap_type(type_.get_array_element_type()))
array_t = CArrayType(
orig_type, element=wrap_type(type_.get_array_element_type())
)
if type_.kind == TypeKind.CONSTANTARRAY:
array_t.element_count = type_.element_count
return array_t
if type_.kind == TypeKind.TYPEDEF:
return CTypedefType(
type_,
orig_type,
canonical=wrap_type(type_.get_canonical()),
cursor=type_.get_declaration(),
)
if type_.kind == TypeKind.FUNCTIONPROTO:
if type_.kind in (TypeKind.FUNCTIONPROTO, TypeKind.FUNCTIONNOPROTO):
return CFunctionType(
type_,
orig_type,
result=wrap_type(type_.get_result()),
args=[wrap_type(arg) for arg in type_.argument_types()],
)
@@ -132,7 +135,7 @@ def wrap_type(type_: Type) -> CType:
if decl_spelling.startswith("const "):
decl_spelling = decl_spelling[len("const ") :]
return CRecordType(type_, decl_spelling=decl_spelling)
return CRecordType(orig_type, decl_spelling=decl_spelling)
# Primitive types
if type_.kind in [
+1 -1
View File
@@ -39,7 +39,7 @@ from binding_func import Func
from writer import Writer
doxygen_path: Optional[str] = None
doxygen_path: Optional[str] = None # pylint: disable=invalid-name
DoxygenElements = Dict[str, Element]
+8
View File
@@ -114,6 +114,9 @@ def write_generic(writer: Writer, generic: Generic) -> None:
for name, method in generic.methods.items():
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():
writer.line("%pythoncode %{")
with writer.indent():
@@ -265,6 +268,11 @@ def write_func(writer: Writer, func: Func, name: str, kind: FuncKind) -> None:
if arg_name == "self":
arg_name = "_self"
# if function arg is the same as the function name
# we rename the argument
if arg_name == name:
arg_name += "_arg"
arg_decl = stringify_decl(
arg_name,
arg.ctype,
+133 -5
View File
@@ -23,15 +23,18 @@ and definitions. It also does this for Rizin annotations, such as RZ_OWN. This w
by defining the RZ_BINDINGS preprocessor flag, which sets the annotations to expand to
__attribute__((annotate)), which can be picked up by libclang.
"""
from typing import List, Dict, Set, TypedDict, Optional, cast
import os
import sys
import json
import shlex
import re
from argparse import ArgumentParser
from dataclasses import dataclass
from itertools import zip_longest
from pathlib import Path
from clang.cindex import (
Config,
@@ -43,6 +46,30 @@ from clang.cindex import (
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()
@@ -56,6 +83,14 @@ def warn(warning: str) -> None:
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:
"""
Get <relpath:filename:line> for a SourceLocation
@@ -75,7 +110,25 @@ def cursor_get_annotations(cursor: Cursor) -> List[str]:
]
generic_types = {"RzList", "RzListIter", "RzPVector", "RzVector", "RzGraph"}
generic_types = {
"RzList",
"RzListIter",
"RzPVector",
"RzVector",
"RzGraph",
"HtPP",
"RzThreadRingBuf",
"RzThreadQueue",
}
skip_files = {
"ht_inc.c",
"ht_inc.h",
"rz_th_ht.h",
"rz_th.h",
"thread_hash_table.c",
"thread_queue.c",
"thread_ring_buf.c",
}
def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]:
@@ -135,7 +188,10 @@ def cursor_get_comment(cursor: Cursor, *, packed: bool = False) -> Optional[str]
# Filter out other tokens
comment = token.spelling
if not comment.startswith("/*") or not comment.endswith("*/"):
if typeref_spelling in generic_types:
if (
typeref_spelling in generic_types
and location_get_filename(cursor.location) not in skip_files
):
warn(
f"Missing type comment at {stringify_location(cursor.location)} "
"(token is not a comment)"
@@ -151,19 +207,43 @@ 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", "RzGraph"}:
if typeref_spelling in {"RzList", "RzListIter", "RzPVector", "RzThreadQueue"}:
if comment[-2] != "*":
warn(f"Type comment at {stringify_location(cursor.location)} lacks pointer")
elif comment[-3] != " ":
warn(
f"Type comment at {stringify_location(cursor.location)} lacks space between pointer"
)
elif typeref_spelling in {"RzVector"}:
elif typeref_spelling in {"RzVector", "RzThreadRingBuf"}:
if comment[-2] == "*":
warn(
f"Type comment at {stringify_location(cursor.location)} should not have pointer"
)
elif typeref_spelling in {"HtPP", "HtUP", "HtUU", "RBTree", "SdbList"}:
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 {
"HtUP",
"HtUU",
"HtPU",
"HtSP",
"HtSS",
"HtSU",
"RBTree",
"SdbList",
}:
pass
else:
warn(
@@ -254,6 +334,51 @@ 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(
translation_unit: TranslationUnit, *, skipped_paths: Set[str], rizin_path: str
) -> None:
@@ -298,6 +423,7 @@ def check_translation_unit(
CursorKind.STRUCT_DECL,
CursorKind.UNION_DECL,
CursorKind.ENUM_DECL,
CursorKind.ALIGNED_ATTR,
]:
warn(f"Unknown field cursor kind: {field.kind}")
@@ -374,6 +500,8 @@ def main() -> int:
for include in includes
]
check_doxygen_syntax(abspath, rizin_path)
try:
check_translation_unit(
TranslationUnit.from_source(abspath, clang_args),
+12 -20
View File
@@ -9,34 +9,26 @@ bool rizin_warn_deprecate_instructions = true;
%{
void rizin_try_warn_deprecate(const char *name, const char *c_name) {
if (rizin_warn_deprecate) {
printf("Warning: `%s` calls deprecated function `%s`\n", name, c_name);
fprintf(stderr, "Warning: `%s` calls deprecated function `%s`\n", name, c_name);
if (rizin_warn_deprecate_instructions) {
puts("To disable this warning, set rizin_warn_deprecate to false");
puts("The way to do this depends on the SWIG language being used");
puts("For python, do `rizin.cvar.rizin_warn_deprecate = False`");
fprintf(stderr,
"To disable this warning, set rizin_warn_deprecate to false\n"
"The way to do this depends on the SWIG language being used\n"
"For python, do `rizin.cvar.rizin_warn_deprecate = False`\n");
}
}
}
%}
// uint64_t, int64_t etc
%include <stdint.i>
// Buffer typemaps
%include <pybuffer.i>
%define %buffer_len_activate(TYPE, SIZE)
%pybuffer_mutable_binary(TYPE, SIZE);
%enddef
%define %const_buffer_len_activate(TYPE, SIZE)
%pybuffer_binary(TYPE, SIZE);
%enddef
%define %buffer_len_deactivate(TYPE, SIZE)
%typemap(in) (TYPE, SIZE);
%enddef
%define %const_buffer_len_deactivate(TYPE, SIZE)
%typemap(in) (TYPE, SIZE);
%enddef
%pybuffer_mutable_binary(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_binary(const unsigned char *buf, int len);
// CArrays
%include <carrays.i>
+2 -2
View File
@@ -13,7 +13,7 @@ void register_swig_command(const char *str, CmdDirector *director,
} else {
char *dup = strdup(str);
dup[len - 1] = '\0';
parent = (RzCmdDesc *)ht_pp_find($self->ht_cmds, dup, NULL);
parent = (RzCmdDesc *)ht_sp_find($self->ht_cmds, dup, NULL);
free(dup);
}
@@ -21,7 +21,7 @@ void register_swig_command(const char *str, CmdDirector *director,
throw "Could not get parent RzCmdDesc";
}
RzCmdDesc *prev = (RzCmdDesc *)ht_pp_find($self->ht_cmds, str, NULL);
RzCmdDesc *prev = (RzCmdDesc *)ht_sp_find($self->ht_cmds, str, NULL);
std::string cmd(str);
if (prev) { // Update existing RzCmdDesc
auto it = SWIGCmds.find(cmd);
+1
View File
@@ -0,0 +1 @@
/bins
+42
View File
@@ -0,0 +1,42 @@
NAME=1-rz_core.py =
FILE=--
CMDS=<<EOF
!echo q | python3 ../examples/1-rz_core.py =
echo
EOF
EXPECT=<<EOF
Loaded 1 file(s)
Corefile #1 has 1 binfile(s)
* malloc://512
rizin>
EOF
EXPECT_ERR=
RUN
NAME=2a-rz_bin_plugin.py
FILE=--
CMDS=<<EOF
!echo q | python3 ../examples/2a-rz_bin_plugin.py bins/elf/analysis/ls-linux64
echo
EOF
EXPECT=<<EOF
name: bins/elf/analysis/ls-linux64
size: 121584
rizin>
EOF
EXPECT_ERR=
RUN
NAME=2b-rz_bin_plugin.py
FILE=--
CMDS=<<EOF
!echo q | python3 ../examples/2b-rz_bin_plugin.py bins/pe/hello_world_arm/hello_world_arm64.exe
echo
EOF
EXPECT=<<EOF
name: bins/pe/hello_world_arm/hello_world_arm64.exe
size: 8704
rizin>
EOF
EXPECT_ERR=
RUN