cpu: accept version-2 chained unwind headers in function_ranges #141
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/142"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:03:44Z.
Change
Accept x64
UNWIND_INFOversion 2 on chained unwind records (UNW_FLAG_CHAININFO,flags == 4) intools/cpu_ranges.py(function_ranges).Version 2
UNWIND_INFO(used by MSVC forUWOP_EPILOG) keeps the same 4-byte header, even-paddedUNWIND_CODEarray (((CountOfCodes + 1) & ~1) * 2), and 12-byte chainedRUNTIME_FUNCTIONtrailer as version 1. Becausefunction_rangeswalks every.pdataentry in the image, rejecting version 2 on chained records caused the whole image to fail whenever any chained entry used version 2.function_rangesnow allowsversion in (1, 2)whenflags == 4, while continuing to reject other versions (0,3, etc.) and combined flags (flags != 4).tests/cpu/chained_check.pyadds:UNWIND_INFOheader in the source-builtcpu_chained.dllfrom version 1 (0x21) to version 2 (0x22) and checking thattranslate()produces the identical output and owned ranges;0x20), version 3 (0x23), and combinedUNW_FLAG_CHAININFO | UNW_FLAG_EHANDLER(0x2a).Verification
Tested on Windows 11 x64, VS 2022 Build Tools 17.14 (MSVC 19.44.35230.0, ML64 14.44.35230.0), Windows SDK 10.0.26100, Python 3.12.10 (
pefile==2024.8.26,iced-x86==1.21.0), at commit10d404e:tools/cpu_ranges.py, the new test fails as expected:Evidence and follow-up
All tests run on the existing source-built MASM fixture
tests/cpu/chained.asm(cpu_chained.dll) patched in a temporary directory.This change covers only chained
UNWIND_INFOtrailer lookup (version in (1, 2)withUNW_FLAG_CHAININFO); non-chained unwind code decoding and indirectRUNTIME_FUNCTIONpointers (bit 0 set onUnwindData) remain unchanged.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T17:08:43Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
10d404ebc2ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T17:05:51Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
10d404eℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:10:30Z.
Updated \docs/experiments.md\ under Chained function ranges and early returns to record version-2 chained \UNWIND_INFO\ support for trailer lookup (clarifying that general version-2 unwind code decoding is unchanged) and the new fixture controls.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T17:08:43Z.
Code review location:
tools/cpu_ranges.py; line 34Accepting version-2 chained headers expands the PE inputs supported by the public CPU translators, but this commit updates neither the CPU experiment entry in
README.mdnor the chained-range notes indocs/experiments.md.AGENTS.mdrequires documenting public capability changes. Update the relevant experiment documentation to record the newly accepted version and clarify that this covers chained-trailer lookup, not general version-2 unwind decoding.AGENTS.md reference: AGENTS.md:L144-L145
Useful? React with 👍 / 👎.