Added a debug message output for warn of buffer overruns when logging to a file with the Qt trace logger.
This commit is contained in:
parent
e2716ae2c5
commit
aa5ce14c06
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
#include "common/os_utils.h"
|
#include "common/os_utils.h"
|
||||||
|
|
||||||
|
#include "Qt/ConsoleWindow.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
#include "Qt/TraceLogger.h"
|
#include "Qt/TraceLogger.h"
|
||||||
#include "Qt/main.h"
|
#include "Qt/main.h"
|
||||||
|
@ -99,6 +100,7 @@ static int recBufMax = 0;
|
||||||
static int recBufHead = 0;
|
static int recBufHead = 0;
|
||||||
static int recBufTail = 0;
|
static int recBufTail = 0;
|
||||||
static FILE *logFile = NULL;
|
static FILE *logFile = NULL;
|
||||||
|
static bool overrunWarningArmed = true;
|
||||||
static TraceLoggerDialog_t *traceLogWindow = NULL;
|
static TraceLoggerDialog_t *traceLogWindow = NULL;
|
||||||
static void pushMsgToLogBuffer(const char *msg);
|
static void pushMsgToLogBuffer(const char *msg);
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
@ -378,6 +380,7 @@ void TraceLoggerDialog_t::updatePeriodic(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
recBufTail = recBufHead;
|
recBufTail = recBufHead;
|
||||||
|
overrunWarningArmed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (traceViewCounter > 20)
|
if (traceViewCounter > 20)
|
||||||
|
@ -442,6 +445,21 @@ void TraceLoggerDialog_t::toggleLoggingOnOff(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void TraceLoggerDialog_t::showBufferWarning(void)
|
||||||
|
{
|
||||||
|
const char *msg = "\
|
||||||
|
Error: Trace Logger Circular Buffer Overrun has been detected!\n\n\
|
||||||
|
This means that some instructions have not been written to the log\
|
||||||
|
file and resulting log of instructions is incomplete.\n\n\
|
||||||
|
Recommend increasing buffer size (max lines) to at least 1,000,000 lines.\n\n\
|
||||||
|
This message won't show again until logging is stopped and started again.";
|
||||||
|
|
||||||
|
if ( consoleWindow )
|
||||||
|
{
|
||||||
|
consoleWindow->QueueErrorMsgWindow(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void TraceLoggerDialog_t::openLogFile(void)
|
void TraceLoggerDialog_t::openLogFile(void)
|
||||||
{
|
{
|
||||||
const char *romFile;
|
const char *romFile;
|
||||||
|
@ -1004,15 +1022,24 @@ void openTraceLoggerWindow(QWidget *parent)
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
static void pushToLogBuffer(traceRecord_t &rec)
|
static void pushToLogBuffer(traceRecord_t &rec)
|
||||||
{
|
{
|
||||||
|
|
||||||
recBuf[recBufHead] = rec;
|
recBuf[recBufHead] = rec;
|
||||||
recBufHead = (recBufHead + 1) % recBufMax;
|
recBufHead = (recBufHead + 1) % recBufMax;
|
||||||
|
|
||||||
if ( logging )
|
if ( logFile != NULL )
|
||||||
{ // Warning that an buffer overrun has occurred,
|
{
|
||||||
// This means that some instructions have not been written to the log.
|
if ( overrunWarningArmed )
|
||||||
|
{ // Don't spam with buffer overrun warning messages,
|
||||||
|
// we will print once if this happens.
|
||||||
if (recBufHead == recBufTail)
|
if (recBufHead == recBufTail)
|
||||||
{
|
{
|
||||||
|
if ( traceLogWindow )
|
||||||
|
{
|
||||||
|
traceLogWindow->showBufferWarning();
|
||||||
|
}
|
||||||
printf("Trace Log Overrun!!!\n");
|
printf("Trace Log Overrun!!!\n");
|
||||||
|
overrunWarningArmed = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ public:
|
||||||
TraceLoggerDialog_t(QWidget *parent = 0);
|
TraceLoggerDialog_t(QWidget *parent = 0);
|
||||||
~TraceLoggerDialog_t(void);
|
~TraceLoggerDialog_t(void);
|
||||||
|
|
||||||
|
void showBufferWarning(void);
|
||||||
protected:
|
protected:
|
||||||
QTimer *updateTimer;
|
QTimer *updateTimer;
|
||||||
QCheckBox *logLastCbox;
|
QCheckBox *logLastCbox;
|
||||||
|
|
Loading…
Reference in New Issue