Logging: use the known function when the first frame of the backtrace is unknown
Change-Id: Ia591805c82e7bf77dc7af04f1054c7daca58eb6a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
decb88693c
commit
27b67c5399
@ -1161,10 +1161,14 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
|
||||
if (numberPrinted > 0)
|
||||
message.append(pattern->backtraceSeparator);
|
||||
|
||||
if (function.isEmpty())
|
||||
message += QLatin1Char('?') + library + QLatin1Char('?');
|
||||
else
|
||||
if (function.isEmpty()) {
|
||||
if (numberPrinted == 0 && context.function)
|
||||
message += QString::fromUtf8(qCleanupFuncinfo(context.function));
|
||||
else
|
||||
message += QLatin1Char('?') + library + QLatin1Char('?');
|
||||
} else {
|
||||
message += function;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (numberPrinted == 0)
|
||||
|
@ -720,7 +720,8 @@ void tst_qmessagehandler::qMessagePattern_data()
|
||||
#endif
|
||||
|
||||
QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>()
|
||||
<< "[MyClass::myFunction\nMyClass::mySlot1] from_a_function 34");
|
||||
<< "[MyClass::myFunction\nMyClass::mySlot1] from_a_function 34"
|
||||
<< "[T::T\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user