mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #935, added cmdline args for crashpad server
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6c76e0fea6
commit
864fa88c65
@@ -63,6 +63,7 @@
|
|||||||
#include "crashpad/client/crashpad_client.h"
|
#include "crashpad/client/crashpad_client.h"
|
||||||
#include "crashpad/client/crash_report_database.h"
|
#include "crashpad/client/crash_report_database.h"
|
||||||
#include "crashpad/client/settings.h"
|
#include "crashpad/client/settings.h"
|
||||||
|
#include "crashpad/client/simulate_crash.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
@@ -311,7 +312,7 @@ namespace BlackCore
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
// clear cache?
|
// clear cache?
|
||||||
if (this->isSetOrTrue(this->m_cmdClearCache))
|
if (this->isSet(this->m_cmdClearCache))
|
||||||
{
|
{
|
||||||
const QStringList files(CApplication::clearCaches());
|
const QStringList files(CApplication::clearCaches());
|
||||||
msgs.push_back(
|
msgs.push_back(
|
||||||
@@ -319,6 +320,20 @@ namespace BlackCore
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// crashpad dump
|
||||||
|
if (this->isSet(this->m_cmdTestCrashpad))
|
||||||
|
{
|
||||||
|
QTimer::singleShot(10 * 1000, [ = ]
|
||||||
|
{
|
||||||
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
|
CRASHPAD_SIMULATE_CRASH();
|
||||||
|
#else
|
||||||
|
CLogMessage(this).warning("This compiler or platform does not support crashpad. Cannot simulate crash dump!");
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// load setup
|
||||||
if (this->m_startSetupReader && !this->m_setupReader->isSetupAvailable())
|
if (this->m_startSetupReader && !this->m_setupReader->isSetupAvailable())
|
||||||
{
|
{
|
||||||
msgs = this->requestReloadOfSetupAndVersion();
|
msgs = this->requestReloadOfSetupAndVersion();
|
||||||
@@ -459,11 +474,8 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (!CBuildConfig::canRunInDeveloperEnvironment()) { return false; }
|
if (!CBuildConfig::canRunInDeveloperEnvironment()) { return false; }
|
||||||
if (this->m_unitTest) { return true; }
|
if (this->m_unitTest) { return true; }
|
||||||
if (this->m_parser.isSet(this->m_cmdDevelopment))
|
if (this->isSet(this->m_cmdDevelopment)) { return true; }
|
||||||
{
|
if (this->isSetupAvailable())
|
||||||
return this->isSetOrTrue(this->m_cmdDevelopment);
|
|
||||||
}
|
|
||||||
else if (this->isSetupAvailable())
|
|
||||||
{
|
{
|
||||||
// assume value from setup
|
// assume value from setup
|
||||||
return this->getGlobalSetup().isDevelopment();
|
return this->getGlobalSetup().isDevelopment();
|
||||||
@@ -722,11 +734,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
// dev. system
|
// dev. system
|
||||||
this->m_cmdDevelopment = QCommandLineOption({ "dev", "development" },
|
this->m_cmdDevelopment = QCommandLineOption({ "dev", "development" },
|
||||||
QCoreApplication::translate("application", "Dev. system features?"),
|
QCoreApplication::translate("application", "Dev. system features?"));
|
||||||
"development");
|
|
||||||
this->addParserOption(this->m_cmdDevelopment);
|
this->addParserOption(this->m_cmdDevelopment);
|
||||||
|
|
||||||
// can read a local bootsrap file
|
// can read a local bootstrap file
|
||||||
this->m_cmdSharedDir = QCommandLineOption({ "shared", "shareddir" },
|
this->m_cmdSharedDir = QCommandLineOption({ "shared", "shareddir" },
|
||||||
QCoreApplication::translate("application", "Local shared directory."),
|
QCoreApplication::translate("application", "Local shared directory."),
|
||||||
"shared");
|
"shared");
|
||||||
@@ -734,20 +745,18 @@ namespace BlackCore
|
|||||||
|
|
||||||
// reset caches upfront
|
// reset caches upfront
|
||||||
this->m_cmdClearCache = QCommandLineOption({ "ccache", "clearcache" },
|
this->m_cmdClearCache = QCommandLineOption({ "ccache", "clearcache" },
|
||||||
QCoreApplication::translate("application", "Clear (reset) the caches."),
|
QCoreApplication::translate("application", "Clear (reset) the caches."));
|
||||||
"clearcache");
|
|
||||||
this->addParserOption(this->m_cmdClearCache);
|
this->addParserOption(this->m_cmdClearCache);
|
||||||
|
|
||||||
|
// test crashpad upload
|
||||||
|
this->m_cmdTestCrashpad = QCommandLineOption({ "testcp", "testcrashpad" },
|
||||||
|
QCoreApplication::translate("application", "Simulate crashpad situation."));
|
||||||
|
this->addParserOption(this->m_cmdTestCrashpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CApplication::isSetOrTrue(const QCommandLineOption &option) const
|
bool CApplication::isSet(const QCommandLineOption &option) const
|
||||||
{
|
{
|
||||||
if (!this->m_parser.isSet(option)) { return false; }
|
return (this->m_parser.isSet(option));
|
||||||
|
|
||||||
// explicit value
|
|
||||||
const QString v(this->m_parser.value(option).trimmed());
|
|
||||||
if (v.isEmpty()) { return true; } // just flag
|
|
||||||
if (v.startsWith("-")) { return true; } // just flag, because value is already next parameter
|
|
||||||
return stringToBool(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::registerMetadata()
|
void CApplication::registerMetadata()
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::CStatusMessageList startHookIn() { return BlackMisc::CStatusMessageList(); }
|
virtual BlackMisc::CStatusMessageList startHookIn() { return BlackMisc::CStatusMessageList(); }
|
||||||
|
|
||||||
//! Flag set or explicitly set to true
|
//! Flag set or explicitly set to true
|
||||||
bool isSetOrTrue(const QCommandLineOption &option) const;
|
bool isSet(const QCommandLineOption &option) const;
|
||||||
|
|
||||||
//! Severe issue during startup, most likely it does not make sense to continue
|
//! Severe issue during startup, most likely it does not make sense to continue
|
||||||
//! \note call this here if the parsing stage is over and reaction to a runtime issue is needed
|
//! \note call this here if the parsing stage is over and reaction to a runtime issue is needed
|
||||||
@@ -445,18 +445,19 @@ namespace BlackCore
|
|||||||
static void registerMetadata();
|
static void registerMetadata();
|
||||||
|
|
||||||
// cmd parsing
|
// cmd parsing
|
||||||
QCommandLineParser m_parser; //!< cmd parser
|
QCommandLineParser m_parser; //!< cmd parser
|
||||||
QCommandLineOption m_cmdHelp {"help"}; //!< help option
|
QCommandLineOption m_cmdHelp {"help"}; //!< help option
|
||||||
QCommandLineOption m_cmdVersion {"version"}; //!< version option
|
QCommandLineOption m_cmdVersion {"version"}; //!< version option
|
||||||
QCommandLineOption m_cmdDBusAddress {"empty"}; //!< DBus address
|
QCommandLineOption m_cmdDBusAddress {"empty"}; //!< DBus address
|
||||||
QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag
|
QCommandLineOption m_cmdDevelopment {"dev"}; //!< Development flag
|
||||||
QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory
|
QCommandLineOption m_cmdSharedDir {"shared"}; //!< Shared directory
|
||||||
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
|
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
|
||||||
bool m_parsed = false; //!< Parsing accomplished?
|
QCommandLineOption m_cmdTestCrashpad {"testcrashpad"}; //!< Test a crasphpad upload
|
||||||
bool m_started = false; //!< started with success?
|
bool m_parsed = false; //!< Parsing accomplished?
|
||||||
bool m_startSetupReader = false; //!< start the setup reader
|
bool m_started = false; //!< started with success?
|
||||||
bool m_singleApplication = true; //!< only one instance of that application
|
bool m_startSetupReader = false; //!< start the setup reader
|
||||||
bool m_alreadyRunning = false; //!< Application already running
|
bool m_singleApplication = true; //!< only one instance of that application
|
||||||
|
bool m_alreadyRunning = false; //!< Application already running
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! init logging system
|
//! init logging system
|
||||||
|
|||||||
Reference in New Issue
Block a user