diff options
author | Juergen Funk <juergen.funk_ml@cib.de> | 2019-09-18 11:48:21 +0200 |
---|---|---|
committer | Juergen Funk (CIB) <juergen.funk_ml@cib.de> | 2019-10-02 09:43:12 +0200 |
commit | 2215be5268a646d3cc7d138a0184c6826585b7fb (patch) | |
tree | 8796002fa707f819a4f9e1b59acf5b9e3d3205d2 /desktop | |
parent | be64610dba55e77998120fd8bf69ad2abdf62b1e (diff) |
tdf#127711 - A runtime-switch for the MiniCrashDump
- in soffice.ini (sofficerc) the entry "CrashDumpEnable" default is "true"
- when false then the Dump.ini and the dump-file are not written
- when the switch --disable-crashdump is set, then the
switch "CrashDumpEnable" set to "false"
- when the entry "CrashDumpEnable" is missing, in this case is the
default true, too
- the checkbox under Options-General "Send crash reports to ..."
is deactive and shows off (only view, not change the config)
- when set the environment variable "CRASH_DUMP_ENABLE" to any char
then the switch "CrashDumpEnable=false" are overrules with true
and the Dump.ini and dump-file are write
Change-Id: I34e7795640eb95d111e18b0ad46ec67b2c126b19
Reviewed-on: https://gerrit.libreoffice.org/79273
Tested-by: Jenkins
Reviewed-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/crashreport.cxx | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 88cd6d77b0d3..794e4e6b6b63 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -62,15 +62,18 @@ void CrashReporter::addKeyValue(const OUString& rKey, const OUString& rValue, tA { osl::MutexGuard aGuard(maMutex); - if(!rKey.isEmpty()) - maKeyValues.push_back(mpair(rKey, rValue)); - - if(AddKeyHandling != AddItem) + if (IsDumpEnable()) { - if(mbInit) - writeToFile(std::ios_base::app); - else if (AddKeyHandling == Create) - writeCommonInfo(); + if (!rKey.isEmpty()) + maKeyValues.push_back(mpair(rKey, rValue)); + + if (AddKeyHandling != AddItem) + { + if (mbInit) + writeToFile(std::ios_base::app); + else if (AddKeyHandling == Create) + writeCommonInfo(); + } } } @@ -84,8 +87,9 @@ void CrashReporter::writeCommonInfo() const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port); - // save the Keys + // save the new Keys vmaKeyValues atlast = maKeyValues; + // clear the keys, the following Keys should be at the begin maKeyValues.clear(); // limit the amount of code that needs to be executed before the crash reporting @@ -99,6 +103,7 @@ void CrashReporter::writeCommonInfo() addKeyValue("Proxy", proxy_server.aName + ":" + OUString::number(proxy_server.nPort), AddItem); } + // write the new keys at the end maKeyValues.insert(maKeyValues.end(), atlast.begin(), atlast.end()); mbInit = true; @@ -168,9 +173,27 @@ bool CrashReporter::readSendConfig(std::string& response) void CrashReporter::storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler) { - mpExceptionHandler = pExceptionHandler; + if(IsDumpEnable()) + mpExceptionHandler = pExceptionHandler; +} + + + +bool CrashReporter::IsDumpEnable() +{ + OUString sToken; + OString sEnvVar(std::getenv("CRASH_DUMP_ENABLE")); + bool bEnable = true; // default, always on + // read configuration item 'CrashDumpEnable' -> bool on/off + if (rtl::Bootstrap::get("CrashDumpEnable", sToken) && sEnvVar.isEmpty()) + { + bEnable = sToken.toBoolean(); + } + + return bEnable; } + std::string CrashReporter::getIniFileName() { OUString url = getCrashDirectory() + "dump.ini"; |