forked from qt-creator/qt-creator
Debugger: Rework step{In,Out,Over} handling
Main menu action pass operation to current engine, everything else
is handled there.
Combine execute{Step,Next} and execute{Step,Next}I functions.
Implementation were mostly similar, in some cases unneeded
(the instruction-wise version e.g. for Python)
Drop GDB-isms 'step', 'next' in favor of 'step in' and 'step over'.
Change-Id: I232232bc7a67d9d297a74f1c81dc43be96787d34
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -901,7 +901,7 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response)
|
||||
// there is no debug information. Divert to "-exec-next-step"
|
||||
showMessage("APPLYING WORKAROUND #3");
|
||||
notifyInferiorStopOk();
|
||||
executeNextI();
|
||||
executeStepOver(true);
|
||||
} else if (msg.startsWith("Couldn't get registers: No such process.")) {
|
||||
// Happens on archer-tromey-python 6.8.50.20090910-cvs
|
||||
// There might to be a race between a process shutting down
|
||||
@@ -1324,7 +1324,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
||||
if (isSkippableFunction(funcName, fileName)) {
|
||||
//showMessage(_("SKIPPING ") + funcName);
|
||||
++stepCounter;
|
||||
executeStep();
|
||||
executeStepIn(false);
|
||||
return;
|
||||
}
|
||||
//if (stepCounter)
|
||||
@@ -1838,25 +1838,32 @@ void GdbEngine::continueInferior()
|
||||
continueInferiorInternal();
|
||||
}
|
||||
|
||||
void GdbEngine::executeStep()
|
||||
void GdbEngine::executeStepIn(bool byInstruction)
|
||||
{
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
setTokenBarrier();
|
||||
notifyInferiorRunRequested();
|
||||
showStatusMessage(tr("Step requested..."), 5000);
|
||||
|
||||
DebuggerCommand cmd;
|
||||
if (isNativeMixedActiveFrame()) {
|
||||
DebuggerCommand cmd("executeStep", RunRequest);
|
||||
cmd.flags = RunRequest;
|
||||
cmd.function = "executeStep";
|
||||
cmd.callback = CB(handleExecuteStep);
|
||||
runCommand(cmd);
|
||||
} else if (byInstruction) {
|
||||
cmd.flags = RunRequest|NeedsFlush;
|
||||
cmd.function = "-exec-step-instruction";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += "--reverse";
|
||||
cmd.callback = CB(handleExecuteContinue);
|
||||
} else {
|
||||
DebuggerCommand cmd;
|
||||
cmd.flags = RunRequest|NeedsFlush;
|
||||
cmd.function = "-exec-step";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += " --reverse";
|
||||
cmd.callback = CB(handleExecuteStep);
|
||||
runCommand(cmd);
|
||||
}
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
void GdbEngine::handleExecuteStep(const DebuggerResponse &response)
|
||||
@@ -1882,7 +1889,7 @@ void GdbEngine::handleExecuteStep(const DebuggerResponse &response)
|
||||
notifyInferiorRunFailed();
|
||||
if (isDying())
|
||||
return;
|
||||
executeStepI(); // Fall back to instruction-wise stepping.
|
||||
executeStepIn(true); // Fall back to instruction-wise stepping.
|
||||
} else if (msg.startsWith("Cannot execute this command while the selected thread is running.")) {
|
||||
showExecutionError(msg);
|
||||
notifyInferiorRunFailed();
|
||||
@@ -1895,21 +1902,6 @@ void GdbEngine::handleExecuteStep(const DebuggerResponse &response)
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::executeStepI()
|
||||
{
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
setTokenBarrier();
|
||||
notifyInferiorRunRequested();
|
||||
showStatusMessage(tr("Step by instruction requested..."), 5000);
|
||||
DebuggerCommand cmd;
|
||||
cmd.flags = RunRequest|NeedsFlush;
|
||||
cmd.function = "-exec-step-instruction";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += "--reverse";
|
||||
cmd.callback = CB(handleExecuteContinue);
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
void GdbEngine::executeStepOut()
|
||||
{
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
@@ -1928,23 +1920,29 @@ void GdbEngine::executeStepOut()
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::executeNext()
|
||||
void GdbEngine::executeStepOver(bool byInstruction)
|
||||
{
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
setTokenBarrier();
|
||||
notifyInferiorRunRequested();
|
||||
showStatusMessage(tr("Step next requested..."), 5000);
|
||||
|
||||
DebuggerCommand cmd;
|
||||
cmd.flags = RunRequest;
|
||||
if (isNativeMixedActiveFrame()) {
|
||||
runCommand({"executeNext", RunRequest});
|
||||
cmd.function = "executeNext";
|
||||
} else if (byInstruction) {
|
||||
cmd.function = "-exec-next-instruction";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += " --reverse";
|
||||
cmd.callback = CB(handleExecuteContinue);
|
||||
} else {
|
||||
DebuggerCommand cmd;
|
||||
cmd.flags = RunRequest;
|
||||
cmd.function = "-exec-next";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += " --reverse";
|
||||
cmd.callback = CB(handleExecuteNext);
|
||||
runCommand(cmd);
|
||||
}
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
void GdbEngine::handleExecuteNext(const DebuggerResponse &response)
|
||||
@@ -1967,7 +1965,7 @@ void GdbEngine::handleExecuteNext(const DebuggerResponse &response)
|
||||
|| msg.contains("Error accessing memory address ")) {
|
||||
notifyInferiorRunFailed();
|
||||
if (!isDying())
|
||||
executeNextI(); // Fall back to instruction-wise stepping.
|
||||
executeStepOver(true); // Fall back to instruction-wise stepping.
|
||||
} else if (msg.startsWith("Cannot execute this command while the selected thread is running.")) {
|
||||
showExecutionError(msg);
|
||||
notifyInferiorRunFailed();
|
||||
@@ -1981,21 +1979,6 @@ void GdbEngine::handleExecuteNext(const DebuggerResponse &response)
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::executeNextI()
|
||||
{
|
||||
CHECK_STATE(InferiorStopOk);
|
||||
setTokenBarrier();
|
||||
notifyInferiorRunRequested();
|
||||
showStatusMessage(tr("Step next instruction requested..."), 5000);
|
||||
DebuggerCommand cmd;
|
||||
cmd.flags = RunRequest;
|
||||
cmd.function = "-exec-next-instruction";
|
||||
if (isReverseDebugging())
|
||||
cmd.function += " --reverse";
|
||||
cmd.callback = CB(handleExecuteContinue);
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
static QString addressSpec(quint64 address)
|
||||
{
|
||||
return "*0x" + QString::number(address, 16);
|
||||
|
||||
@@ -192,11 +192,9 @@ private: ////////// General Interface //////////
|
||||
void updateBreakpoint(const Breakpoint &bp) final;
|
||||
void enableSubBreakpoint(const SubBreakpoint &sbp, bool on) final;
|
||||
|
||||
void executeStep() final;
|
||||
void executeStepIn(bool byInstruction) final;
|
||||
void executeStepOut() final;
|
||||
void executeNext() final;
|
||||
void executeStepI() final;
|
||||
void executeNextI() final;
|
||||
void executeStepOver(bool byInstruction) final;
|
||||
|
||||
void continueInferiorInternal();
|
||||
void continueInferior() final;
|
||||
|
||||
Reference in New Issue
Block a user