forked from qt-creator/qt-creator
debugger: make the selection of detach or kill explicit
Change-Id: I6f80047ad229e0be851b06a277ab2f899757828f Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -134,6 +134,12 @@ enum DebuggerStartMode
|
||||
StartRemoteEngine // Start ipc guest engine on other machine
|
||||
};
|
||||
|
||||
enum DebuggerCloseMode
|
||||
{
|
||||
KillAtClose,
|
||||
DetachAtClose
|
||||
};
|
||||
|
||||
enum DebuggerCapabilities
|
||||
{
|
||||
ReverseSteppingCapability = 0x1,
|
||||
|
@@ -1339,6 +1339,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
qulonglong pid = it->toULongLong();
|
||||
if (pid) {
|
||||
sp.startMode = AttachExternal;
|
||||
sp.closeMode = DetachAtClose;
|
||||
sp.attachPID = pid;
|
||||
sp.displayName = tr("Process %1").arg(sp.attachPID);
|
||||
sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID);
|
||||
@@ -1560,6 +1561,7 @@ void DebuggerPluginPrivate::attachExternalApplication()
|
||||
sp.displayName = tr("Process %1").arg(dlg.attachPID());
|
||||
sp.executable = dlg.executable();
|
||||
sp.startMode = AttachExternal;
|
||||
sp.closeMode = DetachAtClose;
|
||||
sp.toolChainAbi = dlg.abi();
|
||||
sp.debuggerCommand = dlg.debuggerCommand();
|
||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||
@@ -1572,6 +1574,7 @@ void DebuggerPluginPrivate::attachExternalApplication(RunControl *rc)
|
||||
sp.attachPID = rc->applicationProcessHandle().pid();
|
||||
sp.displayName = tr("Debugger attached to %1").arg(rc->displayName());
|
||||
sp.startMode = AttachExternal;
|
||||
sp.closeMode = DetachAtClose;
|
||||
sp.toolChainAbi = rc->abi();
|
||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||
startDebugger(rc);
|
||||
@@ -1617,6 +1620,7 @@ void DebuggerPluginPrivate::attachToRemoteServer(const QString &spec)
|
||||
sp.remoteArchitecture = spec.section(QLatin1Char('@'), 2, 2);
|
||||
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
|
||||
sp.startMode = AttachToRemoteServer;
|
||||
sp.closeMode = KillAtClose;
|
||||
sp.toolChainAbi = anyAbiOfBinary(sp.executable);
|
||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||
startDebugger(rc);
|
||||
@@ -1630,6 +1634,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
|
||||
sp.toolChainAbi = Abi(hostAbi.architecture(), Abi::WindowsOS,
|
||||
Abi::WindowsMsvc2010Flavor, Abi::PEFormat, hostAbi.wordWidth());
|
||||
sp.startMode = AttachToRemoteServer;
|
||||
sp.closeMode = KillAtClose;
|
||||
StartRemoteCdbDialog dlg(mainWindow());
|
||||
QString previousConnection = configValue(connectionKey).toString();
|
||||
if (previousConnection.isEmpty())
|
||||
@@ -1666,6 +1671,7 @@ void DebuggerPluginPrivate::attachToRemoteServer()
|
||||
DebuggerStartParameters sp;
|
||||
if (StartRemoteDialog::run(mainWindow(), m_coreSettings, false, &sp)) {
|
||||
sp.startMode = AttachToRemoteServer;
|
||||
sp.closeMode = KillAtClose;
|
||||
sp.useServerStartScript = false;
|
||||
sp.serverStartScript.clear();
|
||||
if (RunControl *rc = createDebugger(sp))
|
||||
@@ -1742,6 +1748,7 @@ void DebuggerPluginPrivate::attachedToProcess(const QString &channel,
|
||||
sp.sysroot = sysroot;
|
||||
sp.executable = localExecutable;
|
||||
sp.startMode = AttachToRemoteServer;
|
||||
sp.closeMode = KillAtClose;
|
||||
sp.overrideStartScript.clear();
|
||||
sp.useServerStartScript = false;
|
||||
sp.serverStartScript.clear();
|
||||
@@ -1785,6 +1792,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
||||
sp.sysroot = dlg.sysroot();
|
||||
|
||||
sp.startMode = AttachToRemoteServer;
|
||||
sp.closeMode = KillAtClose;
|
||||
sp.languages = QmlLanguage;
|
||||
|
||||
//
|
||||
|
@@ -67,6 +67,7 @@ public:
|
||||
useServerStartScript(false),
|
||||
requestRemoteSetup(false),
|
||||
startMode(NoStartMode),
|
||||
closeMode(KillAtClose),
|
||||
executableUid(0),
|
||||
communicationChannel(CommunicationChannelTcpIp),
|
||||
serverPort(0),
|
||||
@@ -125,6 +126,7 @@ public:
|
||||
QString dumperLibrary;
|
||||
QStringList dumperLibraryLocations;
|
||||
DebuggerStartMode startMode;
|
||||
DebuggerCloseMode closeMode;
|
||||
|
||||
// For Symbian debugging.
|
||||
quint32 executableUid;
|
||||
|
@@ -75,7 +75,6 @@ public:
|
||||
virtual void setupInferior() = 0;
|
||||
virtual void runEngine() = 0;
|
||||
virtual void interruptInferior() = 0;
|
||||
virtual void shutdownInferior() = 0;
|
||||
virtual void shutdownAdapter() = 0;
|
||||
virtual AbstractGdbProcess *gdbProc() = 0;
|
||||
|
||||
|
@@ -116,11 +116,6 @@ void AttachGdbAdapter::interruptInferior()
|
||||
interruptLocalInferior(startParameters().attachPID);
|
||||
}
|
||||
|
||||
void AttachGdbAdapter::shutdownInferior()
|
||||
{
|
||||
m_engine->defaultInferiorShutdown("detach");
|
||||
}
|
||||
|
||||
void AttachGdbAdapter::shutdownAdapter()
|
||||
{
|
||||
m_engine->notifyAdapterShutdownOk();
|
||||
|
@@ -59,7 +59,6 @@ private:
|
||||
void setupInferior();
|
||||
void runEngine();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
|
||||
AbstractGdbProcess *gdbProc() { return &m_gdbProc; }
|
||||
|
@@ -1237,11 +1237,6 @@ void CodaGdbAdapter::cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
void CodaGdbAdapter::shutdownInferior()
|
||||
{
|
||||
m_engine->defaultInferiorShutdown("kill");
|
||||
}
|
||||
|
||||
void CodaGdbAdapter::shutdownAdapter()
|
||||
{
|
||||
if (m_gdbProc.state() == QProcess::Running) {
|
||||
|
@@ -114,7 +114,6 @@ private:
|
||||
void setupInferior();
|
||||
void runEngine();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
void sendRunControlTerminateCommand();
|
||||
void handleRunControlTerminate(const Coda::CodaCommandResult &);
|
||||
|
@@ -1893,13 +1893,15 @@ void GdbEngine::shutdownInferior()
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
||||
m_commandsToRunOnTemporaryBreak.clear();
|
||||
m_gdbAdapter->shutdownInferior();
|
||||
switch (startParameters().closeMode) {
|
||||
case KillAtClose:
|
||||
postCommand("kill", NeedsStop | LosesChild, CB(handleInferiorShutdown));
|
||||
break;
|
||||
case DetachAtClose:
|
||||
postCommand("detach", NeedsStop | LosesChild, CB(handleInferiorShutdown));
|
||||
break;
|
||||
}
|
||||
|
||||
void GdbEngine::defaultInferiorShutdown(const char *cmd)
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
|
||||
postCommand(cmd, NeedsStop | LosesChild, CB(handleInferiorShutdown));
|
||||
QTC_ASSERT(false, notifyInferiorShutdownFailed());
|
||||
}
|
||||
|
||||
void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
|
||||
|
@@ -264,7 +264,6 @@ private: ////////// Gdb Process Management //////////
|
||||
void handleNamespaceExtraction(const GdbResponse &response);
|
||||
|
||||
void handleAdapterStarted();
|
||||
void defaultInferiorShutdown(const char *cmd);
|
||||
void loadInitScript();
|
||||
void loadPythonDumpers();
|
||||
void pythonDumpersFailed();
|
||||
|
@@ -114,11 +114,6 @@ void LocalPlainGdbAdapter::runEngine()
|
||||
AbstractPlainGdbAdapter::runEngine();
|
||||
}
|
||||
|
||||
void LocalPlainGdbAdapter::shutdownInferior()
|
||||
{
|
||||
m_engine->defaultInferiorShutdown("kill");
|
||||
}
|
||||
|
||||
void LocalPlainGdbAdapter::shutdownAdapter()
|
||||
{
|
||||
showMessage(_("PLAIN ADAPTER SHUTDOWN %1").arg(state()));
|
||||
|
@@ -58,7 +58,6 @@ private:
|
||||
void setupInferior();
|
||||
void runEngine();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
|
||||
DumperHandling dumperHandling() const;
|
||||
|
@@ -365,14 +365,6 @@ void RemoteGdbServerAdapter::handleInterruptInferior(const GdbResponse &response
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteGdbServerAdapter::shutdownInferior()
|
||||
{
|
||||
if (m_engine->startParameters().startMode == AttachToRemoteServer)
|
||||
m_engine->defaultInferiorShutdown("detach");
|
||||
else
|
||||
m_engine->defaultInferiorShutdown("kill");
|
||||
}
|
||||
|
||||
void RemoteGdbServerAdapter::shutdownAdapter()
|
||||
{
|
||||
m_engine->notifyAdapterShutdownOk();
|
||||
|
@@ -59,7 +59,6 @@ private:
|
||||
void setupInferior();
|
||||
void runEngine();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
|
||||
AbstractGdbProcess *gdbProc() { return &m_gdbProc; }
|
||||
|
@@ -98,11 +98,6 @@ void RemotePlainGdbAdapter::handleApplicationOutput(const QByteArray &output)
|
||||
showMessage(QString::fromUtf8(output), AppOutput);
|
||||
}
|
||||
|
||||
void RemotePlainGdbAdapter::shutdownInferior()
|
||||
{
|
||||
m_engine->defaultInferiorShutdown("kill");
|
||||
}
|
||||
|
||||
void RemotePlainGdbAdapter::shutdownAdapter()
|
||||
{
|
||||
m_engine->notifyAdapterShutdownOk();
|
||||
|
@@ -55,7 +55,6 @@ private:
|
||||
void startAdapter();
|
||||
void setupInferior();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
|
||||
void handleRemoteSetupFailed(const QString &reason);
|
||||
|
@@ -210,11 +210,6 @@ void TermGdbAdapter::stubExited()
|
||||
m_engine->notifyEngineIll();
|
||||
}
|
||||
|
||||
void TermGdbAdapter::shutdownInferior()
|
||||
{
|
||||
m_engine->defaultInferiorShutdown("kill");
|
||||
}
|
||||
|
||||
void TermGdbAdapter::shutdownAdapter()
|
||||
{
|
||||
m_engine->notifyAdapterShutdownOk();
|
||||
|
@@ -62,7 +62,6 @@ private:
|
||||
void setupInferior();
|
||||
void runEngine();
|
||||
void interruptInferior();
|
||||
void shutdownInferior();
|
||||
void shutdownAdapter();
|
||||
|
||||
AbstractGdbProcess *gdbProc() { return &m_gdbProc; }
|
||||
|
Reference in New Issue
Block a user