mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-07-30 00:15:46 -04:00
hacky but improves debugging output - may need some format cleanups (extra newline at end?) - gives us function, file, and line # for warnings and fatals
This commit is contained in:
@@ -80,13 +80,13 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const
|
||||
char file[4 * 1024] = { '\0' };
|
||||
int line = 0;
|
||||
if (ConfigSharedFoundation::getLookUpCallStackNames() && DebugHelp::lookupAddress(callStack[callStackOffset], lib, file, sizeof(file), line))
|
||||
snprintf(buffer, bufferLength, "%s(%d) : %s %08x: ", file, line, type, static_cast<int>(Crc::calculate(format)));
|
||||
snprintf(buffer, bufferLength, "%s(%d) : %s %08x: \n", file, line, type, static_cast<int>(Crc::calculate(format)));
|
||||
else
|
||||
snprintf(buffer, bufferLength, "unknown(0x%08X) : %s %08x: ", static_cast<int>(callStack[callStackOffset]), type, static_cast<int>(Crc::calculate(format)));
|
||||
snprintf(buffer, bufferLength, "(0x%08X) : %s %08x: \n", static_cast<int>(callStack[callStackOffset]), type, static_cast<int>(Crc::calculate(format)));
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buffer, bufferLength, "unknown location : %s %08x: ", type, static_cast<int>(Crc::calculate(format)));
|
||||
snprintf(buffer, bufferLength, " (%08x): ", static_cast<int>(Crc::calculate(format)));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -124,9 +124,9 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const
|
||||
int line = 0;
|
||||
|
||||
if (ConfigSharedFoundation::getLookUpCallStackNames() && DebugHelp::lookupAddress(callStack[i], lib, file, sizeof(file), line))
|
||||
snprintf(buffer, bufferLength, " %s(%d) : caller %d\n", file, line, i-callStackOffset);
|
||||
snprintf(buffer, bufferLength, " %s(%d) : caller %d\n", file, line, i-callStackOffset);
|
||||
else
|
||||
snprintf(buffer, bufferLength, " unknown(0x%08X) : caller %d\n", static_cast<int>(callStack[i]), i-callStackOffset);
|
||||
snprintf(buffer, bufferLength, " (0x%08X) : caller %d\n", static_cast<int>(callStack[i]), i-callStackOffset);
|
||||
|
||||
const int length = strlen(buffer);
|
||||
buffer += length;
|
||||
|
||||
@@ -33,22 +33,28 @@ void SetWarningCallback(WarningCallback);
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#define FATAL(a, b) ((a) ? Fatal b : NOP)
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_FATAL(a, b) ((a) ? DebugFatal b : NOP)
|
||||
#define LINEINFO(a) fprintf(stderr, "\n%s in %s() file %s:%d \n", a, __FUNCTION__, __FILE__ , __LINE__)
|
||||
#else
|
||||
#define LINEINFO(a) fprintf(stderr, "%s: ", a)
|
||||
#endif
|
||||
|
||||
#define FATAL(a, b) ((a) ? LINEINFO("FATAL"), Fatal b : NOP)
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_FATAL(a, b) ((a) ? LINEINFO("FATAL"), DebugFatal b : NOP)
|
||||
#else
|
||||
#define DEBUG_FATAL(a, b) NOP
|
||||
#endif
|
||||
|
||||
#define WARNING(a, b) ((a) ? Warning b : NOP)
|
||||
#define WARNING_STACK_DEPTH(a, b) ((a) ? WarningStackDepth b : NOP)
|
||||
#define WARNING(a, b) ((a) ? LINEINFO("WARNING"), Warning b : NOP)
|
||||
#define WARNING_STACK_DEPTH(a, b) ((a) ? LINEINFO("WARNING"), WarningStackDepth b : NOP)
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_WARNING(a, b) WARNING(a, b)
|
||||
#else
|
||||
#define DEBUG_WARNING(a, b) NOP
|
||||
#endif
|
||||
|
||||
#define CONSOLE_WARNING(a, b) ((a) ? ConsoleWarning b : NOP)
|
||||
#define CONSOLE_WARNING(a, b) ((a) ? LINEINFO("WARNING"), ConsoleWarning b : NOP)
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_CONSOLE_WARNING(a, b) CONSOLE_WARNING(a, b)
|
||||
#else
|
||||
@@ -61,7 +67,7 @@ void SetWarningCallback(WarningCallback);
|
||||
#define WARNING_DEBUG_FATAL(a, b) WARNING(a, b)
|
||||
#endif
|
||||
|
||||
#define WARNING_STRICT_FATAL(a, b) ((a) ? WarningStrictFatal b : NOP)
|
||||
#define WARNING_STRICT_FATAL(a, b) ((a) ? LINEINFO("FATAL"), WarningStrictFatal b : NOP)
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
|
||||
Reference in New Issue
Block a user