mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +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>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
|
#include "crashpad/client/simulate_crash.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(Q_CC_MSVC)
|
#if defined(Q_CC_MSVC)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
@@ -36,6 +40,9 @@ namespace BlackMisc
|
|||||||
Q_UNUSED(context);
|
Q_UNUSED(context);
|
||||||
Q_UNUSED(message);
|
Q_UNUSED(message);
|
||||||
#if defined(QT_NO_DEBUG)
|
#if defined(QT_NO_DEBUG)
|
||||||
|
# if defined(BLACK_USE_CRASHPAD)
|
||||||
|
CRASHPAD_SIMULATE_CRASH();
|
||||||
|
# endif
|
||||||
if (context && message)
|
if (context && message)
|
||||||
{
|
{
|
||||||
CLogMessage(CLogCategory::verification()).warning("Failed to verify: %1 (%2 in %3) in %4 line %5") << condition << message << context << filename << line;
|
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"
|
#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 BlackMisc
|
||||||
{
|
{
|
||||||
namespace Private
|
namespace Private
|
||||||
@@ -22,7 +30,7 @@ namespace BlackMisc
|
|||||||
inline void noop() {}
|
inline void noop() {}
|
||||||
|
|
||||||
//! \private Called by BLACK_VERIFY when the condition is false.
|
//! \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