Proposal: an opt-in trace of every system library call a title makes (APS5_TRACE_CALLS) #3815
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 kr4y4 on 2026-10-11T17:03:19Z.
Proposal: an opt-in trace of every system library call a title makes
When a title stops early, finding which call went wrong is mostly manual work.
In #3308, for example, finding the Cyberpunk 2077 stop took locating a call site by hand: "call site at address 0x1d762d2 in the converted
app.elf, PLT slot of NIDwzvqT4UqKX8". The ~25APS5_TRACE_*switches each cover one subsystem (GPU, draws, AJM, timers, waits, …). None of them shows the boundary between the title and the libraries: which import was called, from which thread, with which arguments, and what AnyPS5 returned.I'd like to add one switch for that, off by default:
When the switch is set, each call through a traced import would write a record:
sceKernelOpen,sceKernelStat, …), the path string as well.The import index maps to NID and library through the
--registryoutput that already exists. Names come fromtools/nid_names.py's database when given, so nothing new is shipped. A small tool would print the records as text, and could diff two runs. Diffing would show where a run changed after a PR, or between Windows and Linux, or NVIDIA and Intel. A trace from real hardware could be compared the same way, if one ever exists.Example output after formatting:
Where to hook (this is my question)
Windows. The relinker's entry stub already resolves every import itself (
WindowsEntryStubBuilder,GetProcAddress, thenWriteImport). With tracing on, it could write the address of a per-import trampoline instead of the function's address.Linux.
ld.sobinds the imports (DF_BIND_NOW), so there are two options:DT_JMPREL/GLOB_DATslots.Which of the two would you take, or is there a better place?
Details I'd plan for
exit,longjmp, thread exit, …) are logged at entry only.Is this something you'd want in the tree? I'd rather hear "no" or "do it differently" before writing it.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-12T15:23:41Z.
A partial implementation is up for review in #4546 (runtime) and #4547 (relinker option
--trace-imports). It is your option (a), reduced: Windows only, the entry of each call (import, library, thread, caller address) and per-import counts, shown by the crash and abort reports. Arguments, return values, path strings, a full on-disk trace, diffing and Linux are not done, so most of this proposal is still open.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T16:44:24Z.
We have local env-controlled traces from title bring-up that sit next to what #4546/#4547 add, and I would like to know which of them are wanted before opening anything. I am not proposing another call trace: #4546/#4547 cover the import calls, and #4526 the present-window summary, so those stay out.
What I would send as one pull request, if it is wanted:
WriteLogLine(off by default, one environment switch, so existing logs keep their format);SetThreadDescription), so a thread dump or a profiler names them;docs/dev/TRACING.mdthat lists everyAPS5_TRACE_*switch found in the code with what it prints; none of the roughly 40 files that read one is documented underdocs/today.Questions: is a single pull request fine for these three, and should the switch be called
APS5_LOG_TIMESTAMPS(the existing switches areAPS5_TRACE_<AREA>)?AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:10:03Z.
#4546 and #4547 cover the import trace on Windows. For the rest, one PR per topic: the timestamp prefix, the thread names and the list of trace switches are three.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T13:55:53Z.
The timestamp-prefix topic is now in #5860.
APS5_LOG_TIMESTAMPSis off by default; enabled lines get a monotonic elapsed-time prefix emitted in the same write as the message. The default and timestamped short/long/no-argument log cases pass in the focused Linux test. The trace-switch reference is separate in #5854; thread names remain their own topic.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T14:02:41Z.
The host thread-name topic is now in #5862. It uses the existing presenter/queue-worker role labels and resolves
SetThreadDescriptiondynamically; a Windows test reads the assigned name back when supported. The timestamp topic is #5860 and the trace-switch reference is #5854.