7#ifndef __LIBDRAGON_DEBUG_H
8#define __LIBDRAGON_DEBUG_H
40#define DEBUG_FEATURE_LOG_USB (1 << 0)
62#define DEBUG_FEATURE_LOG_EMU (1 << 1)
95#define DEBUG_FEATURE_LOG_SD (1 << 2)
118#define DEBUG_FEATURE_FILE_SD (1 << 3)
131#define DEBUG_FEATURE_ALL 0xFF
137#define DEBUG_FEATURE_LOG_ISVIEWER DEBUG_FEATURE_LOG_EMU
141#define debug_init_isviewer debug_init_emulog
168 static inline bool debug_init(
int features)
192 #define debugf(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__)
207 #define assertf(expr, msg, ...) ({ \
208 if (!(expr)) debug_assert_func_f(__FILE__, __LINE__, __func__, #expr, msg, ##__VA_ARGS__); \
212 #define debug_init(ch) ({ false; })
213 #define debug_init_usblog() ({ false; })
214 #define debug_init_emulog() ({ false; })
215 #define debug_init_sdlog(fn,fmt) ({ false; })
216 #define debug_init_sdfs(prefix,np) ({ false; })
217 #define debugf(msg, ...) ({ })
218 #define assertf(expr, msg, ...) ({ })
259void debug_assert_func_f(
const char *file,
int line,
const char *func,
const char *failedexpr,
const char *msg, ...)
260 __attribute__((noreturn, format(printf, 5, 6)));
#define DEBUG_FEATURE_FILE_SD
Flag to activate filesystem access to files on CompactFlash/SD.
Definition debug.h:118
bool debug_init_sdlog(const char *fn, const char *openfmt)
Initialize SD logging.
Definition debug.c:590
#define DEBUG_FEATURE_LOG_USB
Flag to activate the USB logging channel.
Definition debug.h:40
#define DEBUG_FEATURE_LOG_EMU
Flag to activate the logging channel in emulators.
Definition debug.h:62
void debug_backtrace(void)
Dump a backtrace (call stack) via debugf.
Definition debug.c:729
#define DEBUG_FEATURE_LOG_SD
Flag to activate the logging on CompactFlash/SD card.
Definition debug.h:95
bool debug_init_sdfs(const char *prefix, int npart)
Initialize SD filesystem.
Definition debug.c:601
void debug_assert_func_f(const char *file, int line, const char *func, const char *failedexpr, const char *msg,...)
Underlying implementation function for assert() and assertf.
Definition debug.c:638
bool debug_init_usblog(void)
Initialize USB logging.
Definition debug.c:569
void debug_hexdump(const void *buffer, int size)
Do a hexdump of the specified buffer via debugf.
Definition debug.c:676
bool debug_init_emulog(void)
Initialize emulator logging.
Definition debug.c:580
void debug_close_sdfs(void)
Shutdown SD filesystem.
Definition debug.c:629