Repository navigation
Conversation
R0Y00#1758) tools/startup/msvc_throw_info.py reads the public x64 throw info (magic, thrown object, _ThrowInfo, _CatchableTypeArray, _CatchableType, type_info name) through a read_mem callback and returns a record with no address and no path: the catchable types (built-in scalars and public library classes by name, any other class as other) and, for a thrown 32-bit scalar such as long, the HRESULT as a public name with its facility. It is not wired into debug_launch.py yet.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
R0Y00
left a comment
There was a problem hiding this comment.
Please tighten the public summary allowlist. _describe_value treats every 32-bit scalar with bit 31 set as an HRESULT, then emits its raw hex in both the record and the one-line description. A thrown integer with that bit set can be private application data. Keep named, recognized HRESULTs such as E_INVALIDARG, and classify an unrecognized high-bit value without printing its bits in the shareable output. Add a synthetic scalar sentinel and check both the returned record and describe(). The core can still run independently of the startup debugger.
A thrown 32-bit scalar with bit 31 set is only named when it is a recognized public HRESULT. Any other value is reported as unrecognized_failure with no code, bits or facility, in both the record and describe(). Adds a synthetic sentinel test for both outputs.
|
Addressed in 9a3c446.
Verification:
AI-assisted; commands listed were executed locally. |
|
Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally. |
# Conflicts: # CMakeLists.txt
|
Reopened and brought up to date: origin/main ( Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
Linux at the same head: The description now starts with the AI-assisted; commands listed were executed locally. |
|
@MasterDomino Ready for review: head Independent Stage-2 check on this exact head, Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), Proxmox slots, dev and release Review result: records of a thrown Non-blocking: a thrown number up to 65535 is printed as a number (for example AI-assisted; commands listed were executed locally. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Takes R0Y00#1170 (cancel superseded pull-request runs). R0Y00#1801 is the older copy of R0Y00#1939, which tester-loop already carries: msvc_throw_info.py and its check stay as R0Y00#1939 has them.
pigalot
left a comment
There was a problem hiding this comment.
Independently reviewed 49ca19e3 integrated over main ae078247 (tree 826dcb80). The merge is clean (CMakeLists.txt and .github/workflows/windows.yml auto-merged) and git diff --cached --check origin/main is clean.
Earlier finding (R0Y00, changes requested on 205803c2): addressed. In _describe_value, a 32-bit value with bit 31 set that is not in HRESULT_NAMES now returns only c_type, hresult=unrecognized_failure and category=unrecognized_failure. It has no code, no facility and no bits. describe() builds its line from those fields only. Named HRESULTs keep their name, facility category and code. The sentinels 0xDEADBEEF, 0x80041234, 0x887A9999 and 0xCAFE0001 are checked in both the returned record and the describe() line. Restoring the old branch (hresult_name(bits) plus code) fails them at unrecognized 0xdeadbeef is classified without its bits: MISMATCH.
What I traced. I checked the offsets against the public ehdata.h x64 layout:
_ThrowInfo: 16 bytes, with the_CatchableTypeArrayRVA at +12._CatchableType: 28 bytes, with thetype_infoRVA at +4 and the size at +20.TypeDescriptor: the decorated name at +16.
I checked the HRESULT table values against winerror.h and the DXGI/D3D12 return-code lists. Every refusal goes through _refused() with a status only. A class name not on the allowlist is reported as other.
What I ran.
. .\tools\dev.ps1; cmake --preset dev; cmake --preset release
ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_msvc_throw_info|startup_triage_run|runtime_startup_triage_run_cli_check)$'
.\out\pe-env\Scripts\python.exe -B tests/startup_msvc_throw_info_check.py- New test and neighbours: 3/3 pass in
devand inrelease. No skips. - Direct run: 89 checks
ok, thenPASS. - Before: on
mainae078247,startup_msvc_throw_infois not registered.
Mutants (each applied alone to tools/startup/msvc_throw_info.py, check rerun, file restored from its raw bytes, git diff --quiet clean afterwards). Every one fails the check; the first mismatch is shown:
| Mutant | First mismatch |
|---|---|
unrecognized high-bit value printed as HRESULT(0x…) with code (the pre-fix form) |
unrecognized 0xdeadbeef is classified without its bits |
| unrecognized value keeps its facility category | same |
| high-bit branch removed | same |
describe() also prints code |
unrecognized 0xdeadbeef: describe line |
small-number limit raised to 0x7FFFFFFF |
a large positive number is not reported |
| other classes reported by decorated name | a class of the title is 'other' |
| scalar size not checked | a long of the wrong size has no value |
| magic not checked | wrong magic |
type_info name read at +8 |
long 0x80070057 is E_INVALIDARG |
| raising read callback not caught | traceback |
type cap >= instead of > |
16 catchable types is the cap |
Non-blocking notes.
- The body has not caught up with
9a3c446b. Under "What it does" and "Not run, not established" it still says an unlisted code prints asHRESULT(0x........)with its facility. The code no longer does that, so the body should sayunrecognized_failure. hresult_name()still returnsHRESULT(0x%08X)for an unlisted value. Nothing in the decoder calls it, but the follow-up that wires this intodebug_launch.pycould reach for it and bring the bits back. Dropping it, or giving it the sameunrecognized_failureanswer, would close that.- Since #2655, new registrations can go in a
tests/cmake/<family>.cmakefragment and atests/checks/python-linux/<topic>.txtfile. That keeps them off the shared lines ofCMakeLists.txtand the workflow. Those files are optional, and this merge is clean as it is.
Verdict: approve on 49ca19e3.
Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU is involved.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 49ca19e3.
This reply was AI-assisted.
|
I reviewed What I checked
Suggestions
This comment was AI-assisted. |
|
Thanks @JohnConnorNPC. Pushed What changed:
Verification:
@MasterDomino ready for review and merge when you have time. The earlier changes-requested review by @R0Y00 (unrecognized high-bit values) is fixed on this head and approved by pigalot. AI-assisted; commands listed were executed locally. |
pigalot
left a comment
There was a problem hiding this comment.
Retested b055cab9 integrated over main 212d4b5f (tree 29bf8761). The merge is clean and git diff --cached --check origin/main is clean. This follows my approval on 49ca19e3.
What changed since 49ca19e3. git diff 49ca19e3 b055cab9 on the PR's two files is 3 lines of code and 11 lines of test:
hresult_name()returnsunrecognized_failurefor an unlisted value. It no longer formats the bits.- New checks: 65535 reported and 65536 not, a
.Kscalar, a thrownint1 as the listedS_FALSE, andhresult_nameof an unlisted value (unsigned and signed).
The merge of main (d45d241a) has an empty git show --remerge-diff, so it resolved nothing by hand.
Earlier findings.
- R0Y00's changes request on
205803c2(an unrecognized high-bit value printed its bits): still addressed._describe_valueis unchanged since9a3c446b, and the four sentinel checks on the record and ondescribe()still pass. - My non-blocking note on
hresult_name(): addressed.grepforHRESULT(0xin the tree finds nothing now. - My non-blocking note on the body: addressed for
HRESULT(0x........). Two smaller leftovers are under "Non-blocking" below.
What I ran.
. .\tools\dev.ps1; cmake --preset dev; cmake --preset release
ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^(startup_msvc_throw_info|startup_triage_run|runtime_startup_triage_run_cli_check)$'
.\out\pe-env\Scripts\python.exe -B tests/startup_msvc_throw_info_check.py- Test and neighbours: 3/3 pass in
devand inrelease. No skips. - Direct run: 94 checks
ok, thenPASS. - Also pass:
tests/docs_links_check.py,tests/bidi_controls_check.py,tests/startup_tools_lint_check.py. - Negative control: the new test against the module from
49ca19e3fails with one line,hresult_name of an unlisted value prints no bits: MISMATCH. The other four new checks pass there, as expected: they pin behaviour that was already right.
Mutants (each applied alone to tools/startup/msvc_throw_info.py, check rerun, file restored from its raw bytes, git diff --quiet clean afterwards).
Killed (11), with the first failing check:
| Mutant | First failure |
|---|---|
hresult_name prints HRESULT(0x…) again |
hresult_name of an unlisted value prints no bits |
hresult_name without the 32-bit mask |
hresult_name wraps to 32 bits |
SMALL_VALUE_LIMIT raised to 0xFFFFFF |
a thrown long 65536 is not reported |
SMALL_VALUE_LIMIT raised to 0x10000 |
same |
SMALL_VALUE_LIMIT lowered to 0xFFFE |
a thrown long 65535 is reported |
<= changed to < |
same |
.K removed from SCALARS_32 |
KeyError: 'value' in the .K check |
.K named unsigned int |
an unsigned long is a scalar |
S_FALSE removed from the table |
KeyError: 'hresult' in the int 1 check |
| table lookup only for values with bit 31 set | same |
every small number given category success |
a small number is reported as a number |
Surviving: none.
Equivalent (1): .K marked signed. The value is masked with 0xFFFFFFFF straight after struct.unpack, so the signed flag cannot change any output.
Non-blocking.
- The body's "Verification" header still names head
49ca19e34, and "Test" still says 89 cases. It is 94 at this head. - A thrown
int1 is reported asS_FALSE category=success. The new check pins that on purpose. A thrown 1 that is a plain number reads as an HRESULT there, which is harmless for the summary but worth knowing when reading one.
No title run: this PR adds a standalone Python decoder and its check, and nothing in the runtime or the launcher calls it.
Verdict: approve on b055cab9. I am not merging it in this pass. R0Y00's changes request from 205803c2 is still formally open on the PR; the code has met it since 9a3c446b.
Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU is involved.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on b055cab9.
This reply was AI-assisted.
Part of #1758 (and #870)
What this unblocks: the startup debugger can report which HRESULT a C++ exception carried when a run ends on
0xE06D7363, as a short public summary with no address, path or name from the title.This is the decoder only: it is not wired into
tools/startup/debug_launch.py(untouched, so it does not collide with the other open PRs that edit that file). The follow-up that calls it at the first-chance stop is a separate change.Source: the MSVC runtime header
ehdata.h(shipped with the Visual Studio C runtime sources) for the0xE06D7363parameters and the_ThrowInfo/_CatchableTypeArray/_CatchableTypelayout; Raymond Chen, The Old New Thing (Microsoft Dev Blogs), "Decoding the parameters of a thrown C++ exception (0xE06D7363)"; Microsoft Learn, "EXCEPTION_RECORD structure (winnt.h)"; Microsoft Learn, "DXGI_ERROR" and "Direct3D 12 return codes", andwinerror.h(Windows SDK) for the HRESULT names and values.Verification (head
49ca19e34, origin/main9b45cbb44merged in with a merge commit):x2w_pipe.py win2025 1939 --host proxmox --regex '^startup_msvc_throw_info$':ctest --preset dev -R '^startup_msvc_throw_info$' --no-tests=error --output-on-failure: 1/1 passed (startup_msvc_throw_info)./O2:ctest --preset release -R '^startup_msvc_throw_info$' --no-tests=error --output-on-failure: 1/1 passed (startup_msvc_throw_info).python3 -B tests/startup_msvc_throw_info_check.pyPASS;tests/docs_links_check.py,tests/bidi_controls_check.py,tests/startup_tools_lint_check.pypass;git diff --check origin/main...HEADclean.What it does
tools/startup/msvc_throw_info.pyturns a0xE06D7363exception record into a sanitized summary. #1758 needs the thrown HRESULT of the BVH builder, whose throw info says the catchable type is the built-inlong(.J), without putting addresses or names from the title in a public comment.decode_throw(exception_code, params, read_mem)follows the public MSVC x64 layout (ehdata.h):params[0]magic,[1]thrown object,[2]_ThrowInfo,[3]image base;_ThrowInfo→ RVA of_CatchableTypeArray→ RVAs of_CatchableType→ RVA oftype_info, whose decorated name is at offset 16.read_mem(address, size) -> bytes | Noneis the only access to memory, so the core has no Win32 dependency: indebug_launch.pyit would be the existingread.The record it returns has:
status:ok,not_msvc_exception,missing_parameters(fewer than four, so no image base),bad_magic,no_throw_info,unreadable,bad_throw_info,too_many_types(cap of 16, a safety limit).types: one entry per catchable type. Built-in scalars and a short list of public library classes (std::runtime_error,_com_error, ...) are named; any other class isother, so a class of the title never appears.value, only when the first catchable type is a 32-bit scalar (.J,.H,.I,.K) of size 4: the HRESULT as a public name (E_INVALIDARG,E_OUTOFMEMORY,DXGI_ERROR_DEVICE_REMOVED,DXGI_ERROR_DEVICE_HUNG,D3D12_ERROR_*, commonHRESULT_FROM_WIN32(...)), orunrecognized_failurefor a high-bit value outside the list (no bits, code or facility), with the facility category of a listed one (win32,dxgi,d3d12,other). A positive number above 65535 is not reported.describe(record)gives a one-line form made of those fields only.Test
tests/startup_msvc_throw_info_check.pybuilds synthetic exception records in a fake address space (no title data) and checks 89 cases: ten HRESULTs through.J(E_INVALIDARG,E_OUTOFMEMORY,DXGI_ERROR_DEVICE_REMOVED, a generic one, ...),.Hand.I, another exception code, wrong magic, three parameters, null throw info and image base, a read that fails at each of the four steps (and a callback that returns short data or raises), an RVA beyond the readable range and one that overflows 64 bits, a negative count, 16 and 17 catchable types, a zero RVA,runtime_error,_com_error, a class of the title, alongof the wrong size, malformed names, a name that ends before unmapped memory, and a sweep that no record contains an address, a path, long hex or a number over 32 bits.It is registered in
CMakeLists.txtafterstartup_triage_runand in the Python check list of.github/workflows/windows.ymlnext tostartup_triage_run_check.py.Results (Linux, local; mutation and merge-tree runs at the earlier head 9a3c446)
python3 -B tests/startup_msvc_throw_info_check.py: 89 ok, PASS (head 49ca19e).msvc_throw_info.py, each restored withgit checkout --; all nine fail the test: magic not checked, facility0x87Achanged to0x87B, cap>=instead of>, other classes reported by name, negative count accepted, type name read at +8, scalar size not checked, two DXGI names swapped, a raising callback not caught.tests/docs_links_check.pyandtests/bidi_controls_check.pypass;git diff --check origin/main...HEADis clean.git merge-treeof this branch against the head of every open PR (109, including startup: hold other threads while a hook steps over its byte #1408, startup: pass OMSetStencilRef (slot 24) to the desktop list #1787, startup: name the command list slots the noop log can state #1788, build: write the variants of each x87 fixture in one Python process #1789): no conflict thatorigin/maindoes not already have.Not run, not established
unrecognized_failure.AI-assisted; commands listed were executed locally.