fix(hopper): resolve FAT loaders and original file coordinates

This commit is contained in:
morluto
2026-10-09 05:12:36 +08:00
parent b2d5bc1109
commit 35f1ddd6bc
13 changed files with 489 additions and 112 deletions
+13 -1
View File
@@ -318,7 +318,19 @@ Analysis and annotation calls stay bound to the active target's native Hopper
document, even when GUI focus changes or other documents have the same display
name. Use `open_binary` to change targets. Byte reads stop at a segment boundary
and return the readable prefix with `complete: false`. File-offset mapping checks
the reverse lookup; synthetic external-symbol memory has no original file offset.
the reverse lookup and original executable bounds; synthetic external-symbol
memory has no original file offset. For FAT Mach-O, offsets refer to the original
container file. Results retain Hopper's image-relative offset, the observed slice
base, and the source executable path.
Loader selection reads the Mach-O container header, including FAT files with a
single architecture. FAT64 uses the same derived FAT/Mach-O loader chain;
loading depends on the installed Hopper build. Hopper 6.1.0-demo timed out on
a FAT64 fixture while FAT32 controls and its extracted thin image loaded.
This does not establish that other builds reject FAT64. If loading fails, use
`lipo -archs <source-file>` to read the exact architecture names, then
`lipo -thin <architecture> <source-file> -output <thin-file>` and open the
resulting image. FAT64 is distinct from the CPU architecture: FAT32 containers
can contain 64-bit executable images.
Cursor navigation returns the observed object start when Hopper snaps an interior
address; adjacent-object navigation rejects unmapped inputs and document ends.
Native API text rejects NUL characters and unpaired Unicode surrogates before
+12
View File
@@ -205,6 +205,18 @@ literal-trace results and invalid-address diagnostics agree with MCP.
No provider is mocked in this lane.
The Linux demo lane remains a separate `verify:hopper:linux` command.
`verify:hopper:fat` is a separate macOS lane requiring installed Hopper and the
existing Xcode clang/lipo toolchain. It compiles arm64/x86-64 thin executables and
one- and two-slice FAT32 containers, verifies exact/interior address mappings
against bytes in the original files, checks CLI/MCP parity, and checks owned
runtime cleanup. `verify:hopper:fat64` additionally requires the installed Hopper
to load a compiled FAT64 container and verifies its original-file mappings. It
fails on a native load or analysis failure rather than treating a timeout as
proof of unsupported format. This additional lane remains unverified on Hopper
6.1.0-demo: FAT64 timed out while FAT32 controls and the extracted thin image
loaded successfully.
Cross-architecture fixture compilation is not required by `verify:hopper`.
Golden tests use immutable captured text inputs with producer/source provenance
under `tests/fixtures/golden/`. Expected results are reviewed for the semantic
claim; capture commands do not automatically approve new expected outputs.