mirror of
https://github.com/radareorg/r2flutter.git
synced 2026-11-07 06:26:00 -10:00
The four kDart*Snapshot* symbols are external/global and load-bearing (the engine resolves them at runtime), so they survive strip; but obfuscators/repackagers can remove them, leaving only the two data snapshots findable by magic scan (instruction images carry no magic) and iso_instr=0, which disables IT name recovery. Add locate_instr_images_structural(): vm_instr = start of the first executable section; read the Dart Image header (word0=ImageSize) and chain iso_instr = align_up(vm_instr + ImageSize, 64). Every step is cross-checked (plausible headers; the isolate image must end where the first data image begins), so an unknown/gapped layout degrades to 0 (no IT names) rather than junk addresses. No-op when symbols already resolved the instructions. Verified against symbol-derived ground truth: Runner (0x4000/0xe700, full 7671 IT entries recovered) and AuthPass (0x5a80/0xfdc0); the gapped macOS hello.aot safely falls back to 0. Symbol-present bins unchanged; suite green (95 db/cmd, 3 extras, 35 custom). Adds scripts/strip_macho_symbols.py (zeroes LC_SYMTAB + dyld export trie, since strip cannot) and test/db/cmd/discovery-stripped-ios which builds the fixture from the committed Runner App and asserts structural recovery. Remaining follow-ups tracked in COMMIT2.md. Co-Authored-By: Claude Opus 4.8 <[email protected]>