Skip to content

Adds Angr support as backend#5

Merged
buzzer-re merged 7 commits into
mainfrom
dev/angr
Jun 18, 2026
Merged

Adds Angr support as backend#5
buzzer-re merged 7 commits into
mainfrom
dev/angr

Conversation

@buzzer-re

Copy link
Copy Markdown
Owner

No description provided.

buzzer-re and others added 7 commits June 15, 2026 23:09
Add a third decompiler backend built on angr so ToCode runs even when
neither IDA nor radare2 is available. The backend implements the existing
DecompilerSession protocol and produces a structurally identical export
tree (verified file-for-file and key-for-key against an IDA export);
decompilation quality is angr-level, which is accepted.

- backends/angr.py: AngrSession over CFGFast + angr's decompiler, with
  clean C signature construction and stripping of angr's leading
  extern/typedef/comment blocks so the exporter parses prototypes correctly.
- base.py: widen backend types, add probe_r2/probe_angr, and make
  choose_backend an IDA -> r2 -> angr auto chain.
- analysis.py/exporter.py/cli.py: wire angr into the factory, parallel
  worker opener, and --backend choices.
- pyproject.toml: optional [angr] extra and a mypy override so the
  optional import does not break type checking when angr is absent.
- tests: choose_backend fallback coverage and an angr smoke test that
  skips when angr is not installed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The angr fallback is an optional extra (~450 MB of native deps), so it is
not installed by default. Add an opt-in install path so users without IDA
or radare2 can get a working backend out-of-the-box:

- install.sh: --full flag, plus combinable extras handling for --dev/--full.
- install.ps1: -Full switch with the same extras handling.
- README: document --full / -Full and the angr install options.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
uv sync populates the project's .venv, but uv tool install builds a
separate isolated environment for the `tocode` command -- which never
received the angr extra, so `tocode --backend angr` reported the backend
as unavailable even after `install.sh --full`. Pass the runtime extra to
the tool-install path spec (DIR[angr]) so the installed command sees it.
dev stays out of the tool environment (build/test tooling only).

Also handle the no-pip case on the non-uv path: probe `python -m pip`,
try ensurepip, and fail with an actionable message instead of a raw
"No module named pip".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Modern distros and Homebrew mark their Python "externally managed", so
`pip install --user` is refused with an externally-managed-environment
error. Create a dedicated virtual environment instead (as pipx/uv do) and
expose only the tocode launcher on PATH, so deps stay isolated and the
system interpreter is untouched. If venv itself is unavailable, fail with
an actionable hint (install python3-venv, or use uv).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Importing angr loads native extensions and emits noisy warnings (e.g.
"failed loading unicornlib.so") at import time. Pulling it in at module
top meant every run paid that cost even with --backend ida/r2. Defer the
AngrSession import to the angr branch so non-angr runs never touch it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@buzzer-re buzzer-re merged commit 3d4f9ae into main Jun 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant