From 9943146cfeb10e55785174c651101cb523552aab Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 9 Mar 2021 11:53:09 +0100 Subject: [PATCH] Debugger: Introduce an option to force QT_LOGGING_TO_CONSOLE=1 Debug output is ephemeral in nature, and does not belong into system logs. It happens, however, on Arch. Let people override this. Fixes: QTCREATORBUG-25421 Change-Id: I5686e256d76e5a127e3269c5f407daf39bad683f Reviewed-by: David Schulz --- src/plugins/debugger/commonoptionspage.cpp | 1 + src/plugins/debugger/debuggeractions.cpp | 7 +++++++ src/plugins/debugger/debuggeractions.h | 1 + src/plugins/debugger/debuggerruncontrol.cpp | 3 +++ 4 files changed, 12 insertions(+) diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 80c50b6c729..2f0bc5c758c 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -72,6 +72,7 @@ public: s.switchModeOnExit, s.showQmlObjectTree, s.stationaryEditorWhileStepping, + s.forceLoggingToConsole, s.registerForPostMortem, Stretch() }; diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 00374f27f46..fd6edf4052a 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -118,6 +118,12 @@ DebuggerSettings::DebuggerSettings() "instead of keeping the next statement centered at " "all times.")); + forceLoggingToConsole.setSettingsKey(debugModeGroup, "ForceLoggingToConsole"); + forceLoggingToConsole.setLabelText(tr("Force logging to console")); + forceLoggingToConsole.setToolTip(tr("This sets QT_LOGGING_TO_CONSOLE=1 in the environment " + "of the debugged program, preventing storing debug output " + "in system logs.")); + fontSizeFollowsEditor.setSettingsKey(debugModeGroup, "FontSizeFollowsEditor"); fontSizeFollowsEditor.setToolTip(tr("Changes the font size in the debugger views when" "the font size in the main editor changes.")); @@ -563,6 +569,7 @@ DebuggerSettings::DebuggerSettings() page1.registerAspect(&switchModeOnExit); page1.registerAspect(&showQmlObjectTree); page1.registerAspect(&stationaryEditorWhileStepping); + page1.registerAspect(&forceLoggingToConsole); page1.registerAspect(&sourcePathMap); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 7078f5a9111..0f07cdf226e 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -98,6 +98,7 @@ public: Utils::BoolAspect switchModeOnExit; Utils::BoolAspect showQmlObjectTree; Utils::BoolAspect stationaryEditorWhileStepping; + Utils::BoolAspect forceLoggingToConsole; SourcePathMapAspect sourcePathMap; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 3bb2822bc00..50660ddd579 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -913,6 +913,9 @@ bool DebuggerRunTool::fixupParameters() if (rp.isNativeMixedDebugging()) rp.inferior.environment.set("QV4_FORCE_INTERPRETER", "1"); + if (debuggerSettings()->forceLoggingToConsole.value()) + rp.inferior.environment.set("QT_LOGGING_TO_CONSOLE", "1"); + return true; }