forked from qt-creator/qt-creator
Debugger: Split remote and local attach handlers
Called with different timing, no real shared code currently. Change-Id: I5a8cc32c5f38f533acfa4512518fb51932d8aab2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4200,7 +4200,7 @@ void GdbEngine::runEngine()
|
||||
const qint64 pid = rp.attachPID.pid();
|
||||
showStatusMessage(tr("Attaching to process %1.").arg(pid));
|
||||
runCommand({"attach " + QString::number(pid),
|
||||
[this](const DebuggerResponse &r) { handleAttach(r); }});
|
||||
[this](const DebuggerResponse &r) { handleLocalAttach(r); }});
|
||||
// In some cases we get only output like
|
||||
// "Could not attach to process. If your uid matches the uid of the target\n"
|
||||
// "process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\n"
|
||||
@@ -4241,10 +4241,8 @@ void GdbEngine::runEngine()
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::handleAttach(const DebuggerResponse &response)
|
||||
void GdbEngine::handleLocalAttach(const DebuggerResponse &response)
|
||||
{
|
||||
if (isLocalAttachEngine()) {
|
||||
|
||||
QTC_ASSERT(state() == EngineRunRequested || state() == InferiorStopOk, qDebug() << state());
|
||||
switch (response.resultClass) {
|
||||
case ResultDone:
|
||||
@@ -4285,9 +4283,10 @@ void GdbEngine::handleAttach(const DebuggerResponse &response)
|
||||
notifyEngineIll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (isRemoteEngine()) {
|
||||
|
||||
void GdbEngine::handleRemoteAttach(const DebuggerResponse &response)
|
||||
{
|
||||
CHECK_STATE(EngineSetupRequested);
|
||||
switch (response.resultClass) {
|
||||
case ResultDone:
|
||||
@@ -4308,8 +4307,6 @@ void GdbEngine::handleAttach(const DebuggerResponse &response)
|
||||
notifyInferiorSetupFailedHelper(response.data["msg"].data());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::interruptInferior2()
|
||||
@@ -4548,7 +4545,7 @@ void GdbEngine::handleTargetQnx(const DebuggerResponse &response)
|
||||
|
||||
const DebuggerRunParameters &rp = runParameters();
|
||||
if (rp.attachPID.isValid())
|
||||
runCommand({"attach " + QString::number(rp.attachPID.pid()), CB(handleAttach)});
|
||||
runCommand({"attach " + QString::number(rp.attachPID.pid()), CB(handleRemoteAttach)});
|
||||
else if (!rp.inferior.executable.isEmpty())
|
||||
runCommand({"set nto-executable " + rp.inferior.executable.toString(),
|
||||
CB(handleSetNtoExecutable)});
|
||||
|
||||
@@ -395,7 +395,8 @@ private: ////////// General Interface //////////
|
||||
void handleFileExecAndSymbols(const DebuggerResponse &response);
|
||||
|
||||
// Attach
|
||||
void handleAttach(const DebuggerResponse &response);
|
||||
void handleLocalAttach(const DebuggerResponse &response);
|
||||
void handleRemoteAttach(const DebuggerResponse &response);
|
||||
|
||||
// Remote
|
||||
void callTargetRemote();
|
||||
|
||||
Reference in New Issue
Block a user