Skip to content

Add r2sleigh native analysis integration - #25929

Draft
0verflowme wants to merge 1 commit into
radareorg:masterfrom
0verflowme:codex/r2sleigh-clean-pr
Draft

Add r2sleigh native analysis integration#25929
0verflowme wants to merge 1 commit into
radareorg:masterfrom
0verflowme:codex/r2sleigh-clean-pr

Conversation

@0verflowme

@0verflowme 0verflowme commented May 7, 2026

Copy link
Copy Markdown
Member

This replaces #25913 with a clean single-commit branch based on current upstream/master. The old PR had accumulated noisy history from rebases and co-authorship churn, so this PR keeps the r2sleigh integration reviewable on its own.

Why

../r2sleigh needs a native integration path into radare2 analysis data instead of relying on ad-hoc command output. This PR adds the minimal radare2-side seams needed for r2sleigh to consume typed function context, track assumptions, and apply analysis mutations while keeping the integration optional and preserving existing CLI/test behavior when the sleigh analysis plugin is not available.

What Changes

  • Add native analysis integration APIs for typed function context, function assumptions, analysis mutations, dirty epochs, and context hashes.
  • Add analysis-depth-aware post-analysis hooks so plugins such as r2sleigh can run balanced or aggressive follow-up analysis from aaa/aaaa without hard-coding plugin behavior in command output.
  • Route pdd/cmd.pdc discovery to the sleigh decompiler when the sla analysis plugin is available, while keeping existing fallback behavior unchanged.
  • Persist function assumptions in project save/load output so r2sleigh-derived context survives project round trips.
  • Route direct type-link writes/removals through r_anal_types_* helpers so tl, tl-, hint/global type links, and zero-address links correctly update dirty epochs and type context hashes.
  • Keep no-capstone builds working by avoiding direct libr_core references to plugin-only anal_tp symbols.
  • Keep aaa logs stable for r2pipe/r2r consumers by making the new post-analysis hooks silent.
  • Preserve default void signatures for API, pdc, and zignature consumers while keeping legacy afcf text output stable for var-only functions.

Tests

  • make -j > /dev/null
  • make -C test/unit bin/test_anal_function bin/test_anal_types LIBDIR='../../libr/core -L../../libr/main -L../../libr/config -L../../libr/debug -L../../libr/bin -L../../libr/lang -L../../libr/anal -L../../libr/bp -L../../libr/egg -L../../libr/asm -L../../libr/flag -L../../libr/search -L../../libr/syscall -L../../libr/fs -L../../libr/io -L../../libr/socket -L../../libr/cons -L../../libr/magic -L../../libr/muta -L../../libr/arch -L../../libr/esil -L../../libr/reg -L../../libr/util'
  • DYLD_LIBRARY_PATH=... ./test/unit/bin/test_anal_function
  • DYLD_LIBRARY_PATH=... ./test/unit/bin/test_anal_types
  • R2R_RADARE2=/private/tmp/r2clean-r2 r2r -u test/db/cmd/r2pipe2 (5 OK)
  • R2R_RADARE2=/private/tmp/r2clean-r2 r2r -u test/db/cmd/cmd_af (18 OK / 2 BR)
  • R2R_RADARE2=/private/tmp/r2clean-r2 r2r -u test/db/cmd/cmd_pdc (OK)
  • R2R_RADARE2=/private/tmp/r2clean-r2 r2r -u test/db/cmd/cmd_zignature (OK)
  • R2R_RADARE2=/private/tmp/r2clean-r2 r2r -u test/db/cmd/projects (37 OK / 5 BR)

CI Notes

The latest fixes address the previously failing linux-nocs, linux-acr-gperf, linux-tinyasan-fuzz, and TCC jobs by preserving plugin boundaries, command-log stability, and signature formatting compatibility.

@0verflowme 0verflowme mentioned this pull request May 7, 2026
3 tasks
@0verflowme
0verflowme force-pushed the codex/r2sleigh-clean-pr branch 5 times, most recently from 2b3f0b7 to 665e91a Compare May 12, 2026 08:33
@0verflowme
0verflowme force-pushed the codex/r2sleigh-clean-pr branch from 665e91a to 3cfbe77 Compare July 2, 2026 06:57
@trufae
trufae force-pushed the master branch 2 times, most recently from b95a936 to ad1ca1a Compare July 20, 2026 17:05
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