minor review of formatting

This commit is contained in:
Heather Anderson 2020-07-24 21:32:22 -07:00
parent af6d2b2e56
commit 2f00c3e0bd

View file

@ -42,8 +42,8 @@
#include <FingerprintUtils.h>
#include <UUID.h>
static const std::string BACKTRACE_URL { CMAKE_BACKTRACE_URL };
static const std::string BACKTRACE_TOKEN { CMAKE_BACKTRACE_TOKEN };
static const std::string BACKTRACE_URL{ CMAKE_BACKTRACE_URL };
static const std::string BACKTRACE_TOKEN{ CMAKE_BACKTRACE_TOKEN };
// ------------------------------------------------------------------------------------------------
// SpinLock - a lock that can timeout attempting to lock a block of code, and is in a busy-wait cycle while trying to acquire
@ -55,6 +55,7 @@ public:
void lock();
bool lock(int msecs);
void unlock();
private:
QAtomicInteger<int> _lock{ 0 };
@ -132,12 +133,12 @@ bool SpinLockLocker::relock(int msecs /* = -1 */ ) {
crashpad::CrashpadClient* client{ nullptr };
SpinLock crashpadAnnotationsProtect;
crashpad::SimpleStringDictionary* crashpadAnnotations { nullptr };
crashpad::SimpleStringDictionary* crashpadAnnotations{ nullptr };
#if defined(Q_OS_WIN)
static const QString CRASHPAD_HANDLER_NAME { "crashpad_handler.exe" };
static const QString CRASHPAD_HANDLER_NAME{ "crashpad_handler.exe" };
#else
static const QString CRASHPAD_HANDLER_NAME { "crashpad_handler" };
static const QString CRASHPAD_HANDLER_NAME{ "crashpad_handler" };
#endif
#ifdef Q_OS_WIN
@ -255,22 +256,24 @@ static void fatalCxxException(PEXCEPTION_POINTERS pExceptionInfo) {
// get the ThrowInfo struct from the exception arguments
ThrowInfo_internal* pThrowInfo = reinterpret_cast<ThrowInfo_internal*>(ExceptionRecord->ExceptionInformation[2]);
ULONG_PTR moduleBase = ExceptionRecord->ExceptionInformation[3];
if(moduleBase == 0 || pThrowInfo == NULL) {
if (moduleBase == 0 || pThrowInfo == NULL) {
return; // broken assumption
}
// get the CatchableTypeArray* struct from ThrowInfo
if(pThrowInfo->pCatchableTypeArray == 0) {
if (pThrowInfo->pCatchableTypeArray == 0) {
return; // broken assumption
}
CatchableTypeArray_internal* pCatchableTypeArray = reinterpret_cast<CatchableTypeArray_internal*>(moduleBase + pThrowInfo->pCatchableTypeArray);
if(pCatchableTypeArray->nCatchableTypes == 0 || pCatchableTypeArray->arrayOfCatchableTypes[0] == 0) {
CatchableTypeArray_internal* pCatchableTypeArray =
reinterpret_cast<CatchableTypeArray_internal*>(moduleBase + pThrowInfo->pCatchableTypeArray);
if (pCatchableTypeArray->nCatchableTypes == 0 || pCatchableTypeArray->arrayOfCatchableTypes[0] == 0) {
return; // broken assumption
}
// get the CatchableType struct for the actual exception type from CatchableTypeArray
CatchableType_internal* pCatchableType = reinterpret_cast<CatchableType_internal*>(moduleBase + pCatchableTypeArray->arrayOfCatchableTypes[0]);
if(pCatchableType->pType == 0) {
CatchableType_internal* pCatchableType =
reinterpret_cast<CatchableType_internal*>(moduleBase + pCatchableTypeArray->arrayOfCatchableTypes[0]);
if (pCatchableType->pType == 0) {
return; // broken assumption
}
const std::type_info* type = reinterpret_cast<std::type_info*>(moduleBase + pCatchableType->pType);
@ -281,7 +284,8 @@ static void fatalCxxException(PEXCEPTION_POINTERS pExceptionInfo) {
// catch() commands that could have caught this so we can find the list of its superclasses
QString compatibleObjects;
for (int catchTypeIdx = 1; catchTypeIdx < pCatchableTypeArray->nCatchableTypes; catchTypeIdx++) {
CatchableType_internal* pCatchableSuperclassType = reinterpret_cast<CatchableType_internal*>(moduleBase + pCatchableTypeArray->arrayOfCatchableTypes[catchTypeIdx]);
CatchableType_internal* pCatchableSuperclassType =
reinterpret_cast<CatchableType_internal*>(moduleBase + pCatchableTypeArray->arrayOfCatchableTypes[catchTypeIdx]);
if (pCatchableSuperclassType->pType == 0) {
return; // broken assumption
}
@ -325,7 +329,6 @@ bool startCrashHandler(std::string appPath) {
auto machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
annotations["machine_fingerprint"] = machineFingerPrint.toStdString();
arguments.push_back("--no-rate-limit");
// Setup Crashpad DB directory
@ -335,7 +338,7 @@ bool startCrashHandler(std::string appPath) {
const auto crashpadDbPath = crashpadDbDir.toStdString() + "/" + crashpadDbName;
// Locate Crashpad handler
const QFileInfo interfaceBinary { QString::fromStdString(appPath) };
const QFileInfo interfaceBinary{ QString::fromStdString(appPath) };
const QDir interfaceDir = interfaceBinary.dir();
assert(interfaceDir.exists(CRASHPAD_HANDLER_NAME));
const std::string CRASHPAD_HANDLER_PATH = interfaceDir.filePath(CRASHPAD_HANDLER_NAME).toStdString();