feat(tools): list a guest's imports without running it, and report the imports a run touches #38
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Freminet--ScarlettX!38
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-38"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@wildheathen on GitHub · 2026-11-21 19:28 UTC · original
wildheathen:feat/import-diagnostics→main· +589 −1 · 7 files · 2 commits · openSummary
Two small diagnostics that show which entry points a title wants from us, without needing a title in the repository:
tools/list_guest_imports.py: reads the static import table of a PE32/PE32+ image (DLL name, symbol or ordinal) without running it.--dllfilters,--jsonwrites a machine-readable report,--missing-from <header>marks the imports the given ABI header does not declare. Truncated or malformed files are reported as an error message, not a traceback.scarlettx boot ... --dump-imports: at the end of the run (or on Ctrl+C, since real titles do not return) prints the auto-stub imports with their call counts and the names the guest resolved withGetProcAddress, unresolved ones first.GetProcAddressis overridden insrc/loader/guest_modules.cppto record DLL, symbol, hit count and whether the host found it. Ordinal requests are recorded as#nand the pointer is never dereferenced. A first miss is logged to stderr only when--dump-importsis on, so normal runs stay quiet.The static table only covers imports; delay-loaded ones and run-time resolutions are exactly what
--dump-importsadds.Tests
tests/test_guest_loader.cppcovers the lookup registry: a resolved name, a missing name, repeats aggregated into one entry with the right hit count, and ordinal lookups (valid and invalid) that are recorded and never dereferenced.Verification
origin/main(test_boot_hello_scarlett,test_boot_rt_showcase,test_d3d12_guest_texture; see #1 and #2).list_guest_imports.pyon the builthello_scarlett.exe(lists itsxgameruntime.dllimports) and on a 300-byte truncation of it (reports "truncated file").View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.