--- hatari/src/debug/log.h 2019/04/09 08:49:25 1.1.1.2 +++ hatari/src/debug/log.h 2019/04/09 08:55:33 1.1.1.7 @@ -1,8 +1,8 @@ /* Hatari - log.h - This file is distributed under the GNU Public License, version 2 or at - your option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. */ #ifndef HATARI_LOG_H #define HATARI_LOG_H @@ -11,6 +11,39 @@ #include +/* Exception debugging + * ------------------- + */ + +/* CPU exception flags + * is catching needed also for: traps 0, 3-12, 15? (MonST catches them) + */ +#define EXCEPT_BUS (1<<0) +#define EXCEPT_ADDRESS (1<<1) +#define EXCEPT_ILLEGAL (1<<2) +#define EXCEPT_ZERODIV (1<<3) +#define EXCEPT_CHK (1<<4) +#define EXCEPT_TRAPV (1<<5) +#define EXCEPT_PRIVILEGE (1<<6) +#define EXCEPT_NOHANDLER (1<<7) + +/* DSP exception flags */ +#define EXCEPT_DSP (1<<8) + +/* whether to enable exception debugging on autostart */ +#define EXCEPT_AUTOSTART (1<<9) + +/* general flags */ +#define EXCEPT_NONE (0) +#define EXCEPT_ALL (~EXCEPT_AUTOSTART) + +/* defaults are same as with earlier -D option */ +#define DEFAULT_EXCEPTIONS (EXCEPT_BUS|EXCEPT_ADDRESS|EXCEPT_DSP) + +extern int ExceptionDebugMask; +extern const char* Log_SetExceptionDebugMask(const char *OptionsStr); + + /* Logging * ------- * Is always enabled as it's information that can be useful @@ -34,6 +67,7 @@ typedef enum #define __attribute__(foo) #endif +extern void Log_Default(void); extern int Log_Init(void); extern int Log_SetAlertLevel(int level); extern void Log_UnInit(void); @@ -90,34 +124,53 @@ extern char *Log_MatchTrace(const char * #define TRACE_FDC (1<<19) -#define TRACE_IKBD_CMDS (1<<20) -#define TRACE_IKBD_ACIA (1<<21) -#define TRACE_IKBD_EXEC (1<<22) - -#define TRACE_BLITTER (1<<23) - -#define TRACE_OS_BIOS (1<<24) -#define TRACE_OS_XBIOS (1<<25) -#define TRACE_OS_GEMDOS (1<<26) -#define TRACE_OS_VDI (1<<27) -#define TRACE_OS_AES (1<<28) - -#define TRACE_IOMEM_RD (1<<29) -#define TRACE_IOMEM_WR (1<<30) - -#define TRACE_DMASND (1<<31) - -#define TRACE_CROSSBAR (1ll<<32) -#define TRACE_VIDEL (1ll<<33) - -#define TRACE_DSP_HOST_INTERFACE (1ll<<34) -#define TRACE_DSP_HOST_COMMAND (1ll<<35) -#define TRACE_DSP_HOST_SSI (1ll<<36) -#define TRACE_DSP_DISASM (1ll<<37) -#define TRACE_DSP_DISASM_REG (1ll<<38) -#define TRACE_DSP_DISASM_MEM (1ll<<39) -#define TRACE_DSP_STATE (1ll<<40) -#define TRACE_DSP_INTERRUPT (1ll<<41) +#define TRACE_ACIA (1<<20) + +#define TRACE_IKBD_CMDS (1<<21) +#define TRACE_IKBD_ACIA (1<<22) +#define TRACE_IKBD_EXEC (1<<23) + +#define TRACE_BLITTER (1<<24) + +#define TRACE_OS_BIOS (1<<25) +#define TRACE_OS_XBIOS (1<<26) +#define TRACE_OS_GEMDOS (1<<27) +#define TRACE_OS_VDI (1<<28) +#define TRACE_OS_AES (1<<29) + +#define TRACE_IOMEM_RD (1<<30) +#define TRACE_IOMEM_WR (1ULL<<31) + +#define TRACE_DMASND (1ll<<32) + +#define TRACE_CROSSBAR (1ll<<33) +#define TRACE_VIDEL (1ll<<34) + +#define TRACE_DSP_HOST_INTERFACE (1ll<<35) +#define TRACE_DSP_HOST_COMMAND (1ll<<36) +#define TRACE_DSP_HOST_SSI (1ll<<37) +#define TRACE_DSP_DISASM (1ll<<38) +#define TRACE_DSP_DISASM_REG (1ll<<39) +#define TRACE_DSP_DISASM_MEM (1ll<<40) +#define TRACE_DSP_STATE (1ll<<41) +#define TRACE_DSP_INTERRUPT (1ll<<42) + +#define TRACE_DSP_SYMBOLS (1ll<<43) +#define TRACE_CPU_SYMBOLS (1ll<<44) + +#define TRACE_NVRAM (1ll<<45) + +#define TRACE_SCSI_CMD (1ll<<46) + +#define TRACE_NATFEATS (1ll<<47) + +#define TRACE_KEYMAP (1ll<<48) + +#define TRACE_MIDI (1ll<<49) + +#define TRACE_IDE (1ll<<50) + +#define TRACE_OS_BASE (1ll<<51) #define TRACE_NONE (0) #define TRACE_ALL (~0) @@ -135,7 +188,7 @@ extern char *Log_MatchTrace(const char * #define TRACE_IKBD_ALL ( TRACE_IKBD_CMDS | TRACE_IKBD_ACIA | TRACE_IKBD_EXEC ) -#define TRACE_OS_ALL ( TRACE_OS_BIOS | TRACE_OS_XBIOS | TRACE_OS_GEMDOS | TRACE_OS_AES | TRACE_OS_VDI ) +#define TRACE_OS_ALL ( TRACE_OS_BASE | TRACE_OS_BIOS | TRACE_OS_XBIOS | TRACE_OS_GEMDOS | TRACE_OS_AES | TRACE_OS_VDI ) #define TRACE_IOMEM_ALL ( TRACE_IOMEM_RD | TRACE_IOMEM_WR ) @@ -149,9 +202,9 @@ extern Uint64 LogTraceFlags; #ifndef _VCWIN_ #define LOG_TRACE(level, args...) \ - if (unlikely(LogTraceFlags & level)) fprintf(TraceFile, args) + if (unlikely(LogTraceFlags & (level))) { fprintf(TraceFile, args); fflush(TraceFile); } #endif -#define LOG_TRACE_LEVEL( level ) (unlikely(LogTraceFlags & level)) +#define LOG_TRACE_LEVEL( level ) (unlikely(LogTraceFlags & (level))) #else /* ENABLE_TRACING */