feat(libSceNKWebKit): implement WTF accumulated logs and dataLogFString #19828
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19828"
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 boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-14T00:50:08Z.
What
Implements three WTF logging exports in libSceNKWebKit that were throwing stubs:
WTF::resetAccumulatedLogs()clears the process-wide log accumulator.WTF::getAndResetAccumulatedLogs()returns the accumulated text as an 8-bitWTF::Stringand clears it. With nothing logged it returns the empty, non-null string.WTF::dataLogFString(const char*)forwards to the existingdataLogF("%s", str), so both exports write to the same place.WTFLognow fills the accumulator. On a channel in theOnWithAccumulationstate (2), it formats the message, adds a trailing newline when there isn't one, appends the message to the accumulator under a lock, and writes it to stderr. Off (0) and On (1) behave as before.This follows the pinned PS5 WebKit 11.x source:
WTFLoggingAccumulatorand theOnWithAccumulationbranch ofWTFLogVaList, which runscreateWithFormatAndArgumentsthenif (!loggingString.endsWith('\n'))beforeaccumulateandlogToStderr.StringImpl::empty().dataFile().printf("%s", str).The PR also adds
static_assertchecks for the existingWTFLogChannellayout (stateat 0,nameat 8,levelat 16,subsystemat 24, size 32). It removes the three inventory rows and adds a debt entry. That entry notes thatWTFLogWithLeveldoes not route accumulating channels through this path yet.tools/progress.py: libSceNKWebKit done goes from 3000 to 3003 and todo from 8258 to 8255, so 3 stubs are now implemented.Tested
WSL Ubuntu, g++, focused targets only:
1/1 Test #3930: nkwebkit_wtf .....Subprocess aborted***Exception(what(): _ZN3WTF20resetAccumulatedLogsEv).1/1 Test #3930: nkwebkit_wtf ..... Passed 0.01 seceach time.ctest -R '^public_headers':100% tests passed, 0 tests failed out of 65.The new test in
tests/Wtf.cppchecks:"a%d", 1, then"b\n", then an empty message, then"%c", 0xE9give"a1\nb\n\n\xE9\n", and a second read is empty.resetAccumulatedLogsdiscards a pending entry.dataLogFStringwrites without throwing.Not tested on Windows or on a console.
ccd0689b64merged onto main2ac33b4563(report):nkwebkit_wtfpassed 3/3, none skipped.66b9997f23: merged main3ae84d01bd3;Export.cppandInventoryExports.hppconflicted only on the adjacentdataLogFStringanddupCloseOnExecstubs, and both are now gone (this PR and #19103 implement them). The union merge re-added thedupCloseOnExecEiinventory row, which was dropped. The debt entry stays inlibSceNKWebKit.mduntil #21200: with only a fragment,check_conventions.pyflags the// Derived fromlines. WSL2 Ubuntu:nkwebkit_wtf_testsbuilt andctest -R ^nkwebkit_wtf$passed 1/1;check_conventions.py --base origin/mainpasses.e9f4cb7580donto main1d3c669c843: conflict only in themain()call list oftests/Wtf.cpp, where #19380 addedTestStackBoundsandTestTimingScopebeside this PR'sTestAccumulatedLogs; all three calls are kept. WSL2 Ubuntu, GCC, Release:nkwebkit_wtf_testsbuilt andctest -R ^nkwebkit_wtf$ --repeat until-fail:3passed.debt_fold.py --checkandcheck_conventions.py --base origin/mainpass.742090164cmerged onto main802a0aeb2d(report): full ctest suite run twice per machine; 2022 had 5 and 4 failures out of 6013, 2025 had 1 and 1, the same counts as main on the same runners, so none come from this PR.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)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T01:26:15Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ccd0689b64:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfAssert.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T19:17:11Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ccd0689b64:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfAssert.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T23:57:14Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
66b9997f23:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfAssert.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T22:21:10Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
e9f4cb7580:tools/check_conventions.pypassed.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfAssert.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T01:28:50Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
742090164c:tools/check_conventions.pypassed.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfAssert.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T02:40:11Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
742090164c58ca9268dc22d9964deadd4050f0a0, basemain. No merged-preview check.Results
Export.cppEmptyImplflags include the 8-bit bitWTFLogWithLevelnot accumulatingFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:140-148—AccumulateAndLogturns every byte of 0x80 or more into two UTF-8 bytes beforefputs. Text that is already UTF-8 reaches stderr doubled:é(C3 A9) prints asé. The accumulator at lines 131-136 keeps the raw bytes, and the On path at lines 329-340 writes bytes unchanged. Either writetextas it is to stderr, or say in the debt entry why the stderr copy is Latin-1.core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:133-134— past the 2^31 cap the exportedWTFLogthrowsstd::length_error, so a logging call throws through C linkage. The accumulator is only cleared bygetAndResetAccumulatedLogs, so it grows to the cap if nothing reads it. Decide what happens at the cap (drop new text, or keep the newest) and avoid throwing from a log call.Sources
WTFLogWTFLogWithLevelEmptyImplandCopyImplNot verified
LibcDetail::FormatWindowsmatches its declaration atWindowsFormatting.hpp:566, but the Windows path was not run.dataFile()is stdout on the PlayStation.tools/progress.pycounts (3000 to 3003). That file is not in the diff, and I did not recompute the counts.// Derived fromlines.CONVENTIONS.mdallows licence and copyright notices for adapted upstream code.AGENTS.mdhas no "Derived" text, so the exact form was not confirmed.Export.cpp,InventoryExports.hppanddocs/dev/debt/libSceNKWebKit.mdare too large for the review folder, so only their hunks were read.WtfExports.hpp,WtfAssert.cppandtests/Wtf.cppwere read through the diff and reader ranges, not in full. No file was excluded by rule.To get this to a good state
Nothing is required.
Optional: the two non-blocking points above.