Fix baremetal pipe channel connection

Clean baremetal plugin a bit

Change-Id: I36d0d5a372f8ad2f06faa2c1db659e80d3afe8d6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
BogDan Vatra
2025-04-17 18:09:53 +03:00
committed by BogDan Vatra
parent 108dbb4dd3
commit 55290588d9
9 changed files with 20 additions and 72 deletions

View File

@@ -79,7 +79,6 @@ public:
bool operator==(const IDebugServerProvider &other) const final;
QString channelString() const final;
Utils::CommandLine command() const final;
QSet<StartupMode> supportedStartupModes() const final;
@@ -138,17 +137,6 @@ QString EBlinkGdbServerProvider::scriptFileWoExt() const
return m_deviceScript.absolutePath().pathAppended(m_deviceScript.baseName()).path();
}
QString EBlinkGdbServerProvider::channelString() const
{
switch (startupMode()) {
case StartupOnNetwork:
// Just return as "host:port" form.
return GdbServerProvider::channelString();
default:
return {};
}
}
CommandLine EBlinkGdbServerProvider::command() const
{
CommandLine cmd{m_executableFile};

View File

@@ -130,7 +130,8 @@ void GdbServerProvider::toMap(Store &data) const
bool GdbServerProvider::isValid() const
{
return !channelString().isEmpty();
return (m_startupMode == GdbServerProvider::StartupOnNetwork && channel().isValid()) ||
(m_startupMode == GdbServerProvider::StartupOnPipe && !channelPipe().isEmpty());
}
Result<> GdbServerProvider::setupDebuggerRunParameters(DebuggerRunParameters &rp,
@@ -155,7 +156,10 @@ Result<> GdbServerProvider::setupDebuggerRunParameters(DebuggerRunParameters &rp
rp.setStartMode(AttachToRemoteServer);
rp.setCommandsAfterConnect(initCommands()); // .. and here?
rp.setCommandsForReset(resetCommands());
rp.setRemoteChannel(channelString());
if (m_startupMode == GdbServerProvider::StartupOnNetwork)
rp.setRemoteChannel(channel());
else
rp.setRemoteChannelPipe(channelPipe());
rp.setUseContinueInsteadOfRun(true);
rp.setUseExtendedRemote(useExtendedRemote());
rp.setPeripheralDescriptionFile(m_peripheralDescriptionFile);

View File

@@ -84,7 +84,6 @@ public:
bool operator==(const IDebugServerProvider &other) const final;
QString channelString() const final;
CommandLine command() const final;
QSet<StartupMode> supportedStartupModes() const final;
@@ -130,17 +129,6 @@ QString JLinkGdbServerProvider::defaultResetCommands()
return {"monitor reset halt\n"};
}
QString JLinkGdbServerProvider::channelString() const
{
switch (startupMode()) {
case StartupOnNetwork:
// Just return as "host:port" form.
return GdbServerProvider::channelString();
default: // wrong
return {};
}
}
CommandLine JLinkGdbServerProvider::command() const
{
CommandLine cmd{m_executableFile};

View File

@@ -60,7 +60,7 @@ public:
bool operator==(const IDebugServerProvider &other) const final;
QString channelString() const final;
QString channelPipe() const final;
Utils::CommandLine command() const final;
QSet<StartupMode> supportedStartupModes() const final;
@@ -105,17 +105,10 @@ QString OpenOcdGdbServerProvider::defaultResetCommands()
return {"monitor reset halt\n"};
}
QString OpenOcdGdbServerProvider::channelString() const
QString OpenOcdGdbServerProvider::channelPipe() const
{
switch (startupMode()) {
case StartupOnNetwork:
// Just return as "host:port" form.
return GdbServerProvider::channelString();
case StartupOnPipe: {
// In the pipe mode need to add quotes to each item of arguments;
// otherwise running will be stuck.
CommandLine cmd = command();
QStringList args = {"|", cmd.executable().path()};
QStringList args = {cmd.executable().path()};
for (const QString &a : ProcessArgs::splitArgs(cmd.arguments(), HostOsInfo::hostOs())) {
if (a.startsWith('\"') && a.endsWith('\"'))
args << a;
@@ -123,10 +116,6 @@ QString OpenOcdGdbServerProvider::channelString() const
args << ('\"' + a + '\"');
}
return args.join(' ');
}
default: // wrong
return {};
}
}
CommandLine OpenOcdGdbServerProvider::command() const

View File

@@ -72,7 +72,6 @@ public:
bool operator==(const IDebugServerProvider &other) const final;
QString channelString() const final;
Utils::CommandLine command() const final;
QSet<StartupMode> supportedStartupModes() const final;
@@ -115,20 +114,6 @@ QString StLinkUtilGdbServerProvider::defaultResetCommands()
return {};
}
QString StLinkUtilGdbServerProvider::channelString() const
{
switch (startupMode()) {
case StartupOnNetwork:
// Just return as "host:port" form.
return GdbServerProvider::channelString();
case StartupOnPipe:
// Unsupported mode
return {};
default: // wrong
return {};
}
}
CommandLine StLinkUtilGdbServerProvider::command() const
{
CommandLine cmd{m_executableFile};

View File

@@ -154,11 +154,6 @@ bool UvscServerProvider::isValid() const
return m_channel.isValid();
}
QString UvscServerProvider::channelString() const
{
return m_channel.toString();
}
Result<> UvscServerProvider::setupDebuggerRunParameters(DebuggerRunParameters &rp,
RunControl *runControl) const
{
@@ -190,7 +185,7 @@ Result<> UvscServerProvider::setupDebuggerRunParameters(DebuggerRunParameters &r
rp.setInferior(inferior);
rp.setSymbolFile(bin);
rp.setStartMode(AttachToRemoteServer);
rp.setRemoteChannel(channelString());
rp.setRemoteChannel(channelPipe());
rp.setUseContinueInsteadOfRun(true);
return ResultOk;
}

View File

@@ -52,7 +52,6 @@ public:
ProjectExplorer::RunWorker *targetRunner(ProjectExplorer::RunControl *runControl) const final;
bool isValid() const override;
QString channelString() const final;
static QString buildDllRegistryKey(const Uv::DriverSelection &driver);
static QString adjustFlashAlgorithmProperty(const QString &property);

View File

@@ -83,9 +83,9 @@ QUrl IDebugServerProvider::channel() const
return m_channel;
}
QString IDebugServerProvider::channelString() const
QString IDebugServerProvider::channelPipe() const
{
return m_channel.toString();
return {};
}
QString IDebugServerProvider::id() const

View File

@@ -53,7 +53,7 @@ public:
void setChannel(const QUrl &channel);
void setChannel(const QString &host, int port);
virtual QString channelString() const;
virtual QString channelPipe() const;
QString id() const;
QString typeDisplayName() const;