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 <david.schulz@qt.io>
This commit is contained in:
hjk
2021-03-09 11:53:09 +01:00
parent 01be3816f9
commit 9943146cfe
4 changed files with 12 additions and 0 deletions

View File

@@ -72,6 +72,7 @@ public:
s.switchModeOnExit, s.switchModeOnExit,
s.showQmlObjectTree, s.showQmlObjectTree,
s.stationaryEditorWhileStepping, s.stationaryEditorWhileStepping,
s.forceLoggingToConsole,
s.registerForPostMortem, s.registerForPostMortem,
Stretch() Stretch()
}; };

View File

@@ -118,6 +118,12 @@ DebuggerSettings::DebuggerSettings()
"instead of keeping the next statement centered at " "instead of keeping the next statement centered at "
"all times.")); "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.setSettingsKey(debugModeGroup, "FontSizeFollowsEditor");
fontSizeFollowsEditor.setToolTip(tr("Changes the font size in the debugger views when" fontSizeFollowsEditor.setToolTip(tr("Changes the font size in the debugger views when"
"the font size in the main editor changes.")); "the font size in the main editor changes."));
@@ -563,6 +569,7 @@ DebuggerSettings::DebuggerSettings()
page1.registerAspect(&switchModeOnExit); page1.registerAspect(&switchModeOnExit);
page1.registerAspect(&showQmlObjectTree); page1.registerAspect(&showQmlObjectTree);
page1.registerAspect(&stationaryEditorWhileStepping); page1.registerAspect(&stationaryEditorWhileStepping);
page1.registerAspect(&forceLoggingToConsole);
page1.registerAspect(&sourcePathMap); page1.registerAspect(&sourcePathMap);

View File

@@ -98,6 +98,7 @@ public:
Utils::BoolAspect switchModeOnExit; Utils::BoolAspect switchModeOnExit;
Utils::BoolAspect showQmlObjectTree; Utils::BoolAspect showQmlObjectTree;
Utils::BoolAspect stationaryEditorWhileStepping; Utils::BoolAspect stationaryEditorWhileStepping;
Utils::BoolAspect forceLoggingToConsole;
SourcePathMapAspect sourcePathMap; SourcePathMapAspect sourcePathMap;

View File

@@ -913,6 +913,9 @@ bool DebuggerRunTool::fixupParameters()
if (rp.isNativeMixedDebugging()) if (rp.isNativeMixedDebugging())
rp.inferior.environment.set("QV4_FORCE_INTERPRETER", "1"); rp.inferior.environment.set("QV4_FORCE_INTERPRETER", "1");
if (debuggerSettings()->forceLoggingToConsole.value())
rp.inferior.environment.set("QT_LOGGING_TO_CONSOLE", "1");
return true; return true;
} }