Debugger: Rename 'AttachExternal' to 'AttachToLocalProcess'

And AttachCrashedExternal to AttachToCrashedProcess
And AttachCore to AttachToCore.

Clearer.

Change-Id: I47c2eca5cbdbbc0eb38b9f62b2504c96558ff112
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-01-06 16:56:36 +01:00
parent 111cc934fd
commit da147880e8
11 changed files with 59 additions and 59 deletions

View File

@@ -331,11 +331,11 @@ void CdbEngine::setupEngine()
// Use the Creator stub instead.
DebuggerRunParameters sp = runParameters();
if (terminal()) {
m_effectiveStartMode = AttachExternal;
m_effectiveStartMode = AttachToLocalProcess;
sp.inferior.executable.clear();
sp.inferior.commandLineArguments.clear();
sp.attachPID = ProcessHandle(terminal()->applicationPid());
sp.startMode = AttachExternal;
sp.startMode = AttachToLocalProcess;
sp.useTerminal = false; // Force no terminal.
showMessage(QString("Attaching to %1...").arg(sp.attachPID.pid()), LogMisc);
} else {
@@ -409,17 +409,17 @@ void CdbEngine::setupEngine()
break;
case AttachToRemoteServer:
break;
case AttachExternal:
case AttachCrashedExternal:
case AttachToLocalProcess:
case AttachToCrashedProcess:
debugger.addArgs({"-p", QString::number(sp.attachPID.pid())});
if (sp.startMode == AttachCrashedExternal) {
if (sp.startMode == AttachToCrashedProcess) {
debugger.addArgs({"-e", sp.crashParameter, "-g"});
} else {
if (terminal())
debugger.addArgs({"-pr", "-pb"});
}
break;
case AttachCore:
case AttachToCore:
debugger.addArgs({"-z", sp.coreFile});
break;
default:
@@ -527,7 +527,7 @@ void CdbEngine::handleInitialSessionIdle()
// Fails for core dumps.
if (response.resultClass == ResultDone)
notifyInferiorPid(response.data.toProcessHandle());
if (response.resultClass == ResultDone || runParameters().startMode == AttachCore) {
if (response.resultClass == ResultDone || runParameters().startMode == AttachToCore) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
notifyEngineSetupOk();
runEngine();
@@ -605,7 +605,7 @@ void CdbEngine::runEngine()
// runCommand({"bm /( QtCored4!qFatal", BuiltinCommand}); // 'bm': All overloads.
// runCommand({"bm /( Qt5Cored!QMessageLogger::fatal", BuiltinCommand});
// }
if (runParameters().startMode == AttachCore) {
if (runParameters().startMode == AttachToCore) {
QTC_ASSERT(!m_coreStopReason.isNull(), return; );
notifyEngineRunOkAndInferiorUnrunnable();
processStop(*m_coreStopReason, false);
@@ -630,7 +630,7 @@ void CdbEngine::shutdownInferior()
qDebug("notifyInferiorShutdownFinished");
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorShutdownFinished")
} else if (m_accessible) { // except console.
if (runParameters().startMode == AttachExternal || runParameters().startMode == AttachCrashedExternal)
if (runParameters().startMode == AttachToLocalProcess || runParameters().startMode == AttachToCrashedProcess)
detachDebugger();
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorShutdownFinished")
} else {
@@ -677,7 +677,7 @@ void CdbEngine::shutdownEngine()
// Go for kill if there are commands pending.
if (m_accessible && !commandsPending()) {
// detach (except console): Wait for debugger to finish.
if (runParameters().startMode == AttachExternal || runParameters().startMode == AttachCrashedExternal)
if (runParameters().startMode == AttachToLocalProcess || runParameters().startMode == AttachToCrashedProcess)
detachDebugger();
// Remote requires a bit more force to quit.
if (m_effectiveStartMode == AttachToRemoteServer) {
@@ -1812,7 +1812,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
}
// Notify about state and send off command sequence to get stack, etc.
if (stopFlags & StopNotifyStop) {
if (runParameters().startMode != AttachCore) {
if (runParameters().startMode != AttachToCore) {
if (state() == InferiorStopRequested) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
notifyInferiorStopOk();
@@ -2073,7 +2073,7 @@ void CdbEngine::handleSessionIdle(const QString &message)
if (!m_initialSessionIdleHandled) { // Temporary stop at beginning
handleInitialSessionIdle();
// Store stop reason to be handled in runEngine().
if (runParameters().startMode == AttachCore) {
if (runParameters().startMode == AttachToCore) {
m_coreStopReason.reset(new GdbMi);
m_coreStopReason->fromString(message);
}

View File

@@ -50,15 +50,15 @@ const char kUVisionSimulator[] = "UVisionSimulator";
enum DebuggerStartMode
{
NoStartMode,
StartInternal, // Start current start project's binary
StartExternal, // Start binary found in file system
AttachExternal, // Attach to running process by process id
AttachCrashedExternal, // Attach to crashed process by process id
AttachCore, // Attach to a core file
AttachToRemoteServer, // Attach to a running gdbserver
AttachToRemoteProcess, // Attach to a running remote process
AttachToQmlServer, // Attach to a running QmlServer
StartRemoteProcess // Start and attach to a remote process
StartInternal, // Start current start project's binary
StartExternal, // Start binary found in file system
AttachToLocalProcess, // Attach to running local process by process id
AttachToCrashedProcess, // Attach to crashed process by process id
AttachToCore, // Attach to a core file
AttachToRemoteServer, // Attach to a running gdbserver
AttachToRemoteProcess, // Attach to a running remote process
AttachToQmlServer, // Attach to a running QmlServer
StartRemoteProcess // Start and attach to a remote process
};
enum DebuggerCloseMode

View File

@@ -1513,7 +1513,7 @@ void DebuggerEnginePrivate::updateState()
m_threadsHandler.threadSwitcher()->setEnabled(threadsEnabled);
m_threadLabel->setEnabled(threadsEnabled);
const bool isCore = m_engine->runParameters().startMode == AttachCore;
const bool isCore = m_engine->runParameters().startMode == AttachToCore;
const bool stopped = state == InferiorStopOk;
const bool detachable = stopped && !isCore;
m_detachAction.setEnabled(detachable);
@@ -1939,7 +1939,7 @@ void DebuggerEngine::notifyInferiorPid(const ProcessHandle &pid)
if (pid.isValid()) {
showMessage(tr("Taking notice of pid %1").arg(pid.pid()));
DebuggerStartMode sm = runParameters().startMode;
if (sm == StartInternal || sm == StartExternal || sm == AttachExternal)
if (sm == StartInternal || sm == StartExternal || sm == AttachToLocalProcess)
d->m_inferiorPid.activate();
}
}

View File

@@ -1278,7 +1278,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
startMode = AttachToRemoteServer;
remoteChannel = val;
} else if (key == "core") {
startMode = AttachCore;
startMode = AttachToCore;
coreFile = val;
} else if (key == "terminal") {
useTerminal = true;
@@ -1297,7 +1297,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
if (!sysRoot.isEmpty())
debugger->setSysRoot(FilePath::fromUserInput(sysRoot));
if (pid) {
debugger->setStartMode(AttachExternal);
debugger->setStartMode(AttachToLocalProcess);
debugger->setCloseMode(DetachAtClose);
debugger->setAttachPid(pid);
debugger->setRunControlName(tr("Process %1").arg(pid));
@@ -1307,8 +1307,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
debugger->setRemoteChannel(remoteChannel);
debugger->setRunControlName(tr("Remote: \"%1\"").arg(remoteChannel));
debugger->setStartMessage(tr("Attaching to remote server %1.").arg(remoteChannel));
} else if (startMode == AttachCore) {
debugger->setStartMode(AttachCore);
} else if (startMode == AttachToCore) {
debugger->setStartMode(AttachToCore);
debugger->setCloseMode(DetachAtClose);
debugger->setCoreFileName(coreFile);
debugger->setRunControlName(tr("Core file \"%1\"").arg(coreFile));
@@ -1338,7 +1338,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
runControl->setKit(findUniversalCdbKit());
auto debugger = new DebuggerRunTool(runControl);
debugger->setStartMode(AttachCrashedExternal);
debugger->setStartMode(AttachToCrashedProcess);
debugger->setCrashParameter(it->section(':', 0, 0));
debugger->setAttachPid(pid);
debugger->setRunControlName(tr("Crashed process %1").arg(pid));
@@ -1543,7 +1543,7 @@ void DebuggerPluginPrivate::attachCore()
auto debugger = new DebuggerRunTool(runControl);
debugger->setInferiorExecutable(dlg.symbolFile());
debugger->setCoreFileName(dlg.localCoreFile());
debugger->setStartMode(AttachCore);
debugger->setStartMode(AttachToCore);
debugger->setCloseMode(DetachAtClose);
debugger->setOverrideStartScript(dlg.overrideStartScript());
const FilePath sysRoot = dlg.sysRoot();
@@ -1688,7 +1688,7 @@ RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
debugger->setAttachPid(ProcessHandle(process.pid));
debugger->setInferiorExecutable(FilePath::fromString(process.exe));
debugger->setInferiorDevice(device);
debugger->setStartMode(AttachExternal);
debugger->setStartMode(AttachToLocalProcess);
debugger->setCloseMode(DetachAtClose);
debugger->setContinueAfterAttach(contAfterAttach);
@@ -1705,7 +1705,7 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
runControl->setDisplayName(tr("Process %1").arg(pid.pid()));
auto debugger = new DebuggerRunTool(runControl);
debugger->setAttachPid(pid);
debugger->setStartMode(AttachExternal);
debugger->setStartMode(AttachToLocalProcess);
debugger->setCloseMode(DetachAtClose);
debugger->startRunControl();
}

View File

@@ -666,7 +666,7 @@ void DebuggerRunTool::start()
rc->setRunConfiguration(runConfig);
auto name = QString(tr("%1 - Snapshot %2").arg(runControl()->displayName()).arg(++d->snapshotCounter));
auto debugger = new DebuggerRunTool(rc);
debugger->setStartMode(AttachCore);
debugger->setStartMode(AttachToCore);
debugger->setRunControlName(name);
debugger->setCoreFileName(coreFile, true);
debugger->startRunControl();
@@ -871,7 +871,7 @@ bool DebuggerRunTool::fixupParameters()
} else {
service = QmlDebug::QmlDebuggerServices;
}
if (rp.startMode != AttachExternal && rp.startMode != AttachCrashedExternal) {
if (rp.startMode != AttachToLocalProcess && rp.startMode != AttachToCrashedProcess) {
QString qmlarg = rp.isCppDebugging() && rp.nativeMixedEnabled
? QmlDebug::qmlDebugNativeArguments(service, false)
: QmlDebug::qmlDebugTcpArguments(service, rp.qmlServer);

View File

@@ -961,7 +961,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
Abi abi = rp.toolChainAbi;
if (abi.os() == Abi::WindowsOS
&& cmd.function.startsWith("attach")
&& (rp.startMode == AttachExternal || terminal()))
&& (rp.startMode == AttachToLocalProcess || terminal()))
{
// Ignore spurious 'running' responses to 'attach'.
} else {
@@ -1623,7 +1623,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
void GdbEngine::shutdownInferior()
{
CHECK_STATE(InferiorShutdownRequested);
if (runParameters().startMode == AttachCore) {
if (runParameters().startMode == AttachToCore) {
notifyInferiorShutdownFinished();
return;
}
@@ -1690,7 +1690,7 @@ void GdbEngine::setLinuxOsAbi()
void GdbEngine::detachDebugger()
{
CHECK_STATE(InferiorStopOk);
QTC_CHECK(runParameters().startMode != AttachCore);
QTC_CHECK(runParameters().startMode != AttachToCore);
DebuggerCommand cmd("detach", NativeCommand | ExitRequest);
cmd.callback = [this](const DebuggerResponse &) {
CHECK_STATE(InferiorStopOk);
@@ -1740,7 +1740,7 @@ bool GdbEngine::hasCapability(unsigned cap) const
return true;
}
if (runParameters().startMode == AttachCore)
if (runParameters().startMode == AttachToCore)
return false;
return cap & (JumpToLineCapability
@@ -2332,7 +2332,7 @@ void GdbEngine::handleBreakCondition(const DebuggerResponse &, const Breakpoint
bool GdbEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
{
if (runParameters().startMode == AttachCore)
if (runParameters().startMode == AttachToCore)
return false;
if (bp.isCppBreakpoint())
return true;
@@ -3998,12 +3998,12 @@ void GdbEngine::debugLastCommand()
bool GdbEngine::isPlainEngine() const
{
return !isCoreEngine() && !isAttachEngine() && !isRemoteEngine() && !terminal();
return !isCoreEngine() && !isLocalAttachEngine() && !isRemoteEngine() && !terminal();
}
bool GdbEngine::isCoreEngine() const
{
return runParameters().startMode == AttachCore;
return runParameters().startMode == AttachToCore;
}
bool GdbEngine::isRemoteEngine() const
@@ -4012,14 +4012,14 @@ bool GdbEngine::isRemoteEngine() const
return startMode == StartRemoteProcess || startMode == AttachToRemoteServer;
}
bool GdbEngine::isAttachEngine() const
bool GdbEngine::isLocalAttachEngine() const
{
return runParameters().startMode == AttachExternal;
return runParameters().startMode == AttachToLocalProcess;
}
bool GdbEngine::isTermEngine() const
{
return !isCoreEngine() && !isAttachEngine() && !isRemoteEngine() && terminal();
return !isCoreEngine() && !isLocalAttachEngine() && !isRemoteEngine() && terminal();
}
void GdbEngine::claimInitialBreakpoints()
@@ -4027,7 +4027,7 @@ void GdbEngine::claimInitialBreakpoints()
CHECK_STATE(EngineSetupRequested);
const DebuggerRunParameters &rp = runParameters();
if (rp.startMode != AttachCore) {
if (rp.startMode != AttachToCore) {
showStatusMessage(tr("Setting breakpoints..."));
showMessage(tr("Setting breakpoints..."));
BreakpointManager::claimBreakpointsForEngine(this);
@@ -4064,7 +4064,7 @@ void GdbEngine::setupInferior()
handleInferiorPrepared();
} else if (isAttachEngine()) {
} else if (isLocalAttachEngine()) {
// Task 254674 does not want to remove them
//qq->breakHandler()->removeAllBreakpoints();
handleInferiorPrepared();
@@ -4198,7 +4198,7 @@ void GdbEngine::runEngine()
QString channel = rp.remoteChannel;
runCommand({"target remote " + channel});
} else if (isAttachEngine()) {
} else if (isLocalAttachEngine()) {
const qint64 pid = rp.attachPID.pid();
showStatusMessage(tr("Attaching to process %1.").arg(pid));
@@ -4246,7 +4246,7 @@ void GdbEngine::runEngine()
void GdbEngine::handleAttach(const DebuggerResponse &response)
{
if (isAttachEngine()) {
if (isLocalAttachEngine()) {
QTC_ASSERT(state() == EngineRunRequested || state() == InferiorStopOk, qDebug() << state());
switch (response.resultClass) {
@@ -4317,7 +4317,7 @@ void GdbEngine::handleAttach(const DebuggerResponse &response)
void GdbEngine::interruptInferior2()
{
if (isAttachEngine()) {
if (isLocalAttachEngine()) {
interruptLocalInferior(runParameters().attachPID.pid());

View File

@@ -380,7 +380,7 @@ private: ////////// General Interface //////////
bool isPlainEngine() const;
bool isCoreEngine() const;
bool isRemoteEngine() const;
bool isAttachEngine() const;
bool isLocalAttachEngine() const;
bool isTermEngine() const;
void setupEngine() final;

View File

@@ -302,8 +302,8 @@ void LldbEngine::setupEngine()
cmd2.arg("startmode", rp.startMode);
// it is better not to check the start mode on the python sid (as we would have to duplicate the
// enum values), and thus we assume that if the rp.attachPID is valid we really have to attach
QTC_CHECK(!rp.attachPID.isValid() || (rp.startMode == AttachCrashedExternal
|| rp.startMode == AttachExternal));
QTC_CHECK(!rp.attachPID.isValid() || (rp.startMode == AttachToCrashedProcess
|| rp.startMode == AttachToLocalProcess));
cmd2.arg("attachpid", rp.attachPID.pid());
cmd2.arg("sysroot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot.toString()
: rp.deviceSymbolsRoot);
@@ -312,7 +312,7 @@ void LldbEngine::setupEngine()
? rp.remoteChannel : QString()));
cmd2.arg("platform", rp.platform);
QTC_CHECK(!rp.continueAfterAttach || (rp.startMode == AttachToRemoteProcess
|| rp.startMode == AttachExternal
|| rp.startMode == AttachToLocalProcess
|| rp.startMode == AttachToRemoteServer));
m_continueAtNextSpontaneousStop = false;
}
@@ -344,7 +344,7 @@ void LldbEngine::runEngine()
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state(); return);
showStatusMessage(tr("Running requested..."), 5000);
DebuggerCommand cmd("runEngine");
if (rp.startMode == AttachCore)
if (rp.startMode == AttachToCore)
cmd.arg("coreFile", rp.coreFile);
runCommand(cmd);
}
@@ -487,7 +487,7 @@ void LldbEngine::selectThread(const Thread &thread)
bool LldbEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
{
if (runParameters().startMode == AttachCore)
if (runParameters().startMode == AttachToCore)
return false;
if (bp.isCppBreakpoint())
return true;
@@ -921,7 +921,7 @@ void LldbEngine::handleStateNotification(const GdbMi &item)
continueInferior();
} else if (newState == "enginerunokandinferiorunrunnable") {
notifyEngineRunOkAndInferiorUnrunnable();
if (runParameters().startMode == AttachCore)
if (runParameters().startMode == AttachToCore)
handleAttachedToCore();
} else if (newState == "inferiorshutdownfinished")
notifyInferiorShutdownFinished();
@@ -1094,7 +1094,7 @@ bool LldbEngine::hasCapability(unsigned cap) const
| MemoryAddressCapability))
return true;
if (runParameters().startMode == AttachCore)
if (runParameters().startMode == AttachToCore)
return false;
//return cap == SnapshotCapability;

View File

@@ -452,7 +452,7 @@ void IosDebugSupport::start()
}
setDeviceSymbolsRoot(deviceSdk.toString());
} else {
setStartMode(AttachExternal);
setStartMode(AttachToLocalProcess);
setIosPlatform("ios-simulator");
}

View File

@@ -1641,7 +1641,7 @@ void HeobData::processFinished()
debugger->setAttachPid(ProcessHandle(m_data[1]));
debugger->setRunControlName(tr("Process %1").arg(m_data[1]));
debugger->setInferiorDevice(DeviceKitAspect::device(m_kit));
debugger->setStartMode(AttachExternal);
debugger->setStartMode(AttachToLocalProcess);
debugger->setCloseMode(DetachAtClose);
debugger->setContinueAfterAttach(true);
debugger->setInferiorExecutable(FilePath::fromString(Utils::imageName(m_data[1])));

View File

@@ -52,7 +52,7 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
: DebuggerRunTool(runControl)
{
// FIXME: This is just working for local debugging;
setStartMode(AttachExternal);
setStartMode(AttachToLocalProcess);
// The first Thread needs to be resumed manually.
setCommandsAfterConnect("~0 m");