[Companion][Simulator] Add custom qDebug message handler/formatter (#4475)
* [Companion][Simulator] Add custom qDebug message handler/formatter as an option. Keeps support for QT_MESSAGE_PATTERN env. var.
* [Simulator] Show system messages of level qInfo and above in debug console.
* [Simulator] Still capture screenshot to clipboard if path is not accessible (and screenshot results now print to simulator debug console).
* Fix for older CMake.
* [Companion] Do not start debug message handler if app is shutting down, and add null checks before using it; Increase backtrace report depth; Add OTx headers; Add Companion exit status debug; Clean up unused code.
* [Simulator] Add asynchronous FIFO buffer for handling debug output/display more efficiently. (#4488)
(cherry-picked from b12bd7d7be)
This commit is contained in:
committed by
Bertrand Songis
parent
620094e358
commit
00b2799427
@@ -21,6 +21,7 @@
|
||||
#include "debugoutput.h"
|
||||
#include "ui_debugoutput.h"
|
||||
|
||||
#include "appdebugmessagehandler.h"
|
||||
#include "appdata.h"
|
||||
#include "filteredtextbuffer.h"
|
||||
|
||||
@@ -100,6 +101,9 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
|
||||
connect(ui->actionToggleFilter, &QAction::toggled, this, &DebugOutput::onFilterToggled);
|
||||
connect(ui->filterText, &QComboBox::currentTextChanged, this, &DebugOutput::onFilterTextChanged);
|
||||
|
||||
if (AppDebugMessageHandler::instance())
|
||||
connect(AppDebugMessageHandler::instance(), &AppDebugMessageHandler::messageOutput, this, &DebugOutput::onAppDebugMessage);
|
||||
|
||||
// send firmware TRACE events to our data collector
|
||||
m_simulator->installTraceHook(firmwareTraceCb);
|
||||
}
|
||||
@@ -108,6 +112,8 @@ DebugOutput::~DebugOutput()
|
||||
{
|
||||
saveState();
|
||||
|
||||
if (AppDebugMessageHandler::instance())
|
||||
disconnect(AppDebugMessageHandler::instance(), 0, this, 0);
|
||||
|
||||
if (m_dataBufferDevice) {
|
||||
disconnect(m_dataBufferDevice, 0, this, 0);
|
||||
@@ -198,6 +204,14 @@ void DebugOutput::onDataBufferOverflow(const qint64 len)
|
||||
}
|
||||
}
|
||||
|
||||
void DebugOutput::onAppDebugMessage(quint8 level, const QString & msg, const QMessageLogContext & context)
|
||||
{
|
||||
if (level > 0) {
|
||||
firmwareTraceCb(qPrintable(msg));
|
||||
firmwareTraceCb("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* UI handlers
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user