diff options
author | Princess of Sleeping | 2020-10-31 18:08:35 +0900 |
---|---|---|
committer | Reiko Asakura | 2020-10-31 18:08:35 +0900 |
commit | 5ac64be951c77e4843da544dcd4c949fa6e013ce (patch) | |
tree | 0e628833c5e7fe490f357ac6a616681224931e66 | |
parent | Add function prototypes in sysroot.h (diff) | |
download | vds-libraries-5ac64be951c77e4843da544dcd4c949fa6e013ce.tar.gz |
Update function args and doc in debug.h
-rw-r--r-- | include/kernel/kernel/sysmem/debug.h | 89 |
1 files changed, 73 insertions, 16 deletions
diff --git a/include/kernel/kernel/sysmem/debug.h b/include/kernel/kernel/sysmem/debug.h index 5d5335b..bb10126 100644 --- a/include/kernel/kernel/sysmem/debug.h +++ b/include/kernel/kernel/sysmem/debug.h @@ -8,37 +8,87 @@ #include <stdarg.h> #include <cdefs.h> +#include <libdbg.h> #include <scetypes.h> SCE_CDECL_BEGIN +/** + * @brief Print log + * + * @param[in] fmt - print fmt + * + * @return 0 on success, < 0 on error. + * + * @note - log is pass to sceDebugRegisterPutcharHandler's handler. + */ __attribute__((__format__(__printf__, 1, 2))) int sceDebugPrintf(const char *fmt, ...); typedef struct SceKernelDebugMessageContext { - int hex_value0_hi; - int hex_value0_lo; - int hex_value1; - char *msg0; - SceSize num; - char *msg1; + SceUInt32 hex_value0_hi; + SceUInt32 hex_value0_lo; + SceUInt32 hex_value1; + const char *func; + SceSize line; + const char *file; } SceKernelDebugMessageContext; -// msg_type_flag : 0 or 0xB +typedef enum SceKernelDebugPrintFlags { + SCE_DBG_PRINT_FLAG_NONE = 0, + SCE_DBG_PRINT_FLAG_CORE = 1, + SCE_DBG_PRINT_FLAG_FUNC = 2, + SCE_DBG_PRINT_FLAG_LINE = 4, + SCE_DBG_PRINT_FLAG_FILE = 8 +} SceKernelDebugPrintFlags; + +/** + * @brief Print log with ctx + * + * @param[in] flags - ctx print flags, see:SceKernelDebugPrintFlags + * @param[in] ctx - debug msg ctx + * @param[in] fmt - print fmt + * + * @return 0 on success, < 0 on error. + * + * @note - main log is pass to sceDebugRegisterPutcharHandler's handler. + * ctx log is pass to sceDebugSetHandlers's handler. + */ __attribute__((__format__(__printf__, 3, 4))) -int sceDebugPrintf2(int msg_type_flag, const SceKernelDebugMessageContext *ctx, const char *fmt, ...); +int sceDebugPrintf2(int flags, const SceKernelDebugMessageContext *ctx, const char *fmt, ...); int sceDebugVprintf(const char *fmt, va_list args); -int sceDebugPrintKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address); - -__attribute__((__format__(__printf__, 3, 4))) -int sceDebugPrintfKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address, const char *fmt, ...); - -int sceDebugPrintKernelAssertion(int condition, const SceKernelDebugMessageContext *ctx, void *some_address); - +__attribute__((__noreturn__)) +int sceDebugPrintKernelPanic(const SceKernelDebugMessageContext *ctx, const void *lr); + +__attribute__((__noreturn__, __format__(__printf__, 3, 4))) +int sceDebugPrintfKernelPanic(const SceKernelDebugMessageContext *ctx, const void *lr, const char *fmt, ...); + +/** + * @brief Assertion with ctx + * + * @param[in] condition - condition + * @param[in] ctx - debug msg ctx + * @param[in] lr - The link register + * + * @return 0 on success, < 0 on error. + */ +int sceDebugPrintKernelAssertion(int condition, const SceKernelDebugMessageContext *ctx, const void *lr); + +/** + * @brief Assertion with ctx and Print + * + * @param[in] level - print level, see:SceDbgLogLevel + * @param[in] condition - condition + * @param[in] ctx - debug msg ctx + * @param[in] lr - The link register + * @param[in] fmt - print fmt + * + * @return 0 on success, < 0 on error. + */ __attribute__((__format__(__printf__, 5, 6))) -int sceDebugPrintfKernelAssertion(int unk, int condition, const SceKernelDebugMessageContext *ctx, int some_address, const char *fmt, ...); +int sceDebugPrintfKernelAssertion(int level, int condition, const SceKernelDebugMessageContext *ctx, const void *lr, const char *fmt, ...); int sceDebugSetHandlers(int (*func)(int unk, const char *format, const va_list args), void *args); @@ -48,6 +98,13 @@ void *sceDebugGetPutcharHandler(void); int sceDebugPutchar(int character); +/** + * @brief Set kpanic flag + * + * @param[in] flag - If pass not zero to flag, kpanic is not stopped and do smc 0x122. + * + * @return previous flag. + */ int sceDebugDisableInfoDump(int flag); SCE_CDECL_END |