diff options
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | cui/Library_cui.mk | 3 | ||||
-rw-r--r-- | cui/source/options/optgdlg.cxx | 5 | ||||
-rw-r--r-- | desktop/source/app/crashreport.cxx | 43 | ||||
-rw-r--r-- | include/desktop/crashreport.hxx | 2 | ||||
-rw-r--r-- | instsetoo_native/CustomTarget_setup.mk | 1 | ||||
-rw-r--r-- | scp2/source/ooo/common_brand.scp | 9 |
8 files changed, 67 insertions, 12 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 048e14a538ab..9a1bb81f70d7 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -118,6 +118,7 @@ export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@ export ENABLE_ANDROID_EDITING=@ENABLE_ANDROID_EDITING@ export ENABLE_AVAHI=@ENABLE_AVAHI@ export ENABLE_BREAKPAD=@ENABLE_BREAKPAD@ +export DEFAULT_CRASHDUMP_VALUE=@DEFAULT_CRASHDUMP_VALUE@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@ export ENABLE_CHART_TESTS=@ENABLE_CHART_TESTS@ export ENABLE_CIPHER_OPENSSL_BACKEND=@ENABLE_CIPHER_OPENSSL_BACKEND@ diff --git a/configure.ac b/configure.ac index 9de464819664..364efe36621a 100644 --- a/configure.ac +++ b/configure.ac @@ -1050,6 +1050,11 @@ libo_FUZZ_ARG_ENABLE(breakpad, [Enables breakpad for crash reporting.]) ) +libo_FUZZ_ARG_ENABLE(crashdump, + AS_HELP_STRING([--disable-crashdump], + [Disable dump.ini and dump-file, when --enable-breakpad]) +) + AC_ARG_ENABLE(fetch-external, AS_HELP_STRING([--disable-fetch-external], [Disables fetching external tarballs from web sources.]) @@ -9515,6 +9520,7 @@ AC_SUBST(ICU_UCHAR_TYPE) dnl ================================================================== dnl Breakpad dnl ================================================================== +DEFAULT_CRASHDUMP_VALUE="true" AC_MSG_CHECKING([whether to enable breakpad]) if test "$enable_breakpad" != yes; then AC_MSG_RESULT([no]) @@ -9525,6 +9531,14 @@ else AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1) BUILD_TYPE="$BUILD_TYPE BREAKPAD" + AC_MSG_CHECKING([for disable crash dump]) + if test "$enable_crashdump" = no; then + DEFAULT_CRASHDUMP_VALUE="false" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + AC_MSG_CHECKING([for crashreport config]) if test "$with_symbol_config" = "no"; then BREAKPAD_SYMBOL_CONFIG="invalid" @@ -9537,6 +9551,7 @@ else AC_SUBST(BREAKPAD_SYMBOL_CONFIG) fi AC_SUBST(ENABLE_BREAKPAD) +AC_SUBST(DEFAULT_CRASHDUMP_VALUE) dnl ================================================================== dnl libfuzzer diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 54e3733daef1..e45e35a8f0e3 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -59,6 +59,9 @@ $(eval $(call gb_Library_use_libraries,cui,\ ucbhelper \ utl \ vcl \ + $(if $(ENABLE_BREAKPAD), \ + crashreport \ + ) \ )) $(eval $(call gb_Library_use_externals,cui,\ diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 3c92e50a6ac2..c41a2ab51576 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -51,6 +51,7 @@ #include <officecfg/Setup.hxx> #include <comphelper/configuration.hxx> #include <tools/diagnose_ex.h> +#include <desktop/crashreport.hxx> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -392,8 +393,8 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) m_xCollectUsageInfo->save_state(); #if HAVE_FEATURE_BREAKPAD - m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get()); - m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly()); + m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable()); + m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable()); m_xCrashReport->save_state(); #else m_xCrashReport->hide(); 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"; diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx index 3af83b8e637c..585c0af5e1a9 100644 --- a/include/desktop/crashreport.hxx +++ b/include/desktop/crashreport.hxx @@ -52,6 +52,8 @@ public: static bool readSendConfig(std::string& response); + static bool IsDumpEnable(); + private: static osl::Mutex maMutex; static bool mbInit; diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index 209404ec0e1b..b30f78052f9c 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -119,6 +119,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ ( \ echo '[Bootstrap]' \ && echo 'CrashDirectory=$${$$BRAND_BASE_DIR/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap):UserInstallation}/crash' \ + && echo 'CrashDumpEnable=$(DEFAULT_CRASHDUMP_VALUE)' \ && echo 'HideEula=1' \ && echo 'Logo=1' \ && echo 'NativeProgress=false' \ diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index 08e3b43df660..1209c5786fb5 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -439,6 +439,15 @@ ProfileItem gid_Brand_Profileitem_Soffice_CrashDirectory Value = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" PROFILENAME(bootstrap) ":UserInstallation}/crash"; End +ProfileItem gid_Brand_Profileitem_Soffice_CrashDump + ProfileID = gid_Brand_Profile_Soffice_Ini; + ModuleID = gid_Module_Root_Brand; + Section = "Bootstrap"; + Key = "CrashDumpEnable"; + Value = "true"; +End + + ProfileItem gid_Brand_Profileitem_Soffice_SecureUserConfig ProfileID = gid_Brand_Profile_Soffice_Ini; ModuleID = gid_Module_Root_Brand; |