mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
TraceImport_nid_no_patch wraps a function of a library named in APS5_TRACE_CALLS in a thunk that records the import, the thread and the caller in a ring and counts the call, then jumps to the function. One target keeps one thunk, so function pointers compare equal. The crash and abort reports print the last 64 calls and the 32 most called imports. Nothing calls TraceImport_nid_no_patch yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
705 B
C++
28 lines
705 B
C++
#ifndef CORE_LIBS_PRX_LIBC_INCLUDE_CALLTRACE_HPP
|
|
#define CORE_LIBS_PRX_LIBC_INCLUDE_CALLTRACE_HPP
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
struct CallTraceEntry {
|
|
std::uint64_t sequence;
|
|
std::uint64_t thread;
|
|
std::uint64_t returnAddress;
|
|
const char* name;
|
|
const char* library;
|
|
};
|
|
|
|
struct CallTraceCount {
|
|
std::uint64_t calls;
|
|
const char* name;
|
|
const char* library;
|
|
};
|
|
|
|
extern "C" {
|
|
void* TraceImport_nid_no_patch(void* target, const char* name, const char* library);
|
|
std::size_t CopyCallTrace_nid_no_patch(CallTraceEntry* entries, std::size_t capacity);
|
|
std::size_t CopyCallCounts_nid_no_patch(CallTraceCount* entries, std::size_t capacity, std::uint64_t* total);
|
|
}
|
|
|
|
#endif
|