Repository navigation
feat(libc): optionally dump indirect memory in Windows crash reports - #4780
Conversation
adriadam10
left a comment
There was a problem hiding this comment.
Thanks, the idea is fine and the code is small. One thing to fix:
core/libs/prx/libc/src/specifics/windows/CrashReport.cpp:285:GetEnvironmentVariableA("APS5_CRASH_INDIRECT_MEMORY", nullptr, 0) != 0returns the required buffer size including the terminator when the variable exists, so an empty value returns 1 and enables the dump. The description anddocs/user/USAGE.mdsay an empty variable keeps it disabled. Read the value into a small buffer and enable it only when it is non-empty (or exactly1, and then say so in USAGE.md, which currently documents=1while any value works).
Please also check the Windows build job once pushed (PR CI skips it; it runs on dispatch). Happy to merge after that.
50f5f3a to
139bc7b
Compare
|
Thanks @adriadam10! Rebased onto current \upstream/main\ and updated the \APS5_CRASH_INDIRECT_MEMORY\ environment check to read into a buffer so that an unset or empty variable keeps the indirect memory dump disabled as documented in \USAGE.md. |
|
I checked the updated environment-value handling at PR head One small boundary case remains: nonempty values that do not fit in the 16-byte buffer disable the option in my run.
At the longer lengths, The unchanged head AI-assisted: yes; fixture, execution and result checking assisted by Codex. |
…alue GetEnvironmentVariableA leaves the buffer undefined when the value does not fit, so a 16-byte read disabled longer settings. A size query treats every nonempty value as enabled and still leaves unset and empty disabled. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks @gunerky. The 16-byte buffer was the problem: when
|
adriadam10
left a comment
There was a problem hiding this comment.
Checked the env-value handling (GetEnvironmentVariableA with a null buffer returns 0 unset, 1 empty, >1 otherwise, so > 1 matches USAGE.md), the readability/executable skips and the 64-byte read, and the libc build and ctest on Linux; the Windows job covers the rest. Merging once the Windows build is green.
What
Windows crash reports show the words pointed to by registers, but stop before the structures those words reference. Set
APS5_CRASH_INDIRECT_MEMORY=1to include one additional pointer level: up to eight 64-byte blocks per register, labelled with the register, pointer offset and target address. The option is disabled when unset or empty. Executable targets and reads that fail or return fewer than 64 bytes are skipped throughReadProcessMemory.This is a generic diagnostic aid.
Tested
windows_exceptionsandguest_raise_exception: passed.upstream/mainand verified withtools/check_conventions.py --base upstream/main.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)