Debugger: Transform a few fields of DebuggerRunParameters

Transform overrideStartScript and startMessage.

Task-number: QTCREATORBUG-29168
Change-Id: Ib29a200aac0007aec0683066f841b8f5692471d6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2025-01-13 15:23:42 +01:00
parent a6e780782b
commit 7d5126b431
6 changed files with 16 additions and 21 deletions

View File

@@ -196,8 +196,12 @@ public:
Utils::ProcessRunData debugger() const { return m_debugger; }; Utils::ProcessRunData debugger() const { return m_debugger; };
Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging void setOverrideStartScript(const Utils::FilePath &script) { m_overrideStartScript = script; }
QString startMessage; // First status message shown. Utils::FilePath overrideStartScript() const { return m_overrideStartScript; }
void setStartMessage(const QString &msg) { m_startMessage = msg; }
// FIXME: Add a startMessage() getter and use it.
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory". Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory" QStringList debugSourceLocation; // Gdb "directory"
Utils::FilePath qtSourceLocation; Utils::FilePath qtSourceLocation;
@@ -301,6 +305,9 @@ private:
bool m_runAsRoot = false; bool m_runAsRoot = false;
Utils::ProcessRunData m_debugger; Utils::ProcessRunData m_debugger;
Utils::FilePath m_overrideStartScript; // Used in attach to core and remote debugging
QString m_startMessage; // First status message shown.
}; };
namespace Internal { namespace Internal {

View File

@@ -1402,22 +1402,22 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
rp.setCloseMode(DetachAtClose); rp.setCloseMode(DetachAtClose);
rp.setAttachPid(pid); rp.setAttachPid(pid);
rp.setDisplayName(Tr::tr("Process %1").arg(pid)); rp.setDisplayName(Tr::tr("Process %1").arg(pid));
debugger->setStartMessage(Tr::tr("Attaching to local process %1.").arg(pid)); rp.setStartMessage(Tr::tr("Attaching to local process %1.").arg(pid));
} else if (startMode == AttachToRemoteServer) { } else if (startMode == AttachToRemoteServer) {
rp.setStartMode(AttachToRemoteServer); rp.setStartMode(AttachToRemoteServer);
rp.setRemoteChannel(remoteChannel); rp.setRemoteChannel(remoteChannel);
rp.setDisplayName(Tr::tr("Remote: \"%1\"").arg(remoteChannel)); rp.setDisplayName(Tr::tr("Remote: \"%1\"").arg(remoteChannel));
debugger->setStartMessage(Tr::tr("Attaching to remote server %1.").arg(remoteChannel)); rp.setStartMessage(Tr::tr("Attaching to remote server %1.").arg(remoteChannel));
} else if (startMode == AttachToCore) { } else if (startMode == AttachToCore) {
rp.setStartMode(AttachToCore); rp.setStartMode(AttachToCore);
rp.setCloseMode(DetachAtClose); rp.setCloseMode(DetachAtClose);
rp.setCoreFilePath(coreFile); rp.setCoreFilePath(coreFile);
rp.setDisplayName(Tr::tr("Core file \"%1\"").arg(coreFile.toUserOutput())); rp.setDisplayName(Tr::tr("Core file \"%1\"").arg(coreFile.toUserOutput()));
debugger->setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput())); rp.setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput()));
} else { } else {
rp.setStartMode(StartExternal); rp.setStartMode(StartExternal);
rp.setDisplayName(Tr::tr("Executable file \"%1\"").arg(executable.toUserOutput())); rp.setDisplayName(Tr::tr("Executable file \"%1\"").arg(executable.toUserOutput()));
debugger->setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput())); rp.setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput()));
} }
rp.setUseTerminal(useTerminal); rp.setUseTerminal(useTerminal);
@@ -1444,7 +1444,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
debugger->setCrashParameter(it->section(':', 0, 0)); debugger->setCrashParameter(it->section(':', 0, 0));
rp.setAttachPid(pid); rp.setAttachPid(pid);
rp.setDisplayName(Tr::tr("Crashed process %1").arg(pid)); rp.setDisplayName(Tr::tr("Crashed process %1").arg(pid));
debugger->setStartMessage(Tr::tr("Attaching to crashed process %1").arg(pid)); rp.setStartMessage(Tr::tr("Attaching to crashed process %1").arg(pid));
if (pid < 1) { if (pid < 1) {
*errorMessage = Tr::tr("The parameter \"%1\" of option \"%2\" " *errorMessage = Tr::tr("The parameter \"%1\" of option \"%2\" "
"does not match the pattern <handle>:<pid>.").arg(*it, option); "does not match the pattern <handle>:<pid>.").arg(*it, option);

View File

@@ -113,21 +113,11 @@ void DebuggerRunTool::setTestCase(int testCase)
m_runParameters.testCase = testCase; m_runParameters.testCase = testCase;
} }
void DebuggerRunTool::setOverrideStartScript(const FilePath &script)
{
m_runParameters.overrideStartScript = script;
}
void DebuggerRunTool::setAbi(const Abi &abi) void DebuggerRunTool::setAbi(const Abi &abi)
{ {
m_runParameters.toolChainAbi = abi; m_runParameters.toolChainAbi = abi;
} }
void DebuggerRunTool::setStartMessage(const QString &msg)
{
m_runParameters.startMessage = msg;
}
void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded() void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
{ {
d->addQmlServerInferiorCommandLineArgumentIfNeeded = true; d->addQmlServerInferiorCommandLineArgumentIfNeeded = true;

View File

@@ -30,7 +30,6 @@ public:
void start() override; void start() override;
void stop() override; void stop() override;
void setStartMessage(const QString &msg);
void setCrashParameter(const QString &event); void setCrashParameter(const QString &event);
void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti); void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti);
@@ -38,7 +37,6 @@ public:
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
void setTestCase(int testCase); void setTestCase(int testCase);
void setOverrideStartScript(const Utils::FilePath &script);
void kickoffTerminalProcess(); void kickoffTerminalProcess();
void interruptTerminal(); void interruptTerminal();

View File

@@ -4077,7 +4077,7 @@ void GdbEngine::handleGdbStartFailed()
void GdbEngine::loadInitScript() void GdbEngine::loadInitScript()
{ {
const FilePath script = runParameters().overrideStartScript; const FilePath script = runParameters().overrideStartScript();
if (!script.isEmpty()) { if (!script.isEmpty()) {
if (script.isReadableFile()) { if (script.isReadableFile()) {
runCommand({"source " + script.path()}); runCommand({"source " + script.path()});

View File

@@ -355,7 +355,7 @@ void runAttachToCoreDialog()
rp.setCoreFilePath(dlg.coreFileCopy()); rp.setCoreFilePath(dlg.coreFileCopy());
rp.setStartMode(AttachToCore); rp.setStartMode(AttachToCore);
rp.setCloseMode(DetachAtClose); rp.setCloseMode(DetachAtClose);
debugger->setOverrideStartScript(dlg.overrideStartScript()); rp.setOverrideStartScript(dlg.overrideStartScript());
const FilePath sysRoot = dlg.sysRoot(); const FilePath sysRoot = dlg.sysRoot();
if (!sysRoot.isEmpty()) if (!sysRoot.isEmpty())
rp.setSysRoot(sysRoot); rp.setSysRoot(sysRoot);