summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/symstore.sh93
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac15
-rw-r--r--cui/Library_cui.mk3
-rw-r--r--cui/source/options/optgdlg.cxx2
-rw-r--r--desktop/source/app/app.cxx39
-rw-r--r--desktop/source/app/crashreport.cxx118
-rw-r--r--desktop/source/app/sofficemain.cxx14
-rw-r--r--desktop/source/minidump/minidump.cxx24
-rw-r--r--desktop/source/minidump/minidump_upload.cxx2
-rw-r--r--framework/source/services/desktop.cxx2
-rw-r--r--include/desktop/crashreport.hxx59
-rw-r--r--include/desktop/minidump.hxx13
-rw-r--r--instsetoo_native/CustomTarget_setup.mk1
-rw-r--r--instsetoo_native/util/openoffice.lst.in1
-rw-r--r--scp2/source/ooo/common_brand.scp9
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk2
-rw-r--r--svx/source/dialog/crashreportdlg.cxx5
-rw-r--r--vcl/opengl/win/WinDeviceInfo.cxx6
-rw-r--r--vcl/opengl/x11/X11DeviceInfo.cxx4
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx2
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx2
-rw-r--r--vcl/win/app/salinst.cxx2
24 files changed, 283 insertions, 138 deletions
diff --git a/bin/symstore.sh b/bin/symstore.sh
index b368eb3e6715..564739a0279f 100755
--- a/bin/symstore.sh
+++ b/bin/symstore.sh
@@ -1,30 +1,75 @@
#!/usr/bin/env bash
+# Files listed here would not be store in the symbolestore-server.
+# The format is a string with files e.g.
+# BLACKLIST="python.exe
+# file.dll
+# next_file.exe"
+#
+# It removes "python.exe", "file.dll", and "next_file.exe" from what's
+# added to the symstore. Separator is the newline
+BLACK_LIST="python.exe"
+
+# List files here where it's ok for this script to find more than one
+# occurence in the build tree. Files _not_ included here will generate
+# an error, if duplicates are found.
+#
+# Same format as for BLACK_LIST above above
+MOREPDBS_OKLIST="libcurl.dll"
+
+
add_pdb()
{
extension=$1
- type=$2
+ pdbext=$2
list=$3
- for file in $(find "${INSTDIR}/" -name "*.${extension}"); do
+ stats_notfound=0
+ stats_found=0
+ stats_morefound=0
+ declare -a pdball
+ echo "Collect $extension"
+ ret=$(find "${INSTDIR}/" -type f -name "*.${extension}" | grep -vF "$BLACK_LIST")
+ while IFS= read -r file
+ do
# store dll/exe itself (needed for minidumps)
- if [ -f "$file" ]; then
+ if [ $WITHEXEC == 1 ] ; then
cygpath -w "$file" >> "$list"
fi
# store pdb file
filename=$(basename "$file" ".${extension}")
- pdb="${WORKDIR}/LinkTarget/${type}/${filename}.pdb"
- if [ -f "$pdb" ]; then
- cygpath -w "$pdb" >> "$list"
+ pdball+=($(grep -i "/${filename}${pdbext}" <<< ${ALL_PDBS}))
+ if [ -n "${pdball[0]}" ]; then
+ cygpath -w "${pdball[0]}" >> "$list"
fi
- done
+ case ${#pdball[@]} in
+ 0) ((++stats_notfound)) ;;
+ 1) ((++stats_found)) ;;
+ *) ((++stats_morefound))
+ if [ -z "$(echo $file | grep -F "$MOREPDBS_OKLIST")" ]; then
+ echo "Error: found duplicate PDBs:"
+ for morepdbs in ${pdball[@]} ; do
+ echo " $morepdbs"
+ done
+ exit 1
+ fi
+ ;;
+ esac
+ unset pdball
+ done <<EOF
+${ret}
+EOF
+
+ echo " Found PDBs : $stats_found"
+ echo " Missing PDBs : $stats_notfound"
+ echo " Multiple PDBs : $stats_morefound"
}
# check preconditions
-if [ -z "${INSTDIR}" ] || [ -z "${WORKDIR}" ]; then
+if [ -z "${INSTDIR}" -o -z "${WORKDIR}" ]; then
echo "INSTDIR or WORKDIR not set - script expects calling inside buildenv"
exit 1
fi
-if [ ! -d "${INSTDIR}" ] || [ ! -d "${WORKDIR}" ]; then
+if [ ! -d "${INSTDIR}" -o ! -d "${WORKDIR}" ]; then
echo "INSTDIR or WORKDIR not present - script expects calling after full build"
exit 1
fi
@@ -36,12 +81,17 @@ which symstore.exe > /dev/null 2>&1 || {
# defaults
MAX_KEEP=5
SYM_PATH=${WORKDIR}/symstore
+COMMENT=""
+COMCMD=""
+WITHEXEC=1
USAGE="Usage: $0 [-h|-k <keep_num_versions>|-p <symbol_store_path>]
- -h: this cruft
- -k <int>: keep this number of old symbol versions around
- (default: ${MAX_KEEP}. Set to 0 for unlimited)
- -p <path>: specify full path to symbol store tree
+ -h: this cruft
+ -c <comment> specifies a comment for the transaction
+ -n do not store exe/dll on the symbole server
+ -k <int>: keep this number of old symbol versions around
+ (default: ${MAX_KEEP}. Set to 0 for unlimited)
+ -p <path>: specify full path to symbol store tree
If no path is specified, defaults to ${SYM_PATH}.
"
@@ -51,7 +101,9 @@ do
case "$1" in
-k|--keep) MAX_KEEP="$2"; shift 2;;
-p|--path) SYM_PATH="$2"; shift 2;;
- -h|--help) echo "${USAGE}"; exit 0; shift;;
+ -c|--comment) COMCMD="/c"; COMMENT="$2"; shift 2;;
+ -n|--noexec) WITHEXEC=0; shift ;;
+ -h|--help) echo "${USAGE}"; exit 0;;
-*) echo "${USAGE}" >&2; exit 1;;
*) break;;
esac
@@ -66,20 +118,25 @@ fi
TMPFILE=$(mktemp) || exit 1
trap '{ rm -f ${TMPFILE}; }' EXIT
+# collect all PDBs
+ALL_PDBS=$(find "${WORKDIR}/" -type f -name "*.pdb")
+
# add dlls and executables
-add_pdb dll Library "${TMPFILE}"
-add_pdb exe Executable "${TMPFILE}"
+add_pdb dll .pdb "${TMPFILE}"
+add_pdb exe .pdb "${TMPFILE}"
+add_pdb bin .bin.pdb "${TMPFILE}"
# stick all of it into symbol store
-symstore.exe add /compress /f "@$(cygpath -w "${TMPFILE}")" /s "$(cygpath -w "${SYM_PATH}")" /t "${PRODUCTNAME}" /v "${LIBO_VERSION_MAJOR}.${LIBO_VERSION_MINOR}.${LIBO_VERSION_MICRO}.${LIBO_VERSION_PATCH}${LIBO_VERSION_SUFFIX}${LIBO_VERSION_SUFFIX_SUFFIX}"
+symstore.exe add /compress /f "@$(cygpath -w "${TMPFILE}")" /s "$(cygpath -w "${SYM_PATH}")" /t "${PRODUCTNAME}" /v "${LIBO_VERSION_MAJOR}.${LIBO_VERSION_MINOR}.${LIBO_VERSION_MICRO}.${LIBO_VERSION_PATCH}${LIBO_VERSION_SUFFIX}${LIBO_VERSION_SUFFIX_SUFFIX}" "${COMCMD}" "${COMMENT}"
rm -f "${TMPFILE}"
# Cleanup symstore, older revisions will be removed. Unless the
# .dll/.exe changes, the .pdb should be shared, so with incremental
# tinderbox several revisions should not be that space-demanding.
-if [ "${MAX_KEEP}" -gt 0 ] && [ -d "${SYM_PATH}/000Admin" ]; then
+if [ "${MAX_KEEP}" -gt 0 -a -d "${SYM_PATH}/000Admin" ]; then
to_remove=$(ls -1 "${SYM_PATH}/000Admin" | grep -v '\.txt' | grep -v '\.deleted' | sort | head -n "-${MAX_KEEP}")
for revision in $to_remove; do
+ echo "Remove $revision from symstore"
symstore.exe del /i "${revision}" /s "$(cygpath -w "${SYM_PATH}")"
done
fi
diff --git a/config_host.mk.in b/config_host.mk.in
index 683abbff2e05..767011a1cb5d 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -110,6 +110,7 @@ export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
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 4accf14e1215..fe394203bf21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,6 +1056,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.])
@@ -9148,6 +9153,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])
@@ -9158,6 +9164,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"
@@ -9170,6 +9184,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 44bac812c557..302c6890729c 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -60,6 +60,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 3d0e7ee81be7..f765bef9c289 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -69,6 +69,8 @@
#include <officecfg/Office/Common.hxx>
#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>
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index e7a4f82ba081..2682c49d769d 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -122,10 +122,6 @@
#include "langselect.hxx"
-#if HAVE_FEATURE_BREAKPAD
-#include <fstream>
-#endif
-
#if defined MACOSX
#include <errno.h>
#include <sys/wait.h>
@@ -889,26 +885,6 @@ void Desktop::HandleBootstrapErrors(
namespace {
-bool crashReportInfoExists()
-{
-#if HAVE_FEATURE_BREAKPAD
- std::string path = CrashReporter::getIniFileName();
- std::ifstream aFile(path);
- while (aFile.good())
- {
- std::string line;
- std::getline(aFile, line);
- int sep = line.find('=');
- if (sep >= 0)
- {
- std::string key = line.substr(0, sep);
- if (key == "DumpFile")
- return true;
- }
- }
-#endif
- return false;
-}
#if HAVE_FEATURE_BREAKPAD
void handleCrashReport()
@@ -968,7 +944,12 @@ void impl_checkRecoveryState(bool& bCrashed ,
bool& bRecoveryDataExists,
bool& bSessionDataExists )
{
- bCrashed = officecfg::Office::Recovery::RecoveryInfo::Crashed::get() || crashReportInfoExists();
+ bCrashed = officecfg::Office::Recovery::RecoveryInfo::Crashed::get()
+#if HAVE_FEATURE_BREAKPAD
+ || CrashReporter::crashReportInfoExists();
+#else
+ ;
+#endif
bool elements = officecfg::Office::Recovery::RecoveryList::get()->
hasElements();
bool session
@@ -2026,7 +2007,7 @@ void Desktop::OpenClients()
#endif
#if HAVE_FEATURE_BREAKPAD
- if (crashReportInfoExists())
+ if (CrashReporter::crashReportInfoExists())
handleCrashReport();
#endif
@@ -2104,11 +2085,9 @@ void Desktop::OpenClients()
}
}
}
-#if HAVE_FEATURE_BREAKPAD
- CrashReporter::writeCommonInfo();
+
// write this information here to avoid depending on vcl in the crash reporter lib
- CrashReporter::AddKeyValue("Language", Application::GetSettings().GetLanguageTag().getBcp47());
-#endif
+ CrashReporter::addKeyValue("Language", Application::GetSettings().GetLanguageTag().getBcp47(), CrashReporter::Create);
RequestHandler::EnableRequests();
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 29001367bb91..71434ac5b965 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -14,17 +14,17 @@
#include <ucbhelper/proxydecider.hxx>
#include <unotools/bootstrap.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <desktop/minidump.hxx>
#include <config_version.h>
#include <config_folders.h>
#include <string>
-#include <fstream>
-osl::Mutex CrashReporter::maMutex;
#if HAVE_FEATURE_BREAKPAD
+#include <fstream>
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
#include <client/linux/handler/exception_handler.h>
#elif defined WNT
@@ -38,41 +38,47 @@ osl::Mutex CrashReporter::maMutex;
#endif
#endif
+osl::Mutex CrashReporter::maMutex;
google_breakpad::ExceptionHandler* CrashReporter::mpExceptionHandler = nullptr;
bool CrashReporter::mbInit = false;
-std::map<OUString, OUString> CrashReporter::maKeyValues;
+CrashReporter::vmaKeyValues CrashReporter::maKeyValues;
-namespace {
-void writeToStream(std::ofstream& strm, const OUString& rKey, const OUString& rValue)
+void CrashReporter::writeToFile(std::ios_base::openmode Openmode)
{
- strm << rtl::OUStringToOString(rKey, RTL_TEXTENCODING_UTF8).getStr() << "=";
- strm << rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8).getStr() << "\n";
-}
+ std::ofstream ini_file(getIniFileName(), Openmode);
+ for (auto& keyValue : maKeyValues)
+ {
+ ini_file << rtl::OUStringToOString(keyValue.first, RTL_TEXTENCODING_UTF8).getStr() << "=";
+ ini_file << rtl::OUStringToOString(keyValue.second, RTL_TEXTENCODING_UTF8).getStr() << "\n";
+ }
+
+ maKeyValues.clear();
+ ini_file.close();
}
-void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue)
+void CrashReporter::addKeyValue(const OUString& rKey, const OUString& rValue, tAddKeyHandling AddKeyHandling)
{
osl::MutexGuard aGuard(maMutex);
- if (mbInit)
- {
- std::string ini_path = getIniFileName();
- std::ofstream ini_file(ini_path, std::ios_base::app);
- writeToStream(ini_file, rKey, rValue);
- }
- else
+
+ if (IsDumpEnable())
{
- maKeyValues.insert(std::pair<OUString, OUString>(rKey, rValue));
+ if (!rKey.isEmpty())
+ maKeyValues.push_back(mpair(rKey, rValue));
+
+ if (AddKeyHandling != AddItem)
+ {
+ if (mbInit)
+ writeToFile(std::ios_base::app);
+ else if (AddKeyHandling == Create)
+ writeCommonInfo();
+ }
}
}
-#endif
-
void CrashReporter::writeCommonInfo()
{
- osl::MutexGuard aGuard(maMutex);
-
ucbhelper::InternetProxyDecider proxy_decider(::comphelper::getProcessComponentContext());
const OUString protocol = "https";
@@ -81,31 +87,33 @@ void CrashReporter::writeCommonInfo()
const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port);
+ // 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
- std::string ini_path = CrashReporter::getIniFileName();
- std::ofstream minidump_file(ini_path, std::ios_base::trunc);
- minidump_file << "ProductName=LibreOffice\n";
- minidump_file << "Version=" LIBO_VERSION_DOTTED "\n";
- minidump_file << "BuildID=" << utl::Bootstrap::getBuildIdData("") << "\n";
- minidump_file << "URL=" << protocol << "://" << url << "/submit/\n";
+ addKeyValue("ProductName", "LibreOffice", AddItem);
+ addKeyValue("Version", LIBO_VERSION_DOTTED, AddItem);
+ addKeyValue("BuildID", utl::Bootstrap::getBuildIdData(""), AddItem);
+ addKeyValue("URL", protocol + "://" + url + "/submit/", AddItem);
if (proxy_server.aName != OUString())
{
- minidump_file << "Proxy=" << proxy_server.aName << ":" << proxy_server.nPort << "\n";
+ addKeyValue("Proxy", proxy_server.aName + ":" + OUString::number(proxy_server.nPort), AddItem);
}
- for (auto& keyValue : maKeyValues)
- {
- writeToStream(minidump_file, keyValue.first, keyValue.second);
- }
- maKeyValues.clear();
- minidump_file.close();
+ // write the new keys at the end
+ maKeyValues.insert(maKeyValues.end(), atlast.begin(), atlast.end());
mbInit = true;
+ writeToFile(std::ios_base::trunc);
+
updateMinidumpLocation();
}
+
namespace {
OUString getCrashDirectory()
@@ -144,11 +152,48 @@ void CrashReporter::updateMinidumpLocation()
#endif
}
+bool CrashReporter::crashReportInfoExists()
+{
+ static bool first = true;
+ static bool InfoExist = false;
+
+ if (first)
+ {
+ first = false;
+ InfoExist = crashreport::readConfig(CrashReporter::getIniFileName(), nullptr);
+ }
+
+ return InfoExist;
+}
+
+bool CrashReporter::readSendConfig(std::string& response)
+{
+ return crashreport::readConfig(CrashReporter::getIniFileName(), &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";
@@ -157,4 +202,7 @@ std::string CrashReporter::getIniFileName()
return aRet;
}
+
+#endif //HAVE_FEATURE_BREAKPAD
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index 4fb84d39d2d1..d8fc55d86596 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -41,7 +41,6 @@
#include <unotools/mediadescriptor.hxx>
#if HAVE_FEATURE_BREAKPAD
-#include <fstream>
#include <desktop/crashreport.hxx>
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
@@ -76,11 +75,9 @@
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded)
{
- std::string ini_path = CrashReporter::getIniFileName();
- std::ofstream minidump_file(ini_path, std::ios_base::app);
- minidump_file << "DumpFile=" << descriptor.path() << "\n";
- minidump_file.close();
+ CrashReporter::addKeyValue("DumpFile", OStringToOUString(descriptor.path(), RTL_TEXTENCODING_UTF8), CrashReporter::Write);
SAL_WARN("desktop", "minidump generated: " << descriptor.path());
+
return succeeded;
}
#elif defined WNT
@@ -89,17 +86,14 @@ static bool dumpCallback(const wchar_t* path, const wchar_t* id,
MDRawAssertionInfo* /*assertion*/,
bool succeeded)
{
- std::string ini_path = CrashReporter::getIniFileName();
- std::ofstream minidump_file(ini_path, std::ios_base::app);
// TODO: moggi: can we avoid this conversion
#ifdef _MSC_VER
#pragma warning (disable: 4996)
#endif
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv1;
std::string aPath = conv1.to_bytes(std::wstring(path)) + conv1.to_bytes(std::wstring(id)) + ".dmp";
- minidump_file << "DumpFile=" << aPath << "\n";
- minidump_file << "GDIHandles=" << ::GetGuiResources (::GetCurrentProcess(), GR_GDIOBJECTS) << "\n";
- minidump_file.close();
+ CrashReporter::addKeyValue("DumpFile", OStringToOUString(aPath.c_str(), RTL_TEXTENCODING_UTF8), CrashReporter::AddItem);
+ CrashReporter::addKeyValue("GDIHandles", OUString::number(::GetGuiResources (::GetCurrentProcess(), GR_GDIOBJECTS)), CrashReporter::Write);
SAL_WARN("desktop", "minidump generated: " << aPath);
return succeeded;
}
diff --git a/desktop/source/minidump/minidump.cxx b/desktop/source/minidump/minidump.cxx
index f3eefd023b75..05cf13a1e929 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -23,7 +23,9 @@ std::map<std::string, std::string> readStrings(std::istream& file)
{
std::map<std::string, std::string> parameters;
- while (!file.eof())
+ // when file is not readable, the status eof would not be set
+ // better test of state is okay
+ while (file)
{
std::string line;
std::getline(file, line);
@@ -189,7 +191,7 @@ bool uploadContent(std::map<std::string, std::string>& parameters, std::string&
namespace crashreport {
-bool readConfig(const std::string& iniPath, std::string& response)
+bool readConfig(const std::string& iniPath, std::string * response)
{
std::ifstream file(iniPath);
std::map<std::string, std::string> parameters = readStrings(file);
@@ -197,17 +199,29 @@ bool readConfig(const std::string& iniPath, std::string& response)
// make sure that at least the mandatory parameters are in there
if (parameters.find("DumpFile") == parameters.end())
{
- response = "ini file needs to contain a key DumpFile!";
+ if(response != nullptr)
+ *response = "ini file needs to contain a key DumpFile!";
return false;
}
if (parameters.find("Version") == parameters.end())
{
- response = "ini file needs to contain a key Version!";
+ if (response != nullptr)
+ *response = "ini file needs to contain a key Version!";
return false;
}
- return uploadContent(parameters, response);
+ if (parameters.find("URL") == parameters.end())
+ {
+ if (response != nullptr)
+ *response = "ini file needs to contain a key URL!";
+ return false;
+ }
+
+ if (response != nullptr)
+ return uploadContent(parameters, *response);
+
+ return true;
}
}
diff --git a/desktop/source/minidump/minidump_upload.cxx b/desktop/source/minidump/minidump_upload.cxx
index ded2f1df0a43..15af26430764 100644
--- a/desktop/source/minidump/minidump_upload.cxx
+++ b/desktop/source/minidump/minidump_upload.cxx
@@ -22,7 +22,7 @@ int main(int argc, char** argv)
std::string iniPath(argv[1]);
std::string response;
- if (!crashreport::readConfig(iniPath, response))
+ if (!crashreport::readConfig(iniPath, &response))
return EXIT_FAILURE;
std::cout << "Response: " << response << std::endl;
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index d88371979f20..0b296b90dd35 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -314,7 +314,7 @@ sal_Bool SAL_CALL Desktop::terminate()
// see dispose() for further information.
/* SAFE AREA --------------------------------------------------------------------------------------- */
SolarMutexClearableGuard aWriteLock;
- CrashReporter::AddKeyValue("ShutDown", OUString::boolean(true));
+ CrashReporter::addKeyValue("ShutDown", OUString::boolean(true), CrashReporter::Write);
m_bIsTerminated = true;
aWriteLock.clear();
/* UNSAFE AREA ------------------------------------------------------------------------------------- */
diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx
index 6056adbe1d28..585c0af5e1a9 100644
--- a/include/desktop/crashreport.hxx
+++ b/include/desktop/crashreport.hxx
@@ -17,7 +17,8 @@
#include <config_features.h>
-#include <map>
+// vector not sort the entries
+#include <vector>
#include <string>
namespace google_breakpad
@@ -41,40 +42,52 @@ CRASHREPORT_DLLPUBLIC
/*class*/ CrashReporter
{
public:
- static void AddKeyValue(const OUString& rKey, const OUString& rValue);
+ typedef enum {AddItem, Write, Create} tAddKeyHandling;
+#if HAVE_FEATURE_BREAKPAD
+ static void addKeyValue(const OUString& rKey, const OUString& rValue, tAddKeyHandling AddKeyHandling);
- static std::string getIniFileName();
+ static void storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler);
- static void writeCommonInfo();
+ static bool crashReportInfoExists();
- static void storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler);
+ static bool readSendConfig(std::string& response);
- // when we create the ExceptionHandler we have no access to the user
- // profile yet, so update when we have access
- static void updateMinidumpLocation();
+ static bool IsDumpEnable();
private:
-
static osl::Mutex maMutex;
-
static bool mbInit;
-
- static std::map<OUString, OUString> maKeyValues; // used to temporarily save entries before the old info has been uploaded
+ typedef struct _mpair
+ {
+ OUString first;
+ OUString second;
+ _mpair(const OUString& First, const OUString& Second)
+ {
+ first = First;
+ second = Second;
+ };
+ } mpair;
+
+ typedef std::vector<mpair> vmaKeyValues;
+ static vmaKeyValues maKeyValues; // used to temporarily save entries before the old info has been uploaded
static google_breakpad::ExceptionHandler* mpExceptionHandler;
-};
-// Add dummy methods for the non-breakpad case. That allows us to use
-// the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
-// everywhere we want to log something to the crash report system.
-#if HAVE_FEATURE_BREAKPAD
-#else
-inline void CrashReporter::AddKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/)
-{
-}
-#endif
+ static std::string getIniFileName();
+ static void writeCommonInfo();
+ static void writeToFile(std::ios_base::openmode Openmode);
+ // when we create the ExceptionHandler we have no access to the user
+ // profile yet, so update when we have access
+ static void updateMinidumpLocation();
+#else
+ // Add dummy methods for the non-breakpad case. That allows us to use
+ // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
+ // // everywhere we want to log something to the crash report system.
+ inline static void addKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling /*AddKeyHandling*/) {};
+#endif // HAVE_FEATURE_BREAKPAD
+};
-#endif
+#endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/desktop/minidump.hxx b/include/desktop/minidump.hxx
index 63336cae5595..6ed0e18277f8 100644
--- a/include/desktop/minidump.hxx
+++ b/include/desktop/minidump.hxx
@@ -16,7 +16,18 @@
namespace crashreport {
-CRASHREPORT_DLLPUBLIC bool readConfig(const std::string& iniPath, std::string& response);
+// when response = nullptr only make test
+/** Read+Send, Test and send info from the Dump.ini .
+
+ @param [in] iniPath Path-file to the read/test ini-file
+ @param [in] response=nullptr in this case made the Test only
+ @param [in] response!=nullptr in this case made the Read+Send
+
+ @retval true Read+Send, Test was okay
+ @retval false Read+Send, Test is a error
+*/
+
+CRASHREPORT_DLLPUBLIC bool readConfig(const std::string& iniPath, std::string * response);
}
diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk
index 4d47d8d894e8..98ec287ada3f 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/instsetoo_native/util/openoffice.lst.in b/instsetoo_native/util/openoffice.lst.in
index 569c6ed8f9c3..18d3aa742cd7 100644
--- a/instsetoo_native/util/openoffice.lst.in
+++ b/instsetoo_native/util/openoffice.lst.in
@@ -36,6 +36,7 @@ Globals
STARTCENTER_HIDE_EXTERNAL_LINKS 0
64BITPRODUCT @WINDOWS_X64@
WINDOWSSDKVERSION @WINDOWS_SDK_VERSION@
+ CRASHDUMPENABLE @DEFAULT_CRASHDUMP_VALUE@
}
}
}
diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp
index 08e3b43df660..e46bd98acd60 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 = "${CRASHDUMPENABLE}";
+End
+
+
ProfileItem gid_Brand_Profileitem_Soffice_SecureUserConfig
ProfileID = gid_Brand_Profile_Soffice_Ini;
ModuleID = gid_Module_Root_Brand;
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 1dfa3b899ebf..f05793b83dfa 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -114,7 +114,7 @@ gb_LinkTarget_INCLUDE :=\
# We must name the .pdb like libname.pdb, not libname.\(dll\|exe\|pyd\).pdb,
# otherwise WinDbg does not find it.
define gb_LinkTarget__get_pdb_filename
-$(patsubst %.dll,%.pdb,$(patsubst %.exe,%.pdb,$(patsubst %.pyd,%.pdb,$(1))))
+$(patsubst %.dll,%.pdb,$(patsubst %.exe,%.pdb,$(patsubst %.bin,%.bin.pdb,$(patsubst %.pyd,%.pdb,$(1)))))
endef
gb_LinkTarget_get_pdbfile_in = \
diff --git a/svx/source/dialog/crashreportdlg.cxx b/svx/source/dialog/crashreportdlg.cxx
index 70799f969bba..482af1f28950 100644
--- a/svx/source/dialog/crashreportdlg.cxx
+++ b/svx/source/dialog/crashreportdlg.cxx
@@ -14,7 +14,6 @@
#include <rtl/bootstrap.hxx>
#include <desktop/crashreport.hxx>
-#include <desktop/minidump.hxx>
#include <sfx2/safemode.hxx>
#include <comphelper/processfactory.hxx>
#include <osl/file.hxx>
@@ -77,10 +76,8 @@ IMPL_LINK(CrashReportDialog, BtnHdl, Button*, pBtn, void)
{
if (pBtn == mpBtnSend.get())
{
- std::string ini_path = CrashReporter::getIniFileName();
-
std::string response;
- bool bSuccess = crashreport::readConfig(ini_path, response);
+ bool bSuccess = CrashReporter::readSendConfig(response);
OUString aCrashID = OUString::createFromAscii(response.c_str());
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 9b4438cbccdb..00f05df0066d 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -540,9 +540,9 @@ void writeToLog(SvStream& rStrm, const char* pKey, const OUString & rVal)
bool WinOpenGLDeviceInfo::isDeviceBlocked()
{
- CrashReporter::AddKeyValue("OpenGLVendor", maAdapterVendorID);
- CrashReporter::AddKeyValue("OpenGLDevice", maAdapterDeviceID);
- CrashReporter::AddKeyValue("OpenGLDriver", maDriverVersion);
+ CrashReporter::addKeyValue("OpenGLVendor", maAdapterVendorID, CrashReporter::AddItem);
+ CrashReporter::addKeyValue("OpenGLDevice", maAdapterDeviceID, CrashReporter::AddItem);
+ CrashReporter::addKeyValue("OpenGLDriver", maDriverVersion, CrashReporter::Write);
SAL_INFO("vcl.opengl", maDriverVersion);
SAL_INFO("vcl.opengl", maDriverDate);
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index 5388f85c0c3d..6ac3269035f4 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -282,8 +282,8 @@ bool X11OpenGLDeviceInfo::isDeviceBlocked()
if (mnGLMajorVersion == 1)
return true;
- CrashReporter::AddKeyValue("AdapterVendorId", rtl::OStringToOUString(maVendor, RTL_TEXTENCODING_UTF8));
- CrashReporter::AddKeyValue("AdapterDeviceId", rtl::OStringToOUString(maRenderer, RTL_TEXTENCODING_UTF8));
+ CrashReporter::addKeyValue("AdapterVendorId", rtl::OStringToOUString(maVendor, RTL_TEXTENCODING_UTF8), CrashReporter::AddItem);
+ CrashReporter::addKeyValue("AdapterDeviceId", rtl::OStringToOUString(maRenderer, RTL_TEXTENCODING_UTF8), CrashReporter::Write);
SAL_INFO("vcl.opengl", "Vendor: " << maVendor);
SAL_INFO("vcl.opengl", "Renderer: " << maRenderer);
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 3bad4ea44b87..cad628204626 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -1044,7 +1044,7 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
if (!getenv("SAL_DISABLE_GL_WATCHDOG"))
OpenGLWatchdogThread::start();
}
- CrashReporter::AddKeyValue("UseOpenGL", OUString::boolean(bRet));
+ CrashReporter::addKeyValue("UseOpenGL", OUString::boolean(bRet), CrashReporter::Write);
return bRet;
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 8aa9d46f876d..2de55dd63d76 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -361,7 +361,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
catch (const css::uno::Exception &rExcept)
{
DBG_UNHANDLED_EXCEPTION("vcl.layout", "Unable to read .ui file");
- CrashReporter::AddKeyValue("VclBuilderException", "Unable to read .ui file: " + rExcept.Message);
+ CrashReporter::addKeyValue("VclBuilderException", "Unable to read .ui file: " + rExcept.Message, CrashReporter::Write);
throw;
}
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index b7ed29a22f5d..792b6ae1fff0 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -278,7 +278,7 @@ void SalAbort( const OUString& rErrorText, bool bDumpCore )
std::fprintf( stderr, "Application Error\n" );
else
{
- CrashReporter::AddKeyValue("AbortMessage", rErrorText);
+ CrashReporter::addKeyValue("AbortMessage", rErrorText, CrashReporter::Write);
std::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
}
if( bDumpCore )
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 67b6c26b66e5..25c43916338b 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -77,7 +77,7 @@ void SalAbort( const OUString& rErrorText, bool )
}
else
{
- CrashReporter::AddKeyValue("AbortMessage", rErrorText);
+ CrashReporter::addKeyValue("AbortMessage", rErrorText, CrashReporter::Write);
// make sure crash reporter is triggered
RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
FatalAppExitW( 0, o3tl::toW(rErrorText.getStr()) );