mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
A failed BLACK_VERIFY will generate a Crashpad crash report.
Using noinline to make sure the call to failedVerify is visible in the stack trace.
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#ifdef BLACK_USE_CRASHPAD
|
||||
#include "crashpad/client/simulate_crash.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_MSVC)
|
||||
#include <intrin.h>
|
||||
#elif defined(Q_OS_UNIX)
|
||||
@@ -36,6 +40,9 @@ namespace BlackMisc
|
||||
Q_UNUSED(context);
|
||||
Q_UNUSED(message);
|
||||
#if defined(QT_NO_DEBUG)
|
||||
# if defined(BLACK_USE_CRASHPAD)
|
||||
CRASHPAD_SIMULATE_CRASH();
|
||||
# endif
|
||||
if (context && message)
|
||||
{
|
||||
CLogMessage(CLogCategory::verification()).warning("Failed to verify: %1 (%2 in %3) in %4 line %5") << condition << message << context << filename << line;
|
||||
|
||||
@@ -14,6 +14,14 @@
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
//! \cond
|
||||
#ifdef Q_CC_MSVC
|
||||
#define BLACK_NO_INLINE __declspec(noinline)
|
||||
#else
|
||||
#define BLACK_NO_INLINE __attribute__((noinline))
|
||||
#endif
|
||||
//! \endcond
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Private
|
||||
@@ -22,7 +30,7 @@ namespace BlackMisc
|
||||
inline void noop() {}
|
||||
|
||||
//! \private Called by BLACK_VERIFY when the condition is false.
|
||||
BLACKMISC_EXPORT void failedVerify(const char *condition, const char *filename, int line, const char *context = nullptr, const char *message = nullptr);
|
||||
BLACKMISC_EXPORT BLACK_NO_INLINE void failedVerify(const char *condition, const char *filename, int line, const char *context = nullptr, const char *message = nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user