forked from qt-creator/qt-creator
Debugger: Dissolve a few more setRunParameter() cases
Change-Id: I92d7b75c9a9758ab8c2ad8f9956ebcd8ecc9cb69 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1224,20 +1224,19 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
*errorMessage = msgParameterMissing(*it);
|
||||
return false;
|
||||
}
|
||||
DebuggerRunParameters rp;
|
||||
rp.startMode = AttachCrashedExternal;
|
||||
rp.crashParameter = it->section(QLatin1Char(':'), 0, 0);
|
||||
rp.attachPID = ProcessHandle(it->section(QLatin1Char(':'), 1, 1).toULongLong());
|
||||
rp.displayName = tr("Crashed process %1").arg(rp.attachPID.pid());
|
||||
rp.startMessage = tr("Attaching to crashed process %1").arg(rp.attachPID.pid());
|
||||
if (!rp.attachPID.isValid()) {
|
||||
qint64 pid = it->section(':', 1, 1).toULongLong();
|
||||
auto debugger = DebuggerRunTool::createFromKit(findUniversalCdbKit());
|
||||
QTC_ASSERT(debugger, return false);
|
||||
debugger->setStartMode(AttachCrashedExternal);
|
||||
debugger->setCrashParameter(it->section(':', 0, 0));
|
||||
debugger->setAttachPid(pid);
|
||||
debugger->setRunControlName(tr("Crashed process %1").arg(pid));
|
||||
debugger->setStartMessage(tr("Attaching to crashed process %1").arg(pid));
|
||||
if (pid < 1) {
|
||||
*errorMessage = DebuggerPlugin::tr("The parameter \"%1\" of option \"%2\" "
|
||||
"does not match the pattern <handle>:<pid>.").arg(*it, option);
|
||||
return false;
|
||||
}
|
||||
auto debugger = DebuggerRunTool::createFromKit(findUniversalCdbKit());
|
||||
QTC_ASSERT(debugger, return false);
|
||||
debugger->setRunParameters(rp);
|
||||
m_scheduledStarts.append(debugger);
|
||||
return true;
|
||||
}
|
||||
|
@@ -198,6 +198,11 @@ void DebuggerRunTool::setAttachPid(ProcessHandle pid)
|
||||
m_runParameters.attachPID = pid;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setAttachPid(qint64 pid)
|
||||
{
|
||||
m_runParameters.attachPID = ProcessHandle(pid);
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setSysRoot(const QString &sysRoot)
|
||||
{
|
||||
m_runParameters.sysRoot = sysRoot;
|
||||
@@ -215,6 +220,11 @@ void DebuggerRunTool::setRemoteChannel(const QString &channel)
|
||||
m_runParameters.remoteChannel = channel;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setRemoteChannel(const QString &host, int port)
|
||||
{
|
||||
m_runParameters.remoteChannel = QString("%1:%2").arg(host).arg(port);
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setUseExtendedRemote(bool on)
|
||||
{
|
||||
m_runParameters.useExtendedRemote = on;
|
||||
@@ -286,6 +296,17 @@ void DebuggerRunTool::setRunControlName(const QString &name)
|
||||
m_runParameters.displayName = name;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setStartMessage(const QString &msg)
|
||||
{
|
||||
m_runParameters.startMessage = msg;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setCoreFileName(const QString &coreFile, bool isSnapshot)
|
||||
{
|
||||
m_runParameters.coreFile = coreFile;
|
||||
m_runParameters.isSnapshot = isSnapshot;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::appendInferiorCommandLineArgument(const QString &arg)
|
||||
{
|
||||
if (!m_runParameters.inferior.commandLineArguments.isEmpty())
|
||||
@@ -312,6 +333,16 @@ void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setMasterEngineType(DebuggerEngineType engineType)
|
||||
{
|
||||
m_runParameters.masterEngineType = engineType;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setCrashParameter(const QString &event)
|
||||
{
|
||||
m_runParameters.crashParameter = event;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::addExpectedSignal(const QString &signal)
|
||||
{
|
||||
m_runParameters.expectedSignals.append(signal);
|
||||
|
@@ -88,10 +88,14 @@ public:
|
||||
void setInferior(const ProjectExplorer::Runnable &runnable);
|
||||
void setInferiorExecutable(const QString &executable);
|
||||
void setRunControlName(const QString &name);
|
||||
void setStartMessage(const QString &msg);
|
||||
void appendInferiorCommandLineArgument(const QString &arg);
|
||||
void prependInferiorCommandLineArgument(const QString &arg);
|
||||
void addQmlServerInferiorCommandLineArgumentIfNeeded();
|
||||
|
||||
void setMasterEngineType(DebuggerEngineType engineType);
|
||||
void setCrashParameter(const QString &event);
|
||||
|
||||
void addExpectedSignal(const QString &signal);
|
||||
void addSearchDirectory(const QString &dir);
|
||||
|
||||
@@ -99,9 +103,12 @@ public:
|
||||
void setCloseMode(DebuggerCloseMode closeMode);
|
||||
|
||||
void setAttachPid(Utils::ProcessHandle pid);
|
||||
void setAttachPid(qint64 pid);
|
||||
|
||||
void setSysRoot(const QString &sysRoot);
|
||||
void setSymbolFile(const QString &symbolFile);
|
||||
void setRemoteChannel(const QString &channel);
|
||||
void setRemoteChannel(const QString &host, int port);
|
||||
|
||||
void setUseExtendedRemote(bool on);
|
||||
void setUseContinueInsteadOfRun(bool on);
|
||||
@@ -114,6 +121,8 @@ public:
|
||||
|
||||
void setQmlServer(const QUrl &qmlServer);
|
||||
|
||||
void setCoreFileName(const QString &core, bool isSnapshot = false);
|
||||
|
||||
void setIosPlatform(const QString &platform);
|
||||
void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
|
||||
|
||||
|
@@ -3294,9 +3294,6 @@ void GdbEngine::createSnapshot()
|
||||
void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QString &coreFile)
|
||||
{
|
||||
if (response.resultClass == ResultDone) {
|
||||
DebuggerRunParameters rp = runParameters();
|
||||
rp.startMode = AttachCore;
|
||||
rp.coreFile = coreFile;
|
||||
//snapshot.setDate(QDateTime::currentDateTime());
|
||||
StackFrames frames = stackHandler()->frames();
|
||||
QString function = "<unknown>";
|
||||
@@ -3304,11 +3301,12 @@ void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QStri
|
||||
const StackFrame &frame = frames.at(0);
|
||||
function = frame.function + ":" + QString::number(frame.line);
|
||||
}
|
||||
rp.displayName = function + ": " + QDateTime::currentDateTime().toString();
|
||||
rp.isSnapshot = true;
|
||||
auto rc = new RunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
(void) new DebuggerRunTool(rc, rp);
|
||||
ProjectExplorerPlugin::startRunControl(rc);
|
||||
auto debugger = DebuggerRunTool::createFromRunConfiguration(runControl()->runConfiguration());
|
||||
QTC_ASSERT(debugger, return);
|
||||
debugger->setStartMode(AttachCore);
|
||||
debugger->setRunControlName(function + ": " + QDateTime::currentDateTime().toString());
|
||||
debugger->setCoreFileName(coreFile, true);
|
||||
debugger->startRunControl();
|
||||
} else {
|
||||
QString msg = response.data["msg"].data();
|
||||
AsynchronousMessageBox::critical(tr("Snapshot Creation Error"),
|
||||
|
@@ -207,17 +207,17 @@ void GdbServerStarter::attach(int port)
|
||||
return;
|
||||
}
|
||||
|
||||
DebuggerRunParameters rp;
|
||||
rp.masterEngineType = GdbEngineType;
|
||||
rp.remoteChannel = QString("%1:%2").arg(d->device->sshParameters().host).arg(port);
|
||||
rp.displayName = tr("Remote: \"%1\"").arg(rp.remoteChannel);
|
||||
rp.inferior.executable = localExecutable;
|
||||
rp.startMode = AttachToRemoteServer;
|
||||
rp.closeMode = KillAtClose;
|
||||
QString remoteChannel = QString("%1:%2").arg(d->device->sshParameters().host).arg(port);
|
||||
|
||||
auto debugger = DebuggerRunTool::createFromKit(d->kit);
|
||||
QTC_ASSERT(debugger, return);
|
||||
debugger->setRunParameters(rp);
|
||||
debugger->setMasterEngineType(GdbEngineType);
|
||||
debugger->setRemoteChannel(remoteChannel);
|
||||
debugger->setRunControlName(tr("Remote: \"%1\"").arg(remoteChannel));
|
||||
debugger->setInferiorExecutable(localExecutable);
|
||||
debugger->setStartMode(AttachToRemoteServer);
|
||||
debugger->setCloseMode(KillAtClose);
|
||||
|
||||
debugger->startRunControl();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user