mirror of
https://github.com/aydencharles/onionHEN.git
synced 2026-10-22 03:42:46 -05:00
There were seven ways to log, each invented where the previous one was not
reachable:
OnionHEN_log libonion_platform, the only one with a file sink
shellui_log libonion_ipc, klog only — because it did not depend on
libonion_platform
game_log same body as shellui_log
onion_ipc_log same body again
logf libonion_ipc's IPC server, with a sink the host had to
register
log_msg onion_elfldr_server
crash_log util's fault handler, plus a second copy in common/
boot_log bootstrapper's fault handler
klog_printf / klog_puts / printf / puts, called directly
A message's destination therefore depended on which module happened to emit
it: ShellUI's ~300 records went to volatile klog and never reached a log file,
while the daemon's went to klog, stdout and disk.
Everything now goes through the LOG_* macros. All seven legacy entry points
are gone, and klog_printf survives only as a sink inside log.c.
The bare -nostdlib libraries deliberately did not get their own backend. Those
flags only affect the static library's own link step; each is linked into a
host with full libc and pthread, which is why they already called vsnprintf.
A second backend would have recreated the split this removes.
Levels were inferred from message text rather than applied uniformly — the old
entry points carried no severity, so a blanket mapping would either bury real
failures at debug or promote routine chatter to error. Result: 291 error, 63
warn, 140 info, 309 debug.
Consequences worth noting:
* ShellUI records now reach the log file, so a user report finally contains
what the injected process did. In release builds most of them are debug
and compile out, so this costs nothing on a retail unit.
* The IPC server's log-sink injection is gone; both servers registered the
same forwarder.
* common/backtrace.cpp and backtrace.hpp are deleted. That was a third copy
of the frame walking plus its own crash_log, and every caller of
printBacktrace/printBacktraceForCrash had already been commented out.
* Fault handlers use onion_log_emergency, so crash records go to the same
file as everything else instead of a separate crash log.
The shared entry point carries a printf format attribute, which the old
shellui_log explicitly avoided. That attribute found seven real format
defects: %p given typed pointers, %lx given a MonoObject*, %p given a
uint64_t, and %u given an unsigned long. Four of them only compile in debug
builds, so they had gone unnoticed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
62 lines
2.1 KiB
CMake
62 lines
2.1 KiB
CMake
###################################################################################################
|
|
# PS5SDK - Example: pipe pirate
|
|
# Uses the read/write primitive to read and write some kernel data.
|
|
# @authors ChendoChap, Specter, Znullptr
|
|
###################################################################################################
|
|
|
|
cmake_minimum_required (VERSION 3.20)
|
|
|
|
set(basename "NineS")
|
|
project(${basename} C)
|
|
|
|
set(D_CWD "${PROJECT_SOURCE_DIR}")
|
|
|
|
onion_module_prologue(C_STANDARD 17)
|
|
|
|
set(D_SRC ${D_CWD}/src)
|
|
|
|
set(SrcFiles
|
|
${D_SRC}/injector.c
|
|
${D_SRC}/main.c
|
|
${D_SRC}/notify.c
|
|
)
|
|
# pt.c / elfldr.c → libonion_elfldr; proc/ucred → libonion_proc
|
|
|
|
add_library(${PROJECT_NAME} STATIC ${SrcFiles})
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
|
|
|
|
# Finalize main target sources
|
|
target_compile_options(${PROJECT_NAME} PUBLIC
|
|
$<$<COMPILE_LANGUAGE:C>:${C_DEFS} ${C_FLAGS}>
|
|
)
|
|
|
|
set(CMAKE_C_FLAGS "${ONION_PS5_TARGET_FLAGS_MARCH} ")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112 -D__BSD_VISIBLE=1 -D__XSI_VISIBLE=500")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin -nostdlib -Wall") # -nostartfiles
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gfull -O3 -march=znver2 -Wall -Werror")
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
|
"${PROJECT_ROOT}/libonion_platform/include"
|
|
"${D_CWD}/include"
|
|
"${CMAKE_SOURCE_DIR}/libonion_proc/include"
|
|
"${CMAKE_SOURCE_DIR}/libonion_elfldr/include"
|
|
"${CMAKE_SOURCE_DIR}/include"
|
|
)
|
|
# When built as subproject of source/, CMAKE_SOURCE_DIR is source/
|
|
# Prefer PROJECT_ROOT if parent set it.
|
|
if(DEFINED PROJECT_ROOT)
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
|
"${PROJECT_ROOT}/libonion_platform/include"
|
|
"${PROJECT_ROOT}/libonion_proc/include"
|
|
"${PROJECT_ROOT}/libonion_elfldr/include"
|
|
"${PROJECT_ROOT}/include"
|
|
)
|
|
endif()
|
|
if(TARGET onion_proc)
|
|
add_dependencies(${PROJECT_NAME} onion_proc)
|
|
endif()
|
|
if(TARGET onion_elfldr)
|
|
add_dependencies(${PROJECT_NAME} onion_elfldr)
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC onion_elfldr)
|
|
endif()
|