Add Last 4 UNO Commands To CrashReport Dump
Adds last 4 uno commands executed in CrashReport to assist in investigating the crashes Change-Id: Ib7307ffc62d6d51d52f9d5e7fabefc2eaf858e5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117388 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
parent
3c24e7ed97
commit
781c70a8c8
3 changed files with 48 additions and 0 deletions
|
@ -44,9 +44,11 @@
|
|||
|
||||
osl::Mutex CrashReporter::maMutex;
|
||||
osl::Mutex CrashReporter::maActiveSfxObjectNameMutex;
|
||||
osl::Mutex CrashReporter::maUnoLogCmdMutex;
|
||||
std::unique_ptr<google_breakpad::ExceptionHandler> CrashReporter::mpExceptionHandler;
|
||||
bool CrashReporter::mbInit = false;
|
||||
CrashReporter::vmaKeyValues CrashReporter::maKeyValues;
|
||||
CrashReporter::vmaloggedUnoCommands CrashReporter::maloggedUnoCommands;
|
||||
OUString CrashReporter::msActiveSfxObjectName;
|
||||
|
||||
|
||||
|
@ -54,6 +56,7 @@ OUString CrashReporter::msActiveSfxObjectName;
|
|||
static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded)
|
||||
{
|
||||
CrashReporter::addKeyValue("Active-SfxObject",CrashReporter::getActiveSfxObjectName(),CrashReporter::AddItem);
|
||||
CrashReporter::addKeyValue("Last-4-Uno-Commands",CrashReporter::getLoggedUnoCommands(),CrashReporter::AddItem);
|
||||
CrashReporter::addKeyValue("DumpFile", OStringToOUString(descriptor.path(), RTL_TEXTENCODING_UTF8), CrashReporter::Write);
|
||||
SAL_WARN("desktop", "minidump generated: " << descriptor.path());
|
||||
|
||||
|
@ -72,6 +75,7 @@ static bool dumpCallback(const wchar_t* path, const wchar_t* id,
|
|||
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";
|
||||
CrashReporter::addKeyValue("Active-SfxObject",CrashReporter::getActiveSfxObjectName(),CrashReporter::AddItem);
|
||||
CrashReporter::addKeyValue("Last-4-Uno-Commands",CrashReporter::getLoggedUnoCommands(),CrashReporter::AddItem);
|
||||
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);
|
||||
|
@ -175,6 +179,32 @@ OUString CrashReporter::getActiveSfxObjectName()
|
|||
return msActiveSfxObjectName;
|
||||
}
|
||||
|
||||
void CrashReporter::logUnoCommand(const OUString& rUnoCommand)
|
||||
{
|
||||
osl::MutexGuard aGuard(maUnoLogCmdMutex);
|
||||
|
||||
if( maloggedUnoCommands.size() == 4 )
|
||||
maloggedUnoCommands.pop_front();
|
||||
|
||||
maloggedUnoCommands.push_back(rUnoCommand);
|
||||
}
|
||||
|
||||
OUString CrashReporter::getLoggedUnoCommands()
|
||||
{
|
||||
osl::MutexGuard aGuard(maUnoLogCmdMutex);
|
||||
|
||||
OUString aCommandSeperator="";
|
||||
OUStringBuffer aUnoCommandBuffer;
|
||||
|
||||
for( auto& unocommand: maloggedUnoCommands)
|
||||
{
|
||||
aUnoCommandBuffer.append(aCommandSeperator);
|
||||
aUnoCommandBuffer.append(unocommand);
|
||||
aCommandSeperator=",";
|
||||
}
|
||||
return aUnoCommandBuffer.toString();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
OUString getCrashDirectory()
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
// vector not sort the entries
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
namespace google_breakpad
|
||||
|
@ -53,6 +54,9 @@ public:
|
|||
static void setActiveSfxObjectName(const OUString& rActiveSfxObjectName);
|
||||
static OUString getActiveSfxObjectName();
|
||||
|
||||
static void logUnoCommand(const OUString& rUnoCommand);
|
||||
static OUString getLoggedUnoCommands();
|
||||
|
||||
static bool crashReportInfoExists();
|
||||
|
||||
static bool readSendConfig(std::string& response);
|
||||
|
@ -62,6 +66,7 @@ public:
|
|||
private:
|
||||
static osl::Mutex maMutex;
|
||||
static osl::Mutex maActiveSfxObjectNameMutex;
|
||||
static osl::Mutex maUnoLogCmdMutex;
|
||||
static bool mbInit;
|
||||
typedef struct _mpair
|
||||
{
|
||||
|
@ -76,6 +81,8 @@ private:
|
|||
|
||||
typedef std::vector<mpair> vmaKeyValues;
|
||||
static vmaKeyValues maKeyValues; // used to temporarily save entries before the old info has been uploaded
|
||||
typedef std::deque<OUString> vmaloggedUnoCommands;
|
||||
static vmaloggedUnoCommands maloggedUnoCommands;
|
||||
static OUString msActiveSfxObjectName;
|
||||
|
||||
static std::unique_ptr<google_breakpad::ExceptionHandler> mpExceptionHandler;
|
||||
|
@ -98,6 +105,11 @@ private:
|
|||
{
|
||||
return OUString();
|
||||
}
|
||||
inline static void logUnoCommand(SAL_UNUSED_PARAMETER const OUString& /*rUnoCommand*/) {};
|
||||
inline static OUString getLoggedUnoCommands()
|
||||
{
|
||||
return OUString();
|
||||
}
|
||||
#endif // HAVE_FEATURE_BREAKPAD
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
|
||||
#include <comphelper/lok.hxx>
|
||||
|
||||
#include <desktop/crashreport.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::util;
|
||||
|
@ -613,6 +615,10 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
|
|||
const css::uno::Sequence< css::beans::PropertyValue >& aArgs,
|
||||
const css::uno::Reference< css::frame::XDispatchResultListener >& rListener )
|
||||
{
|
||||
if ( aURL.Protocol == ".uno:")
|
||||
{
|
||||
CrashReporter::logUnoCommand(aURL.Path);
|
||||
}
|
||||
collectUsageInformation(aURL, aArgs);
|
||||
collectUIInformation(aURL, aArgs);
|
||||
|
||||
|
|
Loading…
Reference in a new issue