Debugger: Transform DebuggerRunParameters::commandsAfterConnect

Task-number: QTCREATORBUG-29168
Change-Id: Ifdf756b62940d083ea123d3ef8b08c7c7702fb10
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2025-01-10 12:58:33 +01:00
parent 6adaac46a8
commit bdc1b186c1
7 changed files with 9 additions and 14 deletions

View File

@@ -146,7 +146,7 @@ bool GdbServerProvider::aboutToRun(DebuggerRunTool *runTool, QString &errorMessa
rp.setInferior(inferior); rp.setInferior(inferior);
rp.setSymbolFile(bin); rp.setSymbolFile(bin);
rp.setStartMode(AttachToRemoteServer); rp.setStartMode(AttachToRemoteServer);
runTool->setCommandsAfterConnect(initCommands()); // .. and here? rp.setCommandsAfterConnect(initCommands()); // .. and here?
rp.setCommandsForReset(resetCommands()); rp.setCommandsForReset(resetCommands());
rp.setRemoteChannel(channelString()); rp.setRemoteChannel(channelString());
rp.setUseContinueInsteadOfRun(true); rp.setUseContinueInsteadOfRun(true);

View File

@@ -437,8 +437,8 @@ void CdbEngine::handleInitialSessionIdle()
{ {
m_initialSessionIdleHandled = true; m_initialSessionIdleHandled = true;
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
if (!rp.commandsAfterConnect.isEmpty()) if (!rp.commandsAfterConnect().isEmpty())
runCommand({rp.commandsAfterConnect, NoFlags}); runCommand({rp.commandsAfterConnect(), NoFlags});
//operateByInstructionTriggered(operatesByInstruction()); //operateByInstructionTriggered(operatesByInstruction());
// QmlCppEngine expects the QML engine to be connected before any breakpoints are hit // QmlCppEngine expects the QML engine to be connected before any breakpoints are hit
// (attemptBreakpointSynchronization() will be directly called then) // (attemptBreakpointSynchronization() will be directly called then)

View File

@@ -417,7 +417,7 @@ void StartApplicationDialog::run(bool attachRemote)
debugger->setBreakOnMain(newParameters.breakAtMain); debugger->setBreakOnMain(newParameters.breakAtMain);
debugger->setDebugInfoLocation(newParameters.debugInfoLocation); debugger->setDebugInfoLocation(newParameters.debugInfoLocation);
rp.setInferior(newParameters.runnable); rp.setInferior(newParameters.runnable);
debugger->setCommandsAfterConnect(newParameters.serverInitCommands); rp.setCommandsAfterConnect(newParameters.serverInitCommands);
rp.setCommandsForReset(newParameters.serverResetCommands); rp.setCommandsForReset(newParameters.serverResetCommands);
debugger->setUseTerminal(newParameters.runInTerminal); debugger->setUseTerminal(newParameters.runInTerminal);
rp.setUseExtendedRemote(newParameters.useTargetExtendedRemote); rp.setUseExtendedRemote(newParameters.useTargetExtendedRemote);

View File

@@ -135,7 +135,8 @@ public:
void setUseContinueInsteadOfRun(bool on) { m_useContinueInsteadOfRun = on; } void setUseContinueInsteadOfRun(bool on) { m_useContinueInsteadOfRun = on; }
bool useContinueInsteadOfRun() const { return m_useContinueInsteadOfRun; } bool useContinueInsteadOfRun() const { return m_useContinueInsteadOfRun; }
QString commandsAfterConnect; // additional commands to post after connection to debug target void setCommandsAfterConnect(const QString &commands) { m_commandsAfterConnect = commands; }
QString commandsAfterConnect() const { return m_commandsAfterConnect; }
// Used by Valgrind // Used by Valgrind
QStringList expectedSignals; QStringList expectedSignals;
@@ -242,6 +243,7 @@ private:
QString m_commandsForReset; // Used by baremetal plugin. Commands used for resetting the inferior QString m_commandsForReset; // Used by baremetal plugin. Commands used for resetting the inferior
bool m_useContinueInsteadOfRun = false; // If connected to a hw debugger run is not possible but continue is used bool m_useContinueInsteadOfRun = false; // If connected to a hw debugger run is not possible but continue is used
QString m_commandsAfterConnect; // Additional commands to post after connection to debug target
}; };
namespace Internal { namespace Internal {

View File

@@ -143,11 +143,6 @@ void DebuggerRunTool::setUseTerminal(bool on)
m_runParameters.useTerminal = on; m_runParameters.useTerminal = on;
} }
void DebuggerRunTool::setCommandsAfterConnect(const QString &commands)
{
m_runParameters.commandsAfterConnect = commands;
}
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation) void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
{ {
m_runParameters.debugInfoLocation = debugInfoLocation; m_runParameters.debugInfoLocation = debugInfoLocation;

View File

@@ -42,8 +42,6 @@ public:
void setUseTerminal(bool on); void setUseTerminal(bool on);
void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti); void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti);
void setCommandsAfterConnect(const QString &commands);
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation); void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false); void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false);

View File

@@ -4436,8 +4436,8 @@ void GdbEngine::claimInitialBreakpoints()
// and even if it fails (e.g. due to stripped binaries), continuing with // and even if it fails (e.g. due to stripped binaries), continuing with
// the start up is the best we can do. // the start up is the best we can do.
if (!rp.commandsAfterConnect.isEmpty()) { if (!rp.commandsAfterConnect().isEmpty()) {
const QString commands = expand(rp.commandsAfterConnect); const QString commands = expand(rp.commandsAfterConnect());
for (const QString &command : commands.split('\n')) for (const QString &command : commands.split('\n'))
runCommand({command, NativeCommand}); runCommand({command, NativeCommand});
} }