forked from qt-creator/qt-creator
Debugger: Move initial breakpoint setting into individual branches
This avoids pending breakpoints in local attach setups now. Change-Id: I6872a97020955180d4c3f915f6bb19c1f771f07f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4191,12 +4191,11 @@ void GdbEngine::runEngine()
|
|||||||
{
|
{
|
||||||
CHECK_STATE(EngineRunRequested);
|
CHECK_STATE(EngineRunRequested);
|
||||||
|
|
||||||
claimInitialBreakpoints();
|
|
||||||
|
|
||||||
const DebuggerRunParameters &rp = runParameters();
|
const DebuggerRunParameters &rp = runParameters();
|
||||||
|
|
||||||
if (rp.startMode == AttachToRemoteProcess) {
|
if (rp.startMode == AttachToRemoteProcess) {
|
||||||
|
|
||||||
|
claimInitialBreakpoints();
|
||||||
notifyEngineRunAndInferiorStopOk();
|
notifyEngineRunAndInferiorStopOk();
|
||||||
|
|
||||||
QString channel = rp.remoteChannel;
|
QString channel = rp.remoteChannel;
|
||||||
@@ -4206,8 +4205,9 @@ void GdbEngine::runEngine()
|
|||||||
|
|
||||||
const qint64 pid = rp.attachPID.pid();
|
const qint64 pid = rp.attachPID.pid();
|
||||||
showStatusMessage(tr("Attaching to process %1.").arg(pid));
|
showStatusMessage(tr("Attaching to process %1.").arg(pid));
|
||||||
runCommand({"attach " + QString::number(pid),
|
runCommand({"attach " + QString::number(pid), [this](const DebuggerResponse &r) {
|
||||||
[this](const DebuggerResponse &r) { handleLocalAttach(r); }});
|
handleLocalAttach(r);
|
||||||
|
}});
|
||||||
// In some cases we get only output like
|
// In some cases we get only output like
|
||||||
// "Could not attach to process. If your uid matches the uid of the target\n"
|
// "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"
|
// "process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\n"
|
||||||
@@ -4218,6 +4218,7 @@ void GdbEngine::runEngine()
|
|||||||
|
|
||||||
} else if (isRemoteEngine()) {
|
} else if (isRemoteEngine()) {
|
||||||
|
|
||||||
|
claimInitialBreakpoints();
|
||||||
if (runParameters().useContinueInsteadOfRun) {
|
if (runParameters().useContinueInsteadOfRun) {
|
||||||
notifyEngineRunAndInferiorStopOk();
|
notifyEngineRunAndInferiorStopOk();
|
||||||
continueInferiorInternal();
|
continueInferiorInternal();
|
||||||
@@ -4227,6 +4228,7 @@ void GdbEngine::runEngine()
|
|||||||
|
|
||||||
} else if (isCoreEngine()) {
|
} else if (isCoreEngine()) {
|
||||||
|
|
||||||
|
claimInitialBreakpoints();
|
||||||
runCommand({"target core " + runParameters().coreFile, CB(handleTargetCore)});
|
runCommand({"target core " + runParameters().coreFile, CB(handleTargetCore)});
|
||||||
|
|
||||||
} else if (isTermEngine()) {
|
} else if (isTermEngine()) {
|
||||||
@@ -4240,6 +4242,7 @@ void GdbEngine::runEngine()
|
|||||||
|
|
||||||
} else if (isPlainEngine()) {
|
} else if (isPlainEngine()) {
|
||||||
|
|
||||||
|
claimInitialBreakpoints();
|
||||||
if (runParameters().useContinueInsteadOfRun)
|
if (runParameters().useContinueInsteadOfRun)
|
||||||
runCommand({"-exec-continue", DebuggerCommand::RunRequest, CB(handleExecuteContinue)});
|
runCommand({"-exec-continue", DebuggerCommand::RunRequest, CB(handleExecuteContinue)});
|
||||||
else
|
else
|
||||||
@@ -4260,11 +4263,13 @@ void GdbEngine::handleLocalAttach(const DebuggerResponse &response)
|
|||||||
// We will get a '*stopped' later that we'll interpret as 'spontaneous'
|
// We will get a '*stopped' later that we'll interpret as 'spontaneous'
|
||||||
// So acknowledge the current state and put a delayed 'continue' in the pipe.
|
// So acknowledge the current state and put a delayed 'continue' in the pipe.
|
||||||
showMessage(tr("Attached to running application."), StatusBar);
|
showMessage(tr("Attached to running application."), StatusBar);
|
||||||
|
claimInitialBreakpoints();
|
||||||
notifyEngineRunAndInferiorRunOk();
|
notifyEngineRunAndInferiorRunOk();
|
||||||
} else {
|
} else {
|
||||||
// InferiorStopOk, e.g. for "Attach to running application".
|
// InferiorStopOk, e.g. for "Attach to running application".
|
||||||
// The *stopped came in between sending the 'attach' and
|
// The *stopped came in between sending the 'attach' and
|
||||||
// receiving its '^done'.
|
// receiving its '^done'.
|
||||||
|
claimInitialBreakpoints();
|
||||||
notifyEngineRunAndInferiorStopOk();
|
notifyEngineRunAndInferiorStopOk();
|
||||||
if (runParameters().continueAfterAttach)
|
if (runParameters().continueAfterAttach)
|
||||||
continueInferiorInternal();
|
continueInferiorInternal();
|
||||||
@@ -4602,6 +4607,7 @@ void GdbEngine::handleStubAttached(const DebuggerResponse &response, qint64 main
|
|||||||
switch (response.resultClass) {
|
switch (response.resultClass) {
|
||||||
case ResultDone:
|
case ResultDone:
|
||||||
case ResultRunning:
|
case ResultRunning:
|
||||||
|
claimInitialBreakpoints();
|
||||||
if (runParameters().toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
if (runParameters().toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
// Resume thread that was suspended by console stub process (see stub code).
|
// Resume thread that was suspended by console stub process (see stub code).
|
||||||
|
Reference in New Issue
Block a user