vitasdk
Documentation of the vitasdk

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceDebugForDriver_stub



Functions

 VITASDK_BUILD_ASSERT_EQ (0x18, SceKernelDebugInfo)
 
int ksceKernelDebugPutchar (int character)
 
int ksceKernelPrintf (const char *fmt,...)
 Print log. More...
 
int ksceKernelPrintfLevel (SceUInt32 level, const char *fmt,...)
 Kernel Printf. More...
 
int ksceKernelPrintfLevelWithInfo (SceUInt32 level, SceUInt32 flags, const SceKernelDebugInfo *dbginfo, const char *fmt,...)
 Kernel Printf Level with Info. More...
 
int ksceKernelPrintfWithInfo (SceUInt32 flags, const SceKernelDebugInfo *dbginfo, const char *fmt,...)
 Kernel Printf with Info. More...
 
int ksceKernelVprintf (const char *fmt, va_list arg)
 Kernel Vprintf. More...
 
int ksceKernelVprintfLevel (SceUInt32 level, const char *fmt, va_list arg)
 Kernel Vprintf Level. More...
 
 __attribute__ ((__noreturn__)) void ksceKernelPanic(const SceKernelDebugInfo *dbginfo
 Kernel Panic. More...
 
const void const char void ksceKernelAssert (SceBool condition, const SceKernelDebugInfo *dbginfo, const void *lr)
 Assertion. More...
 
void ksceKernelAssertLevel (SceUInt32 level, SceBool condition, const SceKernelDebugInfo *dbginfo, const void *lr)
 Printf Assertion Level. More...
 
void ksceKernelPrintfAssertLevel (SceUInt32 level, SceBool condition, const SceKernelDebugInfo *dbginfo, const void *lr, const char *fmt,...)
 Printf Assertion Level. More...
 
int ksceKernelRegisterKprintfHandler (int(*handler)(int unk, const char *format, va_list args), void *argp)
 
int ksceKernelRegisterDebugPutcharHandler (int(*handler)(void *argp, char c), void *argp)
 
void * ksceKernelGetDebugPutcharHandler (void)
 
int ksceKernelEnableCrashDump (SceBool enable)
 Set CrashDump enable. More...
 
int ksceKernelGetAssertLevel (void)
 Get current minimum assertion level. More...
 
SceUInt32 ksceKernelSetAssertLevel (SceUInt32 level)
 Get current assert level. More...
 
struct SceKernelDebugEventLog1 __attribute__ ((packed)) SceKernelDebugEventLog1
 
 VITASDK_BUILD_ASSERT_EQ (0x1C, SceKernelDebugEventLog1)
 
 VITASDK_BUILD_ASSERT_EQ (4, SceKernelDebugEventLog2)
 
 VITASDK_BUILD_ASSERT_EQ (0x54, SceKernelDebugEventLog3)
 
 VITASDK_BUILD_ASSERT_EQ (0x54+0x40, SceKernelDebugEventLog)
 
int ksceEventLogGetInfo (void *buf, SceSize buf_size, SceSize *read_blocks)
 Get event log info. More...
 
int ksceKernelGetTtyInfo (char *buf, SceSize buf_size)
 Get tty log info. More...
 

Typedefs

typedef SceKernelDebugInfo SceKernelDebugMessageContext
 

Macros

#define __PSP2FILEHASH__   (0)
 
#define __PSP2FILE__   __FILE__
 
#define SCE_KERNEL_PANIC()
 
#define SCE_KERNEL_PRINTF_PANIC(__fmt__, ...)
 
#define SCE_KERNEL_ASSERT(__cond__)
 
#define SCE_KERNEL_ASSERT_LEVEL(__level__, __cond__)
 
#define SCE_KERNEL_PRINTF_LEVEL(__level__, __fmt__, ...)
 
#define ksceDebugPrintf   ksceKernelPrintf
 
#define ksceDebugPrintf2   ksceKernelPrintfWithInfo
 
#define ksceDebugPrintKernelPanic   ksceKernelPanic
 
#define ksceDebugPrintfKernelPanic   ksceKernelVprintfPanic
 
#define ksceDebugPrintKernelAssertion   ksceKernelAssert
 
#define ksceDebugPrintfKernelAssertion   ksceKernelPrintfAssertLevel
 
#define ksceKernelGetMinimumAssertionLevel   ksceKernelGetAssertLevel
 
#define ksceDebugPutchar   ksceKernelDebugPutchar
 
#define ksceDebugSetHandlers   ksceKernelRegisterKprintfHandler
 
#define ksceDebugRegisterPutcharHandler   ksceKernelRegisterDebugPutcharHandler
 
#define ksceDebugGetPutcharHandler   ksceKernelGetDebugPutcharHandler
 
#define ksceDebugDisableInfoDump   ksceKernelEnableCrashDump
 
#define ksceKernelSetMinimumAssertionLevel   ksceKernelSetAssertLevel
 

Data Structure Documentation

◆ SceKernelDebugInfo

struct SceKernelDebugInfo
Data Fields
union SceKernelDebugInfo __attribute__
const char * func
SceUInt32 line
const char * file

◆ SceKernelDebugEventLog1

struct SceKernelDebugEventLog1
Data Fields
int data_0x40
SceUID pid
int budget_type
int data_0x4C 0xA
char titleid[0xC]

◆ SceKernelDebugEventLog2

struct SceKernelDebugEventLog2
Data Fields
int data_0x40 0 or 0x80412118?

◆ SceKernelDebugEventLog3

struct SceKernelDebugEventLog3
Data Fields
int data_0x40 0?
char ip1[0x10]
char ip2[0x10]
char ip3[0x10]
char ip4[0x10]
char ip5[0x10]

◆ SceKernelDebugEventLog

struct SceKernelDebugEventLog
Data Fields
SceSize size struct size(variable size)
int data_0x04 0xA, maybe titleid size
char titleid[0xC] Title id of the process where the event occurred.
int flags Event flags.
SceUID ppid Parent process id.
SceUID data_0x1C Thread id?
int rsvd[4]
SceUInt64 time Time of the event occurred.
int data_0x38
SceSize item_size Event data size.
union SceKernelDebugEventLog __unnamed__

◆ SceKernelDebugInfo.__attribute__

union SceKernelDebugInfo.__attribute__
Data Fields
__attribute__ __unnamed__
__attribute__ __unnamed__

◆ SceKernelDebugInfo.__attribute__.__unnamed18__

struct SceKernelDebugInfo.__attribute__.__unnamed18__
Data Fields
SceUInt32 fileHash
SceUInt32 lineHash
SceUInt32 funcHash

◆ SceKernelDebugInfo.__attribute__.__unnamed20__

struct SceKernelDebugInfo.__attribute__.__unnamed20__
Data Fields
SceUInt32 hex_value0_hi
SceUInt32 hex_value0_lo
SceUInt32 hex_value1

◆ SceKernelDebugEventLog.__unnamed22__

union SceKernelDebugEventLog.__unnamed22__

Macro Definition Documentation

◆ __PSP2FILEHASH__

#define __PSP2FILEHASH__   (0)

◆ __PSP2FILE__

#define __PSP2FILE__   __FILE__

◆ SCE_KERNEL_PANIC

#define SCE_KERNEL_PANIC ( )
Value:
do { \
static const SceKernelDebugInfo __dbginfo = {.fileHash = __PSP2FILEHASH__, .lineHash = 0, .funcHash = 0, .func = __FUNCTION__, .line = __LINE__, .file = __PSP2FILE__}; \
ksceKernelPanic(&__dbginfo, __builtin_return_address(0)); \
} while(0)
#define __PSP2FILEHASH__
Definition: debug.h:179
#define __PSP2FILE__
Definition: debug.h:183
Definition: debug.h:20

◆ SCE_KERNEL_PRINTF_PANIC

#define SCE_KERNEL_PRINTF_PANIC (   __fmt__,
  ... 
)
Value:
do { \
static const SceKernelDebugInfo __dbginfo = {.fileHash = __PSP2FILEHASH__, .lineHash = 0, .funcHash = 0, .func = __FUNCTION__, .line = __LINE__, .file = __PSP2FILE__}; \
ksceKernelPrintfPanic(&__dbginfo, __builtin_return_address(0), __fmt__, ##__VA_ARGS__); \
} while(0)

◆ SCE_KERNEL_ASSERT

#define SCE_KERNEL_ASSERT (   __cond__)
Value:
do { \
static const SceKernelDebugInfo __dbginfo = {.fileHash = __PSP2FILEHASH__, .lineHash = 0, .funcHash = 0, .func = __FUNCTION__, .line = __LINE__, .file = __PSP2FILE__}; \
ksceKernelAssert(__cond__, &__dbginfo, __builtin_return_address(0)); \
} while(0)

◆ SCE_KERNEL_ASSERT_LEVEL

#define SCE_KERNEL_ASSERT_LEVEL (   __level__,
  __cond__ 
)
Value:
do { \
static const SceKernelDebugInfo __dbginfo = {.fileHash = __PSP2FILEHASH__, .lineHash = 0, .funcHash = 0, .func = __FUNCTION__, .line = __LINE__, .file = __PSP2FILE__}; \
ksceKernelAssertLevel(__level__, __cond__, &__dbginfo, __builtin_return_address(0)); \
} while(0)

◆ SCE_KERNEL_PRINTF_LEVEL

#define SCE_KERNEL_PRINTF_LEVEL (   __level__,
  __fmt__,
  ... 
)
Value:
do { \
static const SceKernelDebugInfo __dbginfo = {.fileHash = __PSP2FILEHASH__, .lineHash = 0, .funcHash = 0, .func = __FUNCTION__, .line = __LINE__, .file = __PSP2FILE__}; \
ksceKernelPrintfLevelWithInfo(__level__, 0xF, &__dbginfo, __fmt__, ##__VA_ARGS__); \
} while(0)

◆ ksceDebugPrintf

#define ksceDebugPrintf   ksceKernelPrintf

◆ ksceDebugPrintf2

#define ksceDebugPrintf2   ksceKernelPrintfWithInfo

◆ ksceDebugPrintKernelPanic

#define ksceDebugPrintKernelPanic   ksceKernelPanic

◆ ksceDebugPrintfKernelPanic

#define ksceDebugPrintfKernelPanic   ksceKernelVprintfPanic

◆ ksceDebugPrintKernelAssertion

#define ksceDebugPrintKernelAssertion   ksceKernelAssert

◆ ksceDebugPrintfKernelAssertion

#define ksceDebugPrintfKernelAssertion   ksceKernelPrintfAssertLevel

◆ ksceKernelGetMinimumAssertionLevel

#define ksceKernelGetMinimumAssertionLevel   ksceKernelGetAssertLevel

◆ ksceDebugPutchar

#define ksceDebugPutchar   ksceKernelDebugPutchar

◆ ksceDebugSetHandlers

#define ksceDebugSetHandlers   ksceKernelRegisterKprintfHandler

◆ ksceDebugRegisterPutcharHandler

#define ksceDebugRegisterPutcharHandler   ksceKernelRegisterDebugPutcharHandler

◆ ksceDebugGetPutcharHandler

#define ksceDebugGetPutcharHandler   ksceKernelGetDebugPutcharHandler

◆ ksceDebugDisableInfoDump

#define ksceDebugDisableInfoDump   ksceKernelEnableCrashDump

◆ ksceKernelSetMinimumAssertionLevel

#define ksceKernelSetMinimumAssertionLevel   ksceKernelSetAssertLevel

Typedef Documentation

◆ SceKernelDebugMessageContext

Enumeration Type Documentation

◆ SceKernelDebugInfoFlags

Enumerator
SCE_KERNEL_DEBUG_INFO_FLAG_NONE 
SCE_KERNEL_DEBUG_INFO_FLAG_CORE 
SCE_KERNEL_DEBUG_INFO_FLAG_FUNC 
SCE_KERNEL_DEBUG_INFO_FLAG_LINE 
SCE_KERNEL_DEBUG_INFO_FLAG_FILE 

◆ SceKernelDebugLevel

Enumerator
SCE_KERNEL_DEBUG_LEVEL_ALWAYS 
SCE_KERNEL_DEBUG_LEVEL_DEBUG 
SCE_KERNEL_DEBUG_LEVEL_TRACE 

◆ SceKernelAssertLevel

Enumerator
SCE_KERNEL_ASSERT_LEVEL_0 
SCE_KERNEL_ASSERT_LEVEL_1 
SCE_KERNEL_ASSERT_LEVEL_2 

Function Documentation

◆ VITASDK_BUILD_ASSERT_EQ() [1/5]

VITASDK_BUILD_ASSERT_EQ ( 0x18  ,
SceKernelDebugInfo   
)

◆ ksceKernelDebugPutchar()

int ksceKernelDebugPutchar ( int  character)

◆ ksceKernelPrintf()

int ksceKernelPrintf ( const char *  fmt,
  ... 
)

Print log.

Parameters
[in]fmt- print fmt
Returns
0 on success, < 0 on error.
Note
- log is pass to ksceDebugRegisterPutcharHandler's handler.

◆ ksceKernelPrintfLevel()

int ksceKernelPrintfLevel ( SceUInt32  level,
const char *  fmt,
  ... 
)

Kernel Printf.

Parameters
[in]level- The printf level. see::SceKernelDebugLevel
[in]fmt- The text format

◆ ksceKernelPrintfLevelWithInfo()

int ksceKernelPrintfLevelWithInfo ( SceUInt32  level,
SceUInt32  flags,
const SceKernelDebugInfo dbginfo,
const char *  fmt,
  ... 
)

Kernel Printf Level with Info.

Parameters
[in]level- The printf level. see::SceKernelDebugLevel
[in]flags- The debug info flags
[in]dbginfo- The debug info
[in]fmt- The text format

◆ ksceKernelPrintfWithInfo()

int ksceKernelPrintfWithInfo ( SceUInt32  flags,
const SceKernelDebugInfo dbginfo,
const char *  fmt,
  ... 
)

Kernel Printf with Info.

Parameters
[in]flags- ctx print flags, see:SceKernelDebugPrintFlags
[in]dbginfo- debug info
[in]fmt- print fmt
Returns
0 on success, < 0 on error.
Note
- main log is pass to ksceDebugRegisterPutcharHandler's handler. dbginfo log is pass to sceKernelRegisterKprintfHandler's handler.

◆ ksceKernelVprintf()

int ksceKernelVprintf ( const char *  fmt,
va_list  arg 
)

Kernel Vprintf.

Parameters
[in]fmt- The text format
[in]arg- The fmt list

◆ ksceKernelVprintfLevel()

int ksceKernelVprintfLevel ( SceUInt32  level,
const char *  fmt,
va_list  arg 
)

Kernel Vprintf Level.

Parameters
[in]level- The printf level. see::SceKernelDebugLevel
[in]fmt- The text format
[in]arg- The fmt list

◆ __attribute__() [1/2]

__attribute__ ( (__noreturn__)  ) const

Kernel Panic.

Kernel Printf Panic.

Parameters
[in]dbginfo- The debug info
[in]lr- The link register
[in]dbginfo- The debug info
[in]lr- The link register
[in]fmt- The text format

◆ ksceKernelAssert()

const void const char void ksceKernelAssert ( SceBool  condition,
const SceKernelDebugInfo dbginfo,
const void *  lr 
)

Assertion.

The condition SCE_FALSE to stopped CPU core.

Parameters
[in]condition- The condition
[in]dbginfo- The debug info
[in]lr- The link register
Returns
none.

◆ ksceKernelAssertLevel()

void ksceKernelAssertLevel ( SceUInt32  level,
SceBool  condition,
const SceKernelDebugInfo dbginfo,
const void *  lr 
)

Printf Assertion Level.

The condition SCE_FALSE to stopped CPU core.

Parameters
[in]level- The print level. see:SceKernelAssertLevel
[in]condition- The condition
[in]dbginfo- The debug info
[in]lr- The link register
Returns
none.

◆ ksceKernelPrintfAssertLevel()

void ksceKernelPrintfAssertLevel ( SceUInt32  level,
SceBool  condition,
const SceKernelDebugInfo dbginfo,
const void *  lr,
const char *  fmt,
  ... 
)

Printf Assertion Level.

The condition SCE_FALSE to stopped CPU core.

Parameters
[in]level- The print level. see:SceKernelAssertLevel
[in]condition- The condition
[in]dbginfo- The debug info
[in]lr- The link register
[in]fmt- The text fmt
Returns
none.

◆ ksceKernelRegisterKprintfHandler()

int ksceKernelRegisterKprintfHandler ( int(*)(int unk, const char *format, va_list args)  handler,
void *  argp 
)

◆ ksceKernelRegisterDebugPutcharHandler()

int ksceKernelRegisterDebugPutcharHandler ( int(*)(void *argp, char c)  handler,
void *  argp 
)

◆ ksceKernelGetDebugPutcharHandler()

void* ksceKernelGetDebugPutcharHandler ( void  )

◆ ksceKernelEnableCrashDump()

int ksceKernelEnableCrashDump ( SceBool  enable)

Set CrashDump enable.

Parameters
[in]enable- pass SCE_TRUE to do reboot on kernel panic or kernel assert failed.
Returns
previous flag.

◆ ksceKernelGetAssertLevel()

int ksceKernelGetAssertLevel ( void  )

Get current minimum assertion level.

Returns
current minimum assertion level.

◆ ksceKernelSetAssertLevel()

SceUInt32 ksceKernelSetAssertLevel ( SceUInt32  level)

Get current assert level.

Parameters
[in]level- new assert level
Returns
previous assert level.

◆ __attribute__() [2/2]

struct SceKernelDebugEventLog1 __attribute__ ( (packed)  )

◆ VITASDK_BUILD_ASSERT_EQ() [2/5]

VITASDK_BUILD_ASSERT_EQ ( 0x1C  ,
SceKernelDebugEventLog1   
)

◆ VITASDK_BUILD_ASSERT_EQ() [3/5]

VITASDK_BUILD_ASSERT_EQ ( ,
SceKernelDebugEventLog2   
)

◆ VITASDK_BUILD_ASSERT_EQ() [4/5]

VITASDK_BUILD_ASSERT_EQ ( 0x54  ,
SceKernelDebugEventLog3   
)

◆ VITASDK_BUILD_ASSERT_EQ() [5/5]

VITASDK_BUILD_ASSERT_EQ ( 0x54+  0x40,
SceKernelDebugEventLog   
)

◆ ksceEventLogGetInfo()

int ksceEventLogGetInfo ( void *  buf,
SceSize  buf_size,
SceSize read_blocks 
)

Get event log info.

Parameters
[out]buf- The SceKernelDebugEventLog buffer list
[in]buf_size- The buf size
[out]read_blocks- The read event log number
Returns
< 0 on error.

◆ ksceKernelGetTtyInfo()

int ksceKernelGetTtyInfo ( char *  buf,
SceSize  buf_size 
)

Get tty log info.

Parameters
[out]buf- The tty log buffer
[in]buf_size- The buf size
Returns
log length on success, < 0 on error.