Add arguments to Last 4 UNO Commands in CrashReport Dump
Change-Id: I8ea1e95abb62374b51de7b1d37055c216b29e04c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173125 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
parent
e663655d04
commit
763b86a5fa
4 changed files with 43 additions and 52 deletions
|
@ -9840,7 +9840,6 @@ UITestLogger::UITestLogger()
|
||||||
UITestLogger::log(std::basic_string_view<char16_t, std::char_traits<char16_t> >)
|
UITestLogger::log(std::basic_string_view<char16_t, std::char_traits<char16_t> >)
|
||||||
UITestLogger::logAction(VclPtr<Control> const&, VclEventId)
|
UITestLogger::logAction(VclPtr<Control> const&, VclEventId)
|
||||||
UITestLogger::logAction(vcl::Window* const&, VclEventId)
|
UITestLogger::logAction(vcl::Window* const&, VclEventId)
|
||||||
UITestLogger::logCommand(std::basic_string_view<char16_t, std::char_traits<char16_t> >, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
|
|
||||||
UITestLogger::logKeyInput(VclPtr<vcl::Window> const&, KeyEvent const&)
|
UITestLogger::logKeyInput(VclPtr<vcl::Window> const&, KeyEvent const&)
|
||||||
URIHelper::SetMaybeFileHdl(Link<rtl::OUString*, bool> const&)
|
URIHelper::SetMaybeFileHdl(Link<rtl::OUString*, bool> const&)
|
||||||
UnoControl::GetComponentServiceName() const
|
UnoControl::GetComponentServiceName() const
|
||||||
|
|
|
@ -43,9 +43,6 @@ private:
|
||||||
public:
|
public:
|
||||||
UITestLogger();
|
UITestLogger();
|
||||||
|
|
||||||
void logCommand(std::u16string_view rAction,
|
|
||||||
const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
|
|
||||||
|
|
||||||
void logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent);
|
void logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent);
|
||||||
|
|
||||||
void logAction(vcl::Window* const& xUIWin, VclEventId nEvent);
|
void logAction(vcl::Window* const& xUIWin, VclEventId nEvent);
|
||||||
|
|
|
@ -512,14 +512,54 @@ OUString SfxDispatchController_Impl::getSlaveCommand( const css::util::URL& rURL
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
OUString parseArguments(std::u16string_view rAction,
|
||||||
|
const css::uno::Sequence<css::beans::PropertyValue>& rArgs)
|
||||||
|
{
|
||||||
|
OUStringBuffer aBuffer(rAction);
|
||||||
|
|
||||||
|
if (rArgs.hasElements())
|
||||||
|
{
|
||||||
|
aBuffer.append(" {");
|
||||||
|
for (const css::beans::PropertyValue& rProp : rArgs)
|
||||||
|
{
|
||||||
|
OUString aTypeName = rProp.Value.getValueTypeName();
|
||||||
|
|
||||||
|
if (aTypeName == "long" || aTypeName == "short")
|
||||||
|
{
|
||||||
|
sal_Int32 nValue = 0;
|
||||||
|
rProp.Value >>= nValue;
|
||||||
|
aBuffer.append("\"" + rProp.Name + "\": " + OUString::number(nValue) + ", ");
|
||||||
|
}
|
||||||
|
else if (aTypeName == "unsigned long")
|
||||||
|
{
|
||||||
|
sal_uInt32 nValue = 0;
|
||||||
|
rProp.Value >>= nValue;
|
||||||
|
aBuffer.append("\"" + rProp.Name + "\": " + OUString::number(nValue) + ", ");
|
||||||
|
}
|
||||||
|
else if (aTypeName == "boolean")
|
||||||
|
{
|
||||||
|
bool bValue = false;
|
||||||
|
rProp.Value >>= bValue;
|
||||||
|
aBuffer.append("\"" + rProp.Name + "\": ");
|
||||||
|
if (bValue)
|
||||||
|
aBuffer.append("True, ");
|
||||||
|
else
|
||||||
|
aBuffer.append("False, ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aBuffer.append("}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return aBuffer.makeStringAndClear();
|
||||||
|
}
|
||||||
|
|
||||||
void collectUIInformation(const util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
|
void collectUIInformation(const util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
|
||||||
{
|
{
|
||||||
static const char* pFile = std::getenv("LO_COLLECT_UIINFO");
|
static const char* pFile = std::getenv("LO_COLLECT_UIINFO");
|
||||||
if (!pFile)
|
if (!pFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UITestLogger::getInstance().logCommand(
|
UITestLogger::getInstance().log(parseArguments(Concat2View("Send UNO Command (\"" + rURL.Complete + "\") "), rArgs));
|
||||||
Concat2View("Send UNO Command (\"" + rURL.Complete + "\") "), rArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -530,7 +570,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
|
||||||
{
|
{
|
||||||
if ( aURL.Protocol == ".uno:")
|
if ( aURL.Protocol == ".uno:")
|
||||||
{
|
{
|
||||||
CrashReporter::logUnoCommand(aURL.Path);
|
CrashReporter::logUnoCommand(parseArguments(aURL.Path, aArgs));
|
||||||
}
|
}
|
||||||
collectUIInformation(aURL, aArgs);
|
collectUIInformation(aURL, aArgs);
|
||||||
|
|
||||||
|
|
|
@ -79,51 +79,6 @@ UITestLogger::UITestLogger()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITestLogger::logCommand(std::u16string_view rAction,
|
|
||||||
const css::uno::Sequence<css::beans::PropertyValue>& rArgs)
|
|
||||||
{
|
|
||||||
if (!mbValid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
OUStringBuffer aBuffer(rAction);
|
|
||||||
|
|
||||||
if (rArgs.hasElements())
|
|
||||||
{
|
|
||||||
aBuffer.append(" {");
|
|
||||||
for (const css::beans::PropertyValue& rProp : rArgs)
|
|
||||||
{
|
|
||||||
OUString aTypeName = rProp.Value.getValueTypeName();
|
|
||||||
|
|
||||||
if (aTypeName == "long" || aTypeName == "short")
|
|
||||||
{
|
|
||||||
sal_Int32 nValue = 0;
|
|
||||||
rProp.Value >>= nValue;
|
|
||||||
aBuffer.append("\"" + rProp.Name + "\": " + OUString::number(nValue) + ", ");
|
|
||||||
}
|
|
||||||
else if (aTypeName == "unsigned long")
|
|
||||||
{
|
|
||||||
sal_uInt32 nValue = 0;
|
|
||||||
rProp.Value >>= nValue;
|
|
||||||
aBuffer.append("\"" + rProp.Name + "\": " + OUString::number(nValue) + ", ");
|
|
||||||
}
|
|
||||||
else if (aTypeName == "boolean")
|
|
||||||
{
|
|
||||||
bool bValue = false;
|
|
||||||
rProp.Value >>= bValue;
|
|
||||||
aBuffer.append("\"" + rProp.Name + "\": ");
|
|
||||||
if (bValue)
|
|
||||||
aBuffer.append("True, ");
|
|
||||||
else
|
|
||||||
aBuffer.append("False, ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aBuffer.append("}");
|
|
||||||
}
|
|
||||||
|
|
||||||
OUString aCommand(aBuffer.makeStringAndClear());
|
|
||||||
maStream.WriteLine(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8));
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// most likely this should be recursive
|
// most likely this should be recursive
|
||||||
|
|
Loading…
Reference in a new issue