Name is_debug_panic and fix ASSERT/PANIC macros (#1061)

* Name is_debug_panic and revamp ASSERT/PANIC macros

* Update src/is_debug.c

Co-authored-by: Alex Bates <16batesa@gmail.com>
This commit is contained in:
0xfedfedfe 2023-05-22 15:38:20 +01:00 committed by GitHub
parent f770d12db4
commit 9457e315a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View File

@ -17,6 +17,7 @@ void boot_idle(void* data);
void boot_main(void* data);
void is_debug_init(void);
void is_debug_panic(const char* message, char* file, s32 line);
f32 signF(f32 val);

View File

@ -57,18 +57,16 @@
#define VIRTUAL_TO_PHYSICAL(addr) (u32)((u8*)(addr) - 0x80000000)
#ifdef DEBUG
#define IS_DEBUG_PANIC(statement, file, line) is_debug_panic(statement, file, line)
#else
#define IS_DEBUG_PANIC(statement, file, line) do {} while(TRUE)
#endif
#define PANIC() IS_DEBUG_PANIC("Panic", __FILE__, __LINE__)
#define ASSERT(condition) \
if (!(condition)) { \
func_80025F44("Assertion failed: " #condition, __FILE__, __LINE__); \
while (TRUE) {} \
IS_DEBUG_PANIC("Assertion failed: " #condition, __FILE__, __LINE__); \
}
#define PANIC() \
func_80025F44("Panic!", __FILE__, __LINE__); \
while (TRUE) {}
#else
#define ASSERT(condition) if (!(condition)) { while (TRUE) {} }
#define PANIC() while (TRUE) {}
#endif
#define BADGE_MENU_PAGE(index) (&gPauseBadgesPages[index])
#define ITEM_MENU_PAGE(index) (&gPauseItemsPages[index])

View File

@ -89,7 +89,7 @@ char* is_debug_print(char* arg0, const char* str, size_t count) {
return (char*) 1;
}
void func_80025F44(const char* message, char* file, s32 line) {
void is_debug_panic(const char* message, char* file, s32 line) {
osSyncPrintf("File:%s Line:%d %s \n", file, line, message);
PANIC();
do {} while (TRUE);
}

View File

@ -12,7 +12,7 @@ printf = 0x80025CC0; // type:func rom:0x10C0
osSyncPrintf = 0x80025CFC; // type:func rom:0x10FC
rmonPrintf = 0x80025D38; // type:func rom:0x1138
is_debug_print = 0x80025D74; // type:func rom:0x1174
func_80025F44 = 0x80025F44; // type:func rom:0x1344
is_debug_panic = 0x80025F44; // type:func rom:0x1344
boot_main = 0x80025F70; // type:func rom:0x1370
gfxRetrace_Callback = 0x8002605C; // type:func rom:0x145C
gfx_task_main = 0x80026164; // type:func rom:0x1564