diff options
author | Gopi Krishna Menon <gopi.menon@collabora.com> | 2021-06-17 13:23:11 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-06-18 11:00:57 +0200 |
commit | 781c70a8c87878ac0e53c9c4619a4d19d3d737de (patch) | |
tree | 242efb62a362e1ad0ecb3740d86b2301bc0e3b80 /desktop | |
parent | 3c24e7ed972ae2fc431365e4884e27c0b243c905 (diff) |
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>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/crashreport.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 7d3fc8e036b6..7d70c9603d9a 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -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() |