forked from qt-creator/qt-creator
debugger: move more gui bit from engine to plugin
This commit is contained in:
@@ -93,6 +93,7 @@ using namespace TextEditor;
|
|||||||
#endif
|
#endif
|
||||||
# define XSDEBUG(s) qDebug() << s
|
# define XSDEBUG(s) qDebug() << s
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DebuggerStartParameters
|
// DebuggerStartParameters
|
||||||
@@ -211,9 +212,6 @@ public:
|
|||||||
~DebuggerEnginePrivate() {}
|
~DebuggerEnginePrivate() {}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void breakpointSetRemoveMarginActionTriggered();
|
|
||||||
void breakpointEnableDisableMarginActionTriggered();
|
|
||||||
|
|
||||||
void doSetupInferior();
|
void doSetupInferior();
|
||||||
void doRunEngine();
|
void doRunEngine();
|
||||||
void doShutdownEngine();
|
void doShutdownEngine();
|
||||||
@@ -257,11 +255,6 @@ public slots:
|
|||||||
m_runControl->bringApplicationToForeground(m_inferiorPid);
|
m_runControl->bringApplicationToForeground(m_inferiorPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slotEditBreakpoint();
|
|
||||||
void slotRunToLine();
|
|
||||||
void slotJumpToLine();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerState state() const { return m_state; }
|
DebuggerState state() const { return m_state; }
|
||||||
|
|
||||||
@@ -294,73 +287,6 @@ public:
|
|||||||
bool m_isSlaveEngine;
|
bool m_isSlaveEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retrieve file name and line and optionally address
|
|
||||||
// from the data set on the text editor context menu action.
|
|
||||||
static bool positionFromContextActionData(const QObject *sender,
|
|
||||||
QString *fileName,
|
|
||||||
int *lineNumber,
|
|
||||||
quint64 *address = 0)
|
|
||||||
{
|
|
||||||
if (const QAction *action = qobject_cast<const QAction *>(sender)) {
|
|
||||||
const QVariantList data = action->data().toList();
|
|
||||||
if (data.size() >= (address ? 3 : 2)) {
|
|
||||||
*fileName = data.front().toString();
|
|
||||||
*lineNumber = data.at(1).toInt();
|
|
||||||
if (address)
|
|
||||||
*address = data.at(2).toULongLong();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::breakpointSetRemoveMarginActionTriggered()
|
|
||||||
{
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
quint64 address;
|
|
||||||
if (positionFromContextActionData(sender(), &fileName, &lineNumber, &address))
|
|
||||||
m_engine->breakHandler()->toggleBreakpoint(fileName, lineNumber, address);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::slotRunToLine()
|
|
||||||
{
|
|
||||||
// Run to line, file name and line number set as list.
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
if (positionFromContextActionData(sender(), &fileName, &lineNumber)) {
|
|
||||||
m_engine->resetLocation();
|
|
||||||
m_engine->executeRunToLine(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::slotJumpToLine()
|
|
||||||
{
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
if (positionFromContextActionData(sender(), &fileName, &lineNumber))
|
|
||||||
m_engine->executeJumpToLine(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::breakpointEnableDisableMarginActionTriggered()
|
|
||||||
{
|
|
||||||
QString fileName;
|
|
||||||
int lineNumber;
|
|
||||||
if (positionFromContextActionData(sender(), &fileName, &lineNumber))
|
|
||||||
m_engine->breakHandler()->toggleBreakpointEnabled(fileName, lineNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerEnginePrivate::slotEditBreakpoint()
|
|
||||||
{
|
|
||||||
const QAction *act = qobject_cast<QAction *>(sender());
|
|
||||||
QTC_ASSERT(act, return);
|
|
||||||
const QVariant data = act->data();
|
|
||||||
QTC_ASSERT(qVariantCanConvert<BreakpointData *>(data), return);
|
|
||||||
BreakpointData *breakPointData = qvariant_cast<BreakpointData *>(data);
|
|
||||||
BreakWindow::editBreakpoint(breakPointData, ICore::instance()->mainWindow());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -253,11 +253,6 @@ public:
|
|||||||
void breakByFunction(const QString &functionName);
|
void breakByFunction(const QString &functionName);
|
||||||
void breakByFunctionMain();
|
void breakByFunctionMain();
|
||||||
|
|
||||||
void executeStepX();
|
|
||||||
void executeStepOutX();
|
|
||||||
void executeStepNextX();
|
|
||||||
void executeReturnX();
|
|
||||||
|
|
||||||
DebuggerState state() const;
|
DebuggerState state() const;
|
||||||
DebuggerState lastGoodState() const;
|
DebuggerState lastGoodState() const;
|
||||||
DebuggerState targetState() const;
|
DebuggerState targetState() const;
|
||||||
|
|||||||
@@ -409,11 +409,29 @@ static QToolButton *toolButton(QAction *action)
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retrieve file name and line and optionally address
|
||||||
|
// from the data set on the text editor context menu action.
|
||||||
|
static bool positionFromContextActionData(const QObject *sender,
|
||||||
|
QString *fileName,
|
||||||
|
int *lineNumber,
|
||||||
|
quint64 *address = 0)
|
||||||
|
{
|
||||||
|
if (const QAction *action = qobject_cast<const QAction *>(sender)) {
|
||||||
|
const QVariantList data = action->data().toList();
|
||||||
|
if (data.size() >= (address ? 3 : 2)) {
|
||||||
|
*fileName = data.front().toString();
|
||||||
|
*lineNumber = data.at(1).toInt();
|
||||||
|
if (address)
|
||||||
|
*address = data.at(2).toULongLong();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static const char *Role = "ROLE";
|
|
||||||
|
|
||||||
// FIXME: Outdated?
|
// FIXME: Outdated?
|
||||||
// The createCdbEngine function takes a list of options pages it can add to.
|
// The createCdbEngine function takes a list of options pages it can add to.
|
||||||
// This allows for having a "enabled" toggle on the page independently
|
// This allows for having a "enabled" toggle on the page independently
|
||||||
@@ -854,6 +872,25 @@ public:
|
|||||||
DebuggerEngine *currentEngine() const { return m_currentEngine; }
|
DebuggerEngine *currentEngine() const { return m_currentEngine; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void selectThread(int index);
|
||||||
|
|
||||||
|
void breakpointSetRemoveMarginActionTriggered()
|
||||||
|
{
|
||||||
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
quint64 address;
|
||||||
|
if (positionFromContextActionData(sender(), &fileName, &lineNumber, &address))
|
||||||
|
m_breakHandler->toggleBreakpoint(fileName, lineNumber, address);
|
||||||
|
}
|
||||||
|
|
||||||
|
void breakpointEnableDisableMarginActionTriggered()
|
||||||
|
{
|
||||||
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
if (positionFromContextActionData(sender(), &fileName, &lineNumber))
|
||||||
|
m_breakHandler->toggleBreakpointEnabled(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
void updateWatchersHeader(int section, int, int newSize)
|
void updateWatchersHeader(int section, int, int newSize)
|
||||||
{
|
{
|
||||||
m_watchersWindow->header()->resizeSection(section, newSize);
|
m_watchersWindow->header()->resizeSection(section, newSize);
|
||||||
@@ -988,8 +1025,17 @@ public slots:
|
|||||||
currentEngine()->executeNext();
|
currentEngine()->executeNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleExecStepOut() { resetLocation(); currentEngine()->executeStepOut(); }
|
void handleExecStepOut()
|
||||||
void handleExecReturn() { resetLocation(); currentEngine()->executeReturn(); }
|
{
|
||||||
|
resetLocation();
|
||||||
|
currentEngine()->executeStepOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleExecReturn()
|
||||||
|
{
|
||||||
|
resetLocation();
|
||||||
|
currentEngine()->executeReturn();
|
||||||
|
}
|
||||||
|
|
||||||
void handleExecJumpToLine()
|
void handleExecJumpToLine()
|
||||||
{
|
{
|
||||||
@@ -1011,6 +1057,33 @@ public slots:
|
|||||||
currentEngine()->executeRunToFunction(); // FIXME: move code from engine here.
|
currentEngine()->executeRunToFunction(); // FIXME: move code from engine here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void slotEditBreakpoint()
|
||||||
|
{
|
||||||
|
const QAction *act = qobject_cast<QAction *>(sender());
|
||||||
|
QTC_ASSERT(act, return);
|
||||||
|
const QVariant data = act->data();
|
||||||
|
QTC_ASSERT(qVariantCanConvert<BreakpointData *>(data), return);
|
||||||
|
BreakpointData *breakPointData = qvariant_cast<BreakpointData *>(data);
|
||||||
|
BreakWindow::editBreakpoint(breakPointData, ICore::instance()->mainWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
void slotRunToLine()
|
||||||
|
{
|
||||||
|
// Run to line, file name and line number set as list.
|
||||||
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
if (positionFromContextActionData(sender(), &fileName, &lineNumber))
|
||||||
|
handleExecRunToLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void slotJumpToLine()
|
||||||
|
{
|
||||||
|
QString fileName;
|
||||||
|
int lineNumber;
|
||||||
|
if (positionFromContextActionData(sender(), &fileName, &lineNumber))
|
||||||
|
currentEngine()->executeJumpToLine(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
void handleAddToWatchWindow()
|
void handleAddToWatchWindow()
|
||||||
{
|
{
|
||||||
// Requires a selection, but that's the only case we want anyway.
|
// Requires a selection, but that's the only case we want anyway.
|
||||||
|
|||||||
@@ -1310,13 +1310,13 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
if (isLeavableFunction(funcName, fileName)) {
|
if (isLeavableFunction(funcName, fileName)) {
|
||||||
//showMessage(_("LEAVING ") + funcName);
|
//showMessage(_("LEAVING ") + funcName);
|
||||||
++stepCounter;
|
++stepCounter;
|
||||||
executeStepOutX();
|
executeStepOut();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isSkippableFunction(funcName, fileName)) {
|
if (isSkippableFunction(funcName, fileName)) {
|
||||||
//showMessage(_("SKIPPING ") + funcName);
|
//showMessage(_("SKIPPING ") + funcName);
|
||||||
++stepCounter;
|
++stepCounter;
|
||||||
executeStepX();
|
executeStep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if (stepCounter)
|
//if (stepCounter)
|
||||||
|
|||||||
Reference in New Issue
Block a user