forked from qt-creator/qt-creator
crashpad: change chrashpad dumps location to user directory on macOS
This is necessary to not pollute the signed and notarized .app
bundle.
Task-number: QDS-9113
Change-Id: I74e0bced5679faac94b27d2a31ea10a7949fb21f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
(cherry picked from commit b619f24396
)
This commit is contained in:
@@ -425,13 +425,26 @@ QStringList lastSessionArgument()
|
||||
return hasProjectExplorer ? QStringList({"-lastsession"}) : QStringList();
|
||||
}
|
||||
|
||||
// should be in sync with src/plugins/coreplugin/icore.cpp -> FilePath ICore::crashReportsPath()
|
||||
// and src\tools\qml2puppet\qml2puppet\qmlpuppet.cpp -> QString crashReportsPath()
|
||||
QString crashReportsPath()
|
||||
{
|
||||
std::unique_ptr<QSettings> settings(createUserSettings());
|
||||
QFileInfo(settings->fileName()).path() + "/crashpad_reports";
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
return QFileInfo(createUserSettings()->fileName()).path() + "/crashpad_reports";
|
||||
else
|
||||
return QCoreApplication::applicationDirPath()
|
||||
+ '/' + RELATIVE_LIBEXEC_PATH + "crashpad_reports";
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CRASHPAD
|
||||
bool startCrashpad(const QString &libexecPath, bool crashReportingEnabled)
|
||||
{
|
||||
using namespace crashpad;
|
||||
|
||||
// Cache directory that will store crashpad information and minidumps
|
||||
QString databasePath = QDir::cleanPath(libexecPath + "/crashpad_reports");
|
||||
QString databasePath = QDir::cleanPath(crashReportsPath());
|
||||
QString handlerPath = QDir::cleanPath(libexecPath + "/crashpad_handler");
|
||||
#ifdef Q_OS_WIN
|
||||
handlerPath += ".exe";
|
||||
|
@@ -511,7 +511,7 @@ FilePath ICore::libexecPath(const QString &rel)
|
||||
FilePath ICore::crashReportsPath()
|
||||
{
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
return libexecPath("crashpad_reports/completed");
|
||||
return Core::ICore::userResourcePath("crashpad_reports/completed");
|
||||
else
|
||||
return libexecPath("crashpad_reports/reports");
|
||||
}
|
||||
|
@@ -17,13 +17,21 @@
|
||||
|
||||
namespace {
|
||||
#if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN)
|
||||
bool startCrashpad()
|
||||
bool startCrashpad(const QString& libexecPath, const QString& crashReportsPath)
|
||||
{
|
||||
using namespace crashpad;
|
||||
|
||||
// Cache directory that will store crashpad information and minidumps
|
||||
base::FilePath database(L"crashpad_reports");
|
||||
base::FilePath handler(L"crashpad_handler.exe");
|
||||
QString databasePath = QDir::cleanPath(crashReportsPath);
|
||||
QString handlerPath = QDir::cleanPath(libexecPath + "/crashpad_handler");
|
||||
#ifdef Q_OS_WIN
|
||||
handlerPath += ".exe";
|
||||
base::FilePath database(databasePath.toStdWString());
|
||||
base::FilePath handler(handlerPath.toStdWString());
|
||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_LINUX)
|
||||
base::FilePath database(databasePath.toStdString());
|
||||
base::FilePath handler(handlerPath.toStdString());
|
||||
#endif
|
||||
|
||||
// URL used to submit minidumps to
|
||||
std::string url(CRASHPAD_BACKEND_URL);
|
||||
@@ -58,7 +66,7 @@ namespace {
|
||||
QtSystemExceptionHandler systemExceptionHandler(libexecPath);
|
||||
#endif //#ifdef ENABLE_QT_BREAKPAD
|
||||
#else //#if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN)
|
||||
bool startCrashpad()
|
||||
bool startCrashpad(const QString&, const QString&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlEngine>
|
||||
#include <QSettings>
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(QT_NO_DEBUG)
|
||||
#include <Windows.h>
|
||||
@@ -75,6 +76,24 @@ void QmlPuppet::populateParser()
|
||||
{"import3dAsset", "Import 3d asset.", "sourceAsset, outDir, importOptJson"}});
|
||||
}
|
||||
|
||||
// should be in sync with coreplugin/icore.cpp -> FilePath ICore::crashReportsPath()
|
||||
// and src\app\main.cpp
|
||||
QString crashReportsPath()
|
||||
{
|
||||
QSettings settings(
|
||||
QSettings::IniFormat,
|
||||
QSettings::UserScope,
|
||||
QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR),
|
||||
QLatin1String(Core::Constants::IDE_CASED_ID));
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
return QFileInfo(settings.fileName()).path() + "/crashpad_reports";
|
||||
#else
|
||||
return QCoreApplication::applicationDirPath()
|
||||
+ '/' + RELATIVE_LIBEXEC_PATH + "crashpad_reports";
|
||||
#endif
|
||||
}
|
||||
|
||||
void QmlPuppet::initQmlRunner()
|
||||
{
|
||||
if (m_coreApp->arguments().count() < 2
|
||||
@@ -117,7 +136,8 @@ void QmlPuppet::initQmlRunner()
|
||||
Import3D::import3D(sourceAsset, outDir, options);
|
||||
}
|
||||
|
||||
startCrashpad();
|
||||
startCrashpad(QCoreApplication::applicationDirPath()
|
||||
+ '/' + RELATIVE_LIBEXEC_PATH, crashReportsPath());
|
||||
|
||||
new QmlDesigner::Qt5NodeInstanceClientProxy(m_coreApp.get());
|
||||
|
||||
|
Reference in New Issue
Block a user