summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-10-02 12:53:07 +0200
committerhjk <hjk@qt.io>2018-10-16 10:34:31 +0000
commitfa96f731923facc1b051eef66baa8398dadb109b (patch)
treeb11ef9a89befe8e6f2c8609585452433c7ca392c
parent78fbb0826b1cc229f51406614b295cdf3073f88c (diff)
downloadqt-creator-fa96f731923facc1b051eef66baa8398dadb109b.tar.gz
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>
-rw-r--r--src/plugins/debugger/cdb/cdbengine.cpp35
-rw-r--r--src/plugins/debugger/cdb/cdbengine.h10
-rw-r--r--src/plugins/debugger/debuggerengine.cpp26
-rw-r--r--src/plugins/debugger/debuggerengine.h10
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp56
-rw-r--r--src/plugins/debugger/disassembleragent.cpp1
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp71
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h6
-rw-r--r--src/plugins/debugger/lldb/lldbengine.cpp20
-rw-r--r--src/plugins/debugger/lldb/lldbengine.h6
-rw-r--r--src/plugins/debugger/pdb/pdbengine.cpp18
-rw-r--r--src/plugins/debugger/pdb/pdbengine.h7
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp17
-rw-r--r--src/plugins/debugger/qml/qmlengine.h6
14 files changed, 103 insertions, 186 deletions
diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index a047ac1d7c..4327dce255 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -224,7 +224,7 @@ void CdbEngine::init()
m_stopMode = NoStopRequested;
m_nextCommandToken = 0;
m_currentBuiltinResponseToken = -1;
- m_operateByInstruction = true; // Default CDB setting.
+ m_lastOperateByInstruction = true; // Default CDB setting.
m_hasDebuggee = false;
m_sourceStepInto = false;
m_watchPointX = m_watchPointY = 0;
@@ -266,14 +266,13 @@ void CdbEngine::init()
CdbEngine::~CdbEngine() = default;
-void CdbEngine::operateByInstructionTriggered(bool operateByInstruction)
+void CdbEngine::adjustOperateByInstruction(bool operateByInstruction)
{
- DebuggerEngine::operateByInstructionTriggered(operateByInstruction);
- if (m_operateByInstruction == operateByInstruction)
+ if (m_lastOperateByInstruction == operateByInstruction)
return;
- m_operateByInstruction = operateByInstruction;
- runCommand({QLatin1String(m_operateByInstruction ? "l-t" : "l+t"), NoFlags});
- runCommand({QLatin1String(m_operateByInstruction ? "l-s" : "l+s"), NoFlags});
+ m_lastOperateByInstruction = operateByInstruction;
+ runCommand({QLatin1String(m_lastOperateByInstruction ? "l-t" : "l+t"), NoFlags});
+ runCommand({QLatin1String(m_lastOperateByInstruction ? "l-s" : "l+s"), NoFlags});
}
bool CdbEngine::canHandleToolTip(const DebuggerToolTipContext &context) const
@@ -521,7 +520,7 @@ void CdbEngine::handleInitialSessionIdle()
const DebuggerRunParameters &rp = runParameters();
if (!rp.commandsAfterConnect.isEmpty())
runCommand({rp.commandsAfterConnect, NoFlags});
- operateByInstructionTriggered(operatesByInstruction());
+ //operateByInstructionTriggered(operatesByInstruction());
// QmlCppEngine expects the QML engine to be connected before any breakpoints are hit
// (attemptBreakpointSynchronization() will be directly called then)
if (rp.breakOnMain) {
@@ -758,10 +757,11 @@ bool CdbEngine::hasCapability(unsigned cap) const
|AdditionalQmlStackCapability);
}
-void CdbEngine::executeStep()
+void CdbEngine::executeStepIn(bool byInstruction)
{
- if (!m_operateByInstruction)
+ if (!m_lastOperateByInstruction)
m_sourceStepInto = true; // See explanation at handleStackTrace().
+ adjustOperateByInstruction(byInstruction);
runCommand({"t", NoFlags}); // Step into-> t (trace)
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
notifyInferiorRunRequested();
@@ -774,23 +774,14 @@ void CdbEngine::executeStepOut()
notifyInferiorRunRequested();
}
-void CdbEngine::executeNext()
+void CdbEngine::executeStepOver(bool byInstruction)
{
+ adjustOperateByInstruction(byInstruction);
runCommand({"p", NoFlags}); // Step over -> p
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
notifyInferiorRunRequested();
}
-void CdbEngine::executeStepI()
-{
- executeStep();
-}
-
-void CdbEngine::executeNextI()
-{
- executeNext();
-}
-
void CdbEngine::continueInferior()
{
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
@@ -1848,7 +1839,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
if (stack.isValid()) {
switch (parseStackTrace(stack, sourceStepInto)) {
case ParseStackStepInto: // Hit on a frame while step into, see parseStackTrace().
- executeStep();
+ executeStepIn(operatesByInstruction());
return;
case ParseStackStepOut: // Hit on a frame with no source while step into.
executeStepOut();
diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h
index c367925fd3..12f15c9e45 100644
--- a/src/plugins/debugger/cdb/cdbengine.h
+++ b/src/plugins/debugger/cdb/cdbengine.h
@@ -64,11 +64,9 @@ public:
void watchPoint(const QPoint &) override;
void setRegisterValue(const QString &name, const QString &value) override;
- void executeStep() override;
+ void executeStepOver(bool byInstruction) override;
+ void executeStepIn(bool byInstruction) override;
void executeStepOut() override;
- void executeNext() override;
- void executeStepI() override;
- void executeNextI() override;
void continueInferior() override;
void interruptInferior() override;
@@ -113,7 +111,7 @@ private:
void processError();
void processFinished();
void runCommand(const DebuggerCommand &cmd) override;
- void operateByInstructionTriggered(bool) override;
+ void adjustOperateByInstruction(bool);
void createFullBacktrace();
@@ -217,7 +215,7 @@ private:
int m_currentBuiltinResponseToken = -1;
QMap<QString, NormalizedSourceFileName> m_normalizedFileCache;
const QString m_extensionCommandPrefix; //!< Library name used as prefix
- bool m_operateByInstruction = true; // Default CDB setting.
+ bool m_lastOperateByInstruction = true; // Default CDB setting.
bool m_hasDebuggee = false;
enum Wow64State {
wow64Uninitialized,
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index cbc1be8b77..d8f8e4f030 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -691,11 +691,11 @@ void DebuggerEnginePrivate::setupViews()
m_stepOverAction.setIcon(Icons::STEP_OVER_TOOLBAR.icon());
connect(&m_stepOverAction, &QAction::triggered,
- m_engine, &DebuggerEngine::handleExecNext);
+ m_engine, &DebuggerEngine::handleExecStepOver);
m_stepIntoAction.setIcon(Icons::STEP_INTO_TOOLBAR.icon());
connect(&m_stepIntoAction, &QAction::triggered,
- m_engine, &DebuggerEngine::handleExecStep);
+ m_engine, &DebuggerEngine::handleExecStepIn);
m_stepOutAction.setIcon(Icons::STEP_OUT_TOOLBAR.icon());
connect(&m_stepOutAction, &QAction::triggered,
@@ -1787,14 +1787,14 @@ DebuggerToolTipManager *DebuggerEngine::toolTipManager()
return &d->m_toolTipManager;
}
-bool DebuggerEngine::debuggerActionsEnabled() const
+bool DebuggerEngine::operatesByInstruction() const
{
- return debuggerActionsEnabledHelper(d->m_state);
+ return d->m_operateByInstructionAction.isChecked();
}
-bool DebuggerEngine::operatesByInstruction() const
+bool DebuggerEngine::debuggerActionsEnabled() const
{
- return d->m_operateByInstructionAction.isChecked();
+ return debuggerActionsEnabledHelper(d->m_state);
}
void DebuggerEngine::operateByInstructionTriggered(bool on)
@@ -2291,31 +2291,25 @@ void DebuggerEngine::handleReset()
resetInferior();
}
-void DebuggerEngine::handleExecStep()
+void DebuggerEngine::handleExecStepIn()
{
if (state() == DebuggerNotReady) {
DebuggerRunTool::setBreakOnMainNextTime();
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE);
} else {
resetLocation();
- if (operatesByInstruction())
- executeStepI();
- else
- executeStep();
+ executeStepIn(operatesByInstruction());
}
}
-void DebuggerEngine::handleExecNext()
+void DebuggerEngine::handleExecStepOver()
{
if (state() == DebuggerNotReady) {
DebuggerRunTool::setBreakOnMainNextTime();
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE);
} else {
resetLocation();
- if (operatesByInstruction())
- executeNextI();
- else
- executeNext();
+ executeStepOver(operatesByInstruction());
}
}
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 05c30078d4..987ca38073 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -434,8 +434,8 @@ public:
void handleUserStop();
void handleAbort();
void handleReset();
- void handleExecStep();
- void handleExecNext();
+ void handleExecStepIn();
+ void handleExecStepOver();
void handleExecStepOut();
void handleExecReturn();
void handleExecJumpToLine();
@@ -480,11 +480,9 @@ protected:
virtual void resetInferior() {}
virtual void detachDebugger() {}
- virtual void executeStep() {}
+ virtual void executeStepOver(bool /*byInstruction*/ = false) {}
+ virtual void executeStepIn(bool /*byInstruction*/ = false) {}
virtual void executeStepOut() {}
- virtual void executeNext() {}
- virtual void executeStepI() {}
- virtual void executeNextI() {}
virtual void executeReturn() {}
virtual void continueInferior() {}
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index b04ff48f36..6f99f77bb9 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -768,7 +768,7 @@ public:
Action m_interruptAction{tr("Interrupt"), interruptIcon(false), &DebuggerEngine::handleExecInterrupt};
Action m_abortAction{tr("Abort Debugging"), {}, &DebuggerEngine::abortDebugger,
tr("Aborts debugging and resets the debugger to the initial state.")};
- QAction m_stepAction{tr("Step Into")};
+ QAction m_stepInAction{tr("Step Into")};
Action m_stepOutAction{tr("Step Out"), Icons::STEP_OUT.icon(), &DebuggerEngine::handleExecStepOut};
Action m_runToLineAction{tr("Run to Line"), {}, &DebuggerEngine::handleExecRunToLine};
@@ -776,7 +776,7 @@ public:
Action m_jumpToLineAction{tr("Jump to Line"), {}, &DebuggerEngine::handleExecJumpToLine};
// In the Debug menu.
Action m_returnFromFunctionAction{tr("Immediately Return From Inner Function"), {}, &DebuggerEngine::executeReturn};
- QAction m_nextAction{tr("Step Over")};
+ QAction m_stepOverAction{tr("Step Over")};
Action m_watchAction{tr("Add Expression Evaluator"), {}, &DebuggerEngine::handleAddToWatchWindow};
Command *m_watchCommand = nullptr;
QAction m_breakAction{tr("Toggle Breakpoint")};
@@ -1225,30 +1225,30 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
debugMenu->addSeparator();
- cmd = ActionManager::registerAction(&m_nextAction, Constants::NEXT);
+ cmd = ActionManager::registerAction(&m_stepOverAction, Constants::NEXT);
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10")));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
- m_nextAction.setIcon(Icons::STEP_OVER.icon());
- connect(&m_nextAction, &QAction::triggered, this, [] {
+ m_stepOverAction.setIcon(Icons::STEP_OVER.icon());
+ connect(&m_stepOverAction, &QAction::triggered, this, [] {
if (DebuggerEngine *engine = EngineManager::currentEngine()) {
- engine->handleExecNext();
+ engine->handleExecStepOver();
} else {
DebuggerRunTool::setBreakOnMainNextTime();
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, false);
}
});
- cmd = ActionManager::registerAction(&m_stepAction, Constants::STEP);
+ cmd = ActionManager::registerAction(&m_stepInAction, Constants::STEP);
cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11")));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
- m_stepAction.setIcon(Icons::STEP_INTO.icon());
- connect(&m_stepAction, &QAction::triggered, this, [] {
+ m_stepInAction.setIcon(Icons::STEP_INTO.icon());
+ connect(&m_stepInAction, &QAction::triggered, this, [] {
if (DebuggerEngine *engine = EngineManager::currentEngine()) {
- engine->handleExecStep();
+ engine->handleExecStepIn();
} else {
DebuggerRunTool::setBreakOnMainNextTime();
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, false);
@@ -1469,10 +1469,10 @@ void DebuggerPluginPrivate::updatePresetState()
// correspond to the current start up project.
// Step into/next: Start and break at 'main' unless a debugger is running.
QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot;
- m_stepAction.setToolTip(stepToolTip);
- m_nextAction.setToolTip(stepToolTip);
- m_stepAction.setEnabled(canRun);
- m_nextAction.setEnabled(canRun);
+ m_stepInAction.setEnabled(canRun);
+ m_stepInAction.setToolTip(stepToolTip);
+ m_stepOverAction.setEnabled(canRun);
+ m_stepOverAction.setToolTip(stepToolTip);
m_startAction.setEnabled(canRun);
m_startAction.setIcon(startIcon(false));
m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@@ -1492,8 +1492,8 @@ void DebuggerPluginPrivate::updatePresetState()
QTC_ASSERT(currentEngine, return);
// We have a current engine, and it belongs to the startup runconfig.
- m_stepAction.setToolTip(QString());
- m_nextAction.setToolTip(QString());
+ m_stepInAction.setToolTip(QString());
+ m_stepOverAction.setToolTip(QString());
// The 'state' bits only affect the fat debug button, not the preset start button.
m_startAction.setIcon(startIcon(false));
@@ -1522,8 +1522,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_debugWithoutDeployAction.setEnabled(false);
m_visibleStartAction.setAction(&m_continueAction);
m_hiddenStopAction.setAction(&m_exitAction);
- m_stepAction.setEnabled(!companionPreventsAction);
- m_nextAction.setEnabled(!companionPreventsAction);
+ m_stepInAction.setEnabled(!companionPreventsAction);
+ m_stepOverAction.setEnabled(!companionPreventsAction);
m_jumpToLineAction.setEnabled(currentEngine->hasCapability(JumpToLineCapability));
m_returnFromFunctionAction.setEnabled(currentEngine->hasCapability(ReturnFromFunctionCapability));
m_detachAction.setEnabled(!isCore);
@@ -1541,8 +1541,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_debugWithoutDeployAction.setEnabled(false);
m_visibleStartAction.setAction(&m_interruptAction);
m_hiddenStopAction.setAction(&m_interruptAction);
- m_stepAction.setEnabled(false);
- m_nextAction.setEnabled(false);
+ m_stepInAction.setEnabled(false);
+ m_stepOverAction.setEnabled(false);
m_jumpToLineAction.setEnabled(false);
m_returnFromFunctionAction.setEnabled(false);
m_detachAction.setEnabled(false);
@@ -1560,8 +1560,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_debugWithoutDeployAction.setEnabled(canRun);
m_visibleStartAction.setAction(&m_startAction);
m_hiddenStopAction.setAction(&m_undisturbableAction);
- m_stepAction.setEnabled(false);
- m_nextAction.setEnabled(false);
+ m_stepInAction.setEnabled(false);
+ m_stepOverAction.setEnabled(false);
m_jumpToLineAction.setEnabled(false);
m_returnFromFunctionAction.setEnabled(false);
m_detachAction.setEnabled(false);
@@ -1579,8 +1579,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_debugWithoutDeployAction.setEnabled(false);
m_visibleStartAction.setAction(&m_exitAction);
m_hiddenStopAction.setAction(&m_exitAction);
- m_stepAction.setEnabled(false);
- m_nextAction.setEnabled(false);
+ m_stepInAction.setEnabled(false);
+ m_stepOverAction.setEnabled(false);
m_jumpToLineAction.setEnabled(false);
m_returnFromFunctionAction.setEnabled(false);
m_detachAction.setEnabled(false);
@@ -1601,8 +1601,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_debugWithoutDeployAction.setEnabled(false);
m_visibleStartAction.setAction(&m_undisturbableAction);
m_hiddenStopAction.setAction(&m_undisturbableAction);
- m_stepAction.setEnabled(false);
- m_nextAction.setEnabled(false);
+ m_stepInAction.setEnabled(false);
+ m_stepOverAction.setEnabled(false);
m_jumpToLineAction.setEnabled(false);
m_returnFromFunctionAction.setEnabled(false);
m_detachAction.setEnabled(false);
@@ -2064,13 +2064,13 @@ void DebuggerPluginPrivate::setInitialState()
m_interruptAction.setEnabled(false);
m_continueAction.setEnabled(false);
- m_stepAction.setEnabled(true);
+ m_stepInAction.setEnabled(true);
m_stepOutAction.setEnabled(false);
m_runToLineAction.setEnabled(false);
m_runToSelectedFunctionAction.setEnabled(true);
m_returnFromFunctionAction.setEnabled(false);
m_jumpToLineAction.setEnabled(false);
- m_nextAction.setEnabled(true);
+ m_stepOverAction.setEnabled(true);
action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(false);
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index 7dc4f65d63..5b45e694a6 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -400,6 +400,7 @@ void DisassemblerAgent::updateBreakpointMarker(const Breakpoint &bp)
auto marker = new DisassemblerBreakpointMarker(bp, lineNumber);
d->breakpointMarks.append(marker);
+ QTC_ASSERT(d->document, return);
d->document->addMark(marker);
}
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index d367b548c2..52e364aeab 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -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);
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index c93178ee71..097b5ea81c 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -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;
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp
index b8d414ad76..1a5b2f2f08 100644
--- a/src/plugins/debugger/lldb/lldbengine.cpp
+++ b/src/plugins/debugger/lldb/lldbengine.cpp
@@ -336,16 +336,10 @@ void LldbEngine::interruptInferior()
runCommand({"interruptInferior"});
}
-void LldbEngine::executeStep()
+void LldbEngine::executeStepIn(bool byInstruction)
{
notifyInferiorRunRequested();
- runCommand({"executeStep"});
-}
-
-void LldbEngine::executeStepI()
-{
- notifyInferiorRunRequested();
- runCommand({"executeStepI"});
+ runCommand({QLatin1String(byInstruction ? "executeStepI" : "executeStep")});
}
void LldbEngine::executeStepOut()
@@ -354,16 +348,10 @@ void LldbEngine::executeStepOut()
runCommand({"executeStepOut"});
}
-void LldbEngine::executeNext()
-{
- notifyInferiorRunRequested();
- runCommand({"executeNext"});
-}
-
-void LldbEngine::executeNextI()
+void LldbEngine::executeStepOver(bool byInstruction)
{
notifyInferiorRunRequested();
- runCommand({"executeNextI"});
+ runCommand({QLatin1String(byInstruction ? "executeNextI" : "executeNext")});
}
void LldbEngine::continueInferior()
diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h
index 907a5c2bdf..7d0b01aeba 100644
--- a/src/plugins/debugger/lldb/lldbengine.h
+++ b/src/plugins/debugger/lldb/lldbengine.h
@@ -60,11 +60,9 @@ signals:
void outputReady(const QString &data);
private:
- void executeStep() override;
+ void executeStepIn(bool byInstruction) override;
void executeStepOut() override;
- void executeNext() override;
- void executeStepI() override;
- void executeNextI() override;
+ void executeStepOver(bool byInstruction) override;
void setupEngine() override;
void runEngine() override;
diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp
index 4ac397e969..c465be65a1 100644
--- a/src/plugins/debugger/pdb/pdbengine.cpp
+++ b/src/plugins/debugger/pdb/pdbengine.cpp
@@ -167,14 +167,7 @@ void PdbEngine::interruptInferior()
interruptProcess(m_proc.processId(), GdbEngineType, &error);
}
-void PdbEngine::executeStep()
-{
- notifyInferiorRunRequested();
- notifyInferiorRunOk();
- postDirectCommand("step");
-}
-
-void PdbEngine::executeStepI()
+void PdbEngine::executeStepIn(bool)
{
notifyInferiorRunRequested();
notifyInferiorRunOk();
@@ -188,14 +181,7 @@ void PdbEngine::executeStepOut()
postDirectCommand("return");
}
-void PdbEngine::executeNext()
-{
- notifyInferiorRunRequested();
- notifyInferiorRunOk();
- postDirectCommand("next");
-}
-
-void PdbEngine::executeNextI()
+void PdbEngine::executeStepOver(bool)
{
notifyInferiorRunRequested();
notifyInferiorRunOk();
diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h
index 420e0639c7..57a040d5dc 100644
--- a/src/plugins/debugger/pdb/pdbengine.h
+++ b/src/plugins/debugger/pdb/pdbengine.h
@@ -47,12 +47,9 @@ public:
PdbEngine();
private:
- // DebuggerEngine implementation
- void executeStep() override;
+ void executeStepIn(bool) override;
void executeStepOut() override;
- void executeNext() override;
- void executeStepI() override;
- void executeNextI() override;
+ void executeStepOver(bool) override;
void setupEngine() override;
void runEngine() override;
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index bbd7684bf9..81acdb66e0 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -610,15 +610,7 @@ void QmlEngine::interruptInferior()
showStatusMessage(tr("Waiting for JavaScript engine to interrupt on next statement."));
}
-void QmlEngine::executeStep()
-{
- clearExceptionSelection();
- d->continueDebugging(StepIn);
- notifyInferiorRunRequested();
- notifyInferiorRunOk();
-}
-
-void QmlEngine::executeStepI()
+void QmlEngine::executeStepIn(bool)
{
clearExceptionSelection();
d->continueDebugging(StepIn);
@@ -634,7 +626,7 @@ void QmlEngine::executeStepOut()
notifyInferiorRunOk();
}
-void QmlEngine::executeNext()
+void QmlEngine::executeStepOver(bool)
{
clearExceptionSelection();
d->continueDebugging(Next);
@@ -642,11 +634,6 @@ void QmlEngine::executeNext()
notifyInferiorRunOk();
}
-void QmlEngine::executeNextI()
-{
- executeNext();
-}
-
void QmlEngine::executeRunToLine(const ContextData &data)
{
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h
index 8d407b11ae..df31c3c6c5 100644
--- a/src/plugins/debugger/qml/qmlengine.h
+++ b/src/plugins/debugger/qml/qmlengine.h
@@ -72,11 +72,9 @@ private:
void resetLocation() override;
- void executeStep() override;
+ void executeStepOver(bool) override;
+ void executeStepIn(bool) override;
void executeStepOut() override;
- void executeNext() override;
- void executeStepI() override;
- void executeNextI() override;
void setupEngine() override;
void runEngine() override;