Support direct import calls through call qword [rip+disp32] (\xff\x15)
in tools/import_call_sites.py alongside thunks (jmp qword [rip+disp32] / \xff\x25).
This enables discovering call sites in images where imports are called
directly without an intermediate jmp thunk (e.g. XboxBvhBuilder.dll calls).
Harden tools/import_fail_fast.py to identify instruction boundary sizes
(5 bytes for E8 vs 6 bytes for FF 15) when classifying call sites.
Add unit tests in tests/test_import_call_sites.py for direct slot call
detection, combined thunk/direct calls, non-slot skips, and CLI reports.
AI-assisted (Claude Code)
tools/f16misc_diff.py, tools/import_fail_fast.py and tools/vrel_diff.py came in with
our open PRs and were the only new entries test_tool_stdout_encoding reports on mangrove
over upstream main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Straight-line reading misses sites, and a stray call byte pair can add a false one, so the count can be off in
both directions (review on #7010).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the 1.0.2.1 image it now reads "515 of 587 import(s) called directly, ...": the 72 imports with no direct call
site were the first question a tester asked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reported on #7010: on the retail image the JSON has 587 entries while the
table line says 515 imports called. Both are right; the docstring now says
the JSON keeps calls == 0 entries and the line counts only calls > 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the file alone, per import: the call sites that test the returned value and branch to int3, ud2,
int 29h or a call that does not return, with the value that takes that side. Call sites come from
import_call_sites.py's thunk calls plus `call [rip+slot]` for the api-ms-win-* imports; the result is
tracked through mov/movzx/movsx copies and cdqe, and each side is followed through up to two jumps.
On the retail 1.0.2.1 executable: 515 imports called, 27 with a fatal result check, 78 sites.
docs/exe_fail_fast.md groups them by how main binds each import: XMemVirtualAlloc stops on NULL at 14
of its 23 sites, and the unbound xmem physical-page imports stop on the default return of 0 at 8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>