Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions include/coreinit/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef struct OSFatalError OSFatalError;
typedef void (*DisassemblyPrintFn)(const char *fmt, ...);

typedef uint32_t (*DisassemblyFindSymbolFn)(uint32_t addr, char *symbolNameBuf, uint32_t symbolNameBufSize);
typedef void (*OSPanicCallback)(void *userData);

typedef enum DisassemblePPCFlags
{
Expand All @@ -41,8 +42,11 @@ typedef enum OSFatalErrorMessageType
struct OSFatalError
{
OSFatalErrorMessageType messageType;
//! Error code, displayed on screen as unsigned, and printed in log as signed
uint32_t errorCode;
//! See \link OSGetUPID \endlink
uint32_t processId;
//! Internal error code printed in log
uint32_t internalErrorCode;
uint32_t line;
char functionName[64];
Expand Down Expand Up @@ -83,22 +87,49 @@ void
OSReportWarn(const char *fmt, ...)
WUT_FORMAT_PRINTF(1, 2);


/**
* Halts the system and logs the cause, traps if debugger is present
* \param file name of the file where the panic occurred
* \param line position in the file where the panic occurred
* \param fmt printf-style format string for logging
*
* \sa OSSetPanicCallback
*/
void
OSPanic(const char *file,
uint32_t line,
const char *fmt,
...)
WUT_FORMAT_PRINTF(3, 4);
WUT_FORMAT_PRINTF(3, 4) WUT_NORETURN;

/**
* Set a callback to be triggered when an \link OSPanic \endlink occurs
* \param userData data to pass to the callback
*/
void
OSSetPanicCallback(OSPanicCallback callback,
void *userData);

/**
* Displays a message on TV and gamepad screens via OSScreen, and halts the system via \link OSPanic \endlink
* \param msg message to be displayed and logged
* \sa coreinit_screen
*/
void
OSFatal(const char *msg);
OSFatal(const char *msg) WUT_NORETURN;

/**
* Switch to the fatal error process ("An error has occured." screen)
* \param error structure describing the error
* \param functionName function name printed in log
* \param line line number printed in log
*
* The fatal error process displays the error code, firmware version, Wii U model, serial number and status code
*/
void
OSSendFatalError(OSFatalError *error,
const char *functionName,
uint32_t line);
uint32_t line) WUT_NORETURN;

uint32_t
OSGetSymbolName(uint32_t addr,
Expand Down
1 change: 1 addition & 0 deletions include/wut.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#define WUT_DEPRECATED(reason) __attribute__((__deprecated__(reason)))
#define WUT_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
#define WUT_NORETURN __attribute__((noreturn))

#else // not __GNUC__ and not __clang__

Expand Down