27#include "common/str.h"
29#define __PSP_PRINT_TO_FILE_AND_SCREEN__
32#ifdef __PSP_PRINT_TO_FILE__
33 #define __PSP_PRINT__(format,...) PspDebugTrace(false, format, ## __VA_ARGS__)
34#elif defined(__PSP_PRINT_TO_FILE_AND_SCREEN__)
35 #define __PSP_PRINT__(format,...) PspDebugTrace(true, format, ## __VA_ARGS__)
37 #define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__)
41#define PSP_ERROR(format,...) PspDebugTrace(true, "Error in %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__)
44#define __PSP_INDENT__ for(int _i=psp_debug_indent; _i>0; _i--) \
48#define PSP_INFO_PRINT(format,...) __PSP_PRINT__(format, ## __VA_ARGS__)
50#define PSP_INFO_PRINT_INDENT(format,...) { __PSP_INDENT__; \
51 __PSP_PRINT__(format, ## __VA_ARGS__); }
53void PspDebugTrace(
bool alsoToScreen,
const char *format, ...);
54void mipsBacktrace(uint32 levels,
void **addresses);
56extern int psp_debug_indent;
66 PSP_INFO_PRINT_INDENT(
"++ %s\n", _name.c_str());
72 if (psp_debug_indent < 0)
73 PSP_ERROR(
"debug indent < 0\n");
74 PSP_INFO_PRINT_INDENT(
"-- %s\n", _name.c_str());
93#undef PSP_DEBUG_PRINT_FUNC
94#undef PSP_DEBUG_PRINT_SAMELN
96#undef DEBUG_ENTER_FUNC
99#ifdef __PSP_DEBUG_PRINT__
101#define PSP_DEBUG_PRINT_SAMELN(format,...) __PSP_PRINT__(format, ## __VA_ARGS__)
102#define PSP_DEBUG_PRINT(format,...) PSP_INFO_PRINT_INDENT(format, ## __VA_ARGS__)
103#define PSP_DEBUG_PRINT_FUNC(format,...) { __PSP_INDENT__; \
104 __PSP_PRINT__("In %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__); }
105#define PSP_DEBUG_DO(x) (x)
108 #define PSP_DEBUG_PRINT_SAMELN(format,...)
109 #define PSP_DEBUG_PRINT(format,...)
110 #define PSP_DEBUG_PRINT_FUNC(format,...)
111 #define PSP_DEBUG_DO(x)
116#ifdef __PSP_DEBUG_FUNCS__
117 #define DEBUG_ENTER_FUNC() volatile PSPStackDebugFuncs __foo(__PRETTY_FUNCTION__)
119 #define DEBUG_ENTER_FUNC()
123#undef __PSP_PRINT_TO_FILE__
124#undef __PSP_PRINT_TO_FILE_AND_SCREEN__
125#undef __PSP_DEBUG_FUNCS__
126#undef __PSP_DEBUG_PRINT__