From e84ef132ae5a98ad235b93c2838c5a812be8db1b Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 28 Jun 2021 12:10:22 -0500 Subject: [PATCH] [xboxkrnl] Log strings for string formatters. --- src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc index 4ea9c7f1f..bc6e71397 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc @@ -841,8 +841,8 @@ SHIM_CALL _snprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { int32_t buffer_count = SHIM_GET_ARG_32(1); uint32_t format_ptr = SHIM_GET_ARG_32(2); - XELOGD("_snprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count, - format_ptr); + XELOGD("_snprintf({:08X}, {}, {:08X}({}), ...)", buffer_ptr, buffer_count, + format_ptr, xe::load_and_swap(SHIM_MEM_ADDR(format_ptr))); if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -877,7 +877,8 @@ SHIM_CALL sprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t buffer_ptr = SHIM_GET_ARG_32(0); uint32_t format_ptr = SHIM_GET_ARG_32(1); - XELOGD("sprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr); + XELOGD("sprintf({:08X}, {:08X}({}), ...)", buffer_ptr, format_ptr, + xe::load_and_swap(SHIM_MEM_ADDR(format_ptr))); if (buffer_ptr == 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -906,8 +907,10 @@ SHIM_CALL _snwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { int32_t buffer_count = SHIM_GET_ARG_32(1); uint32_t format_ptr = SHIM_GET_ARG_32(2); - XELOGD("_snwprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count, - format_ptr); + XELOGD("_snwprintf({:08X}, {}, {:08X}({}), ...)", buffer_ptr, buffer_count, + format_ptr, + xe::to_utf8( + xe::load_and_swap(SHIM_MEM_ADDR(format_ptr)))); if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -942,7 +945,9 @@ SHIM_CALL swprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t buffer_ptr = SHIM_GET_ARG_32(0); uint32_t format_ptr = SHIM_GET_ARG_32(1); - XELOGD("swprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr); + XELOGD("swprintf({:08X}, {:08X}({}), ...)", buffer_ptr, format_ptr, + xe::to_utf8( + xe::load_and_swap(SHIM_MEM_ADDR(format_ptr)))); if (buffer_ptr == 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -972,8 +977,9 @@ SHIM_CALL _vsnprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t format_ptr = SHIM_GET_ARG_32(2); uint32_t arg_ptr = SHIM_GET_ARG_32(3); - XELOGD("_vsnprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count, - format_ptr, arg_ptr); + XELOGD("_vsnprintf({:08X}, {}, {:08X}({}), {:08X})", buffer_ptr, buffer_count, + format_ptr, xe::load_and_swap(SHIM_MEM_ADDR(format_ptr)), + arg_ptr); if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -1012,8 +1018,11 @@ SHIM_CALL _vsnwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t format_ptr = SHIM_GET_ARG_32(2); uint32_t arg_ptr = SHIM_GET_ARG_32(3); - XELOGD("_vsnwprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count, - format_ptr, arg_ptr); + XELOGD( + "_vsnwprintf({:08X}, {}, {:08X}({}), {:08X})", buffer_ptr, buffer_count, + format_ptr, + xe::to_utf8(xe::load_and_swap(SHIM_MEM_ADDR(format_ptr))), + arg_ptr); if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -1051,7 +1060,8 @@ SHIM_CALL vsprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t format_ptr = SHIM_GET_ARG_32(1); uint32_t arg_ptr = SHIM_GET_ARG_32(2); - XELOGD("vsprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr); + XELOGD("vsprintf({:08X}, {:08X}({}), {:08X})", buffer_ptr, format_ptr, + xe::load_and_swap(SHIM_MEM_ADDR(format_ptr)), arg_ptr); if (buffer_ptr == 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -1079,7 +1089,10 @@ SHIM_CALL _vscwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t format_ptr = SHIM_GET_ARG_32(0); uint32_t arg_ptr = SHIM_GET_ARG_32(1); - XELOGD("_vscwprintf({:08X}, {:08X})", format_ptr, arg_ptr); + XELOGD( + "_vscwprintf({:08X}({}), {:08X})", format_ptr, + xe::to_utf8(xe::load_and_swap(SHIM_MEM_ADDR(format_ptr))), + arg_ptr); if (format_ptr == 0) { SHIM_SET_RETURN_32(-1); @@ -1102,7 +1115,10 @@ SHIM_CALL vswprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) { uint32_t format_ptr = SHIM_GET_ARG_32(1); uint32_t arg_ptr = SHIM_GET_ARG_32(2); - XELOGD("vswprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr); + XELOGD( + "vswprintf({:08X}, {:08X}({}), {:08X})", buffer_ptr, format_ptr, + xe::to_utf8(xe::load_and_swap(SHIM_MEM_ADDR(format_ptr))), + arg_ptr); if (buffer_ptr == 0 || format_ptr == 0) { SHIM_SET_RETURN_32(-1);