Debugger: Use a FilePathAspect for extra dumpers

Change-Id: Ideb779cc5ef0d679667b635efe8c1a2859c6e608
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2023-05-22 14:41:27 +02:00
parent 06365fa39f
commit d685fbccf0
5 changed files with 10 additions and 11 deletions

View File

@@ -2824,10 +2824,10 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
runCommand({"theDumper = Dumper()", ScriptCommand}); runCommand({"theDumper = Dumper()", ScriptCommand});
} }
const QString path = debuggerSettings()->extraDumperFile.value(); const FilePath path = debuggerSettings()->extraDumperFile();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand); DebuggerCommand cmd("theDumper.addDumperModule", ScriptCommand);
cmd.arg("path", path); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }
const QString commands = debuggerSettings()->extraDumperCommands.value(); const QString commands = debuggerSettings()->extraDumperCommands.value();

View File

@@ -364,7 +364,6 @@ DebuggerSettings::DebuggerSettings()
+ "</p></body></html>"); + "</p></body></html>");
extraDumperFile.setSettingsKey(debugModeGroup, "ExtraDumperFile"); extraDumperFile.setSettingsKey(debugModeGroup, "ExtraDumperFile");
extraDumperFile.setDisplayStyle(StringAspect::PathChooserDisplay);
extraDumperFile.setDisplayName(Tr::tr("Extra Debugging Helpers")); extraDumperFile.setDisplayName(Tr::tr("Extra Debugging Helpers"));
// Label text is intentional empty in the GUI. // Label text is intentional empty in the GUI.
extraDumperFile.setToolTip(Tr::tr("Path to a Python file containing additional data dumpers.")); extraDumperFile.setToolTip(Tr::tr("Path to a Python file containing additional data dumpers."));

View File

@@ -106,7 +106,7 @@ public:
Utils::BoolAspect useDebuggingHelpers; Utils::BoolAspect useDebuggingHelpers;
Utils::BoolAspect useCodeModel; Utils::BoolAspect useCodeModel;
Utils::BoolAspect showThreadNames; Utils::BoolAspect showThreadNames;
Utils::StringAspect extraDumperFile; // For loading a file. Recommended. Utils::FilePathAspect extraDumperFile; // For loading a file. Recommended.
Utils::StringAspect extraDumperCommands; // To modify an existing setup. Utils::StringAspect extraDumperCommands; // To modify an existing setup.
Utils::BoolAspect showStdNamespace; Utils::BoolAspect showStdNamespace;

View File

@@ -4026,10 +4026,10 @@ void GdbEngine::handleGdbStarted()
runCommand({"python from gdbbridge import *"}); runCommand({"python from gdbbridge import *"});
} }
const QString path = debuggerSettings()->extraDumperFile.value(); const FilePath path = debuggerSettings()->extraDumperFile();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }

View File

@@ -228,10 +228,10 @@ void LldbEngine::handleLldbStarted()
if (!commands.isEmpty()) if (!commands.isEmpty())
executeCommand(commands); executeCommand(commands);
const QString path = debuggerSettings()->extraDumperFile.value(); const FilePath path = debuggerSettings()->extraDumperFile();
if (!path.isEmpty() && QFileInfo(path).isReadable()) { if (!path.isEmpty() && path.isReadableFile()) {
DebuggerCommand cmd("addDumperModule"); DebuggerCommand cmd("addDumperModule");
cmd.arg("path", path); cmd.arg("path", path.path());
runCommand(cmd); runCommand(cmd);
} }