Commit fadac800 authored by hjk's avatar hjk

debugger: more breakpoint management related fixes

parent c5c0dc76
......@@ -116,7 +116,7 @@ public:
BreakHandler *handler = m_data->handler();
handler->removeBreakpoint(m_data);
handler->saveBreakpoints();
//handler->saveBreakpoints();
handler->updateMarkers();
}
......@@ -926,14 +926,14 @@ void BreakHandler::removeBreakpoint(int index)
return;
removeBreakpointHelper(index);
emit layoutChanged();
saveBreakpoints();
//saveBreakpoints();
}
void BreakHandler::removeBreakpoint(BreakpointData *data)
{
removeBreakpointHelper(m_bp.indexOf(data));
emit layoutChanged();
saveBreakpoints();
//saveBreakpoints();
}
void BreakHandler::toggleBreakpointEnabled(BreakpointData *data)
......@@ -947,7 +947,7 @@ void BreakHandler::toggleBreakpointEnabled(BreakpointData *data)
m_enabled.removeAll(data);
m_disabled.append(data);
}
saveBreakpoints();
//saveBreakpoints();
updateMarkers();
}
......@@ -985,7 +985,6 @@ void BreakHandler::saveSessionData()
void BreakHandler::loadSessionData()
{
//resetBreakpoints();
loadBreakpoints();
updateMarkers();
}
......@@ -1004,7 +1003,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
BreakpointData *data = new BreakpointData;
data->funcName = functionName;
append(data);
saveBreakpoints();
//saveBreakpoints();
updateMarkers();
}
......@@ -1012,11 +1011,23 @@ void BreakHandler::initializeFromTemplate(BreakHandler *other)
{
//qDebug() << "COPYING BREAKPOINTS INTO NEW SESSION";
QTC_ASSERT(m_bp.isEmpty(), /**/);
foreach (BreakpointData *data, other->m_bp)
foreach (BreakpointData *data, other->m_bp) {
append(data->clone());
data->removeMarker();
}
updateMarkers();
}
void BreakHandler::storeToTemplate(BreakHandler *other)
{
other->removeAllBreakpoints();
foreach (BreakpointData *data, m_bp)
other->append(data->clone());
removeAllBreakpoints();
other->updateMarkers();
other->saveSessionData();
}
} // namespace Internal
} // namespace Debugger
......
......@@ -87,6 +87,7 @@ public:
QIcon pendingBreakPointIcon() const { return m_pendingBreakPointIcon; }
void initializeFromTemplate(BreakHandler *other);
void storeToTemplate(BreakHandler *other);
public slots:
void appendBreakpoint(BreakpointData *data);
......
......@@ -156,6 +156,7 @@ const char *DebuggerEngine::stateName(int s)
# undef SN
}
//////////////////////////////////////////////////////////////////////
//
// CommandHandler
......@@ -165,109 +166,19 @@ const char *DebuggerEngine::stateName(int s)
class CommandHandler : public QStandardItemModel
{
public:
CommandHandler(DebuggerEngine *engine) : m_engine(engine) {}
explicit CommandHandler(DebuggerEngine *engine) : m_engine(engine) {}
bool setData(const QModelIndex &index, const QVariant &value, int role);
QAbstractItemModel *model() { return this; }
private:
DebuggerEngine *m_engine;
QPointer<DebuggerEngine> m_engine;
};
bool CommandHandler::setData(const QModelIndex &, const QVariant &value, int role)
{
//qDebug() << "COMMAND: " << role << value;
switch (role) {
case RequestLoadSessionDataRole:
m_engine->loadSessionData();
return true;
case RequestSaveSessionDataRole:
m_engine->saveSessionData();
return true;
case RequestReloadSourceFilesRole:
m_engine->reloadSourceFiles();
return true;
case RequestReloadModulesRole:
m_engine->reloadModules();
return true;
case RequestExecContinueRole:
m_engine->continueInferior();
return true;
case RequestExecInterruptRole:
m_engine->interruptInferior();
return true;
case RequestExecResetRole:
//m_engine->exec();
return true;
case RequestExecStepRole:
m_engine->executeStepX();
return true;
case RequestExecStepOutRole:
m_engine->executeStepOutX();
return true;
case RequestExecNextRole:
m_engine->executeStepNextX();
return true;
case RequestExecRunToLineRole:
//m_engine->executeRunToLine();
QTC_ASSERT(false, /* FIXME ABC */);
return true;
case RequestExecRunToFunctionRole:
//m_engine->executeRunToFunction();
QTC_ASSERT(false, /* FIXME ABC */);
return true;
case RequestExecReturnFromFunctionRole:
m_engine->executeReturnX();
return true;
case RequestExecJumpToLineRole:
//m_engine->executeJumpToLine();
QTC_ASSERT(false, /* FIXME ABC */);
return true;
case RequestExecWatchRole:
//m_engine->exec();
QTC_ASSERT(false, /* FIXME ABC */);
return true;
case RequestExecExitRole:
m_engine->exitDebugger();
return true;
case RequestExecSnapshotRole:
m_engine->makeSnapshot();
return true;
case RequestExecFrameDownRole:
m_engine->frameDown();
return true;
case RequestExecFrameUpRole:
m_engine->frameUp();
return true;
case RequestOperatedByInstructionTriggeredRole:
m_engine->gotoLocation(m_engine->stackHandler()->currentFrame(), true);
return true;
case RequestExecuteCommandRole:
m_engine->executeDebuggerCommand(value.toString());
return true;
}
return false;
QTC_ASSERT(m_engine, return false);
m_engine->handleCommand(role, value);
return true;
}
......@@ -336,12 +247,106 @@ DebuggerEngine::~DebuggerEngine()
//saveSessionData();
}
/*
void DebuggerEngine::showStatusMessage(const QString &msg, int timeout)
void DebuggerEngine::showStatusMessage(const QString &msg, int timeout) const
{
plugin()->showStatusMessage(msg, timeout);
showMessage(msg, StatusBar, timeout);
}
*/
void DebuggerEngine::handleCommand(int role, const QVariant &value)
{
//qDebug() << "COMMAND: " << role << value;
switch (role) {
case RequestLoadSessionDataRole:
loadSessionData();
break;
case RequestSaveSessionDataRole:
saveSessionData();
break;
case RequestReloadSourceFilesRole:
reloadSourceFiles();
break;
case RequestReloadModulesRole:
reloadModules();
break;
case RequestExecContinueRole:
continueInferior();
break;
case RequestExecInterruptRole:
interruptInferior();
break;
case RequestExecResetRole:
//exec();
break;
case RequestExecStepRole:
executeStepX();
break;
case RequestExecStepOutRole:
executeStepOutX();
break;
case RequestExecNextRole:
executeStepNextX();
break;
case RequestExecRunToLineRole:
//executeRunToLine();
QTC_ASSERT(false, /* FIXME ABC */);
break;
case RequestExecRunToFunctionRole:
//executeRunToFunction();
QTC_ASSERT(false, /* FIXME ABC */);
break;
case RequestExecReturnFromFunctionRole:
executeReturnX();
break;
case RequestExecJumpToLineRole:
//executeJumpToLine();
QTC_ASSERT(false, /* FIXME ABC */);
break;
case RequestExecWatchRole:
//exec();
QTC_ASSERT(false, /* FIXME ABC */);
break;
case RequestExecExitRole:
exitDebugger();
break;
case RequestExecSnapshotRole:
makeSnapshot();
break;
case RequestExecFrameDownRole:
frameDown();
break;
case RequestExecFrameUpRole:
frameUp();
break;
case RequestOperatedByInstructionTriggeredRole:
gotoLocation(stackHandler()->currentFrame(), true);
break;
case RequestExecuteCommandRole:
executeDebuggerCommand(value.toString());
break;
}
}
void DebuggerEngine::showModuleSymbols
(const QString &moduleName, const Symbols &symbols)
......@@ -613,11 +618,6 @@ void DebuggerEngine::executeWatchPointX()
}
/*
void DebuggerEngine::executeDebuggerCommand()
{
if (QAction *action = qobject_cast<QAction *>(sender()))
executeDebuggerCommand(action->data().toString());
}
void DebuggerManager::executeRunToLine()
{
ITextEditor *textEditor = d->m_plugin->currentTextEditor();
......@@ -682,19 +682,13 @@ void DebuggerManager::executeJumpToLine()
void DebuggerEngine::handleFinished()
{
modulesHandler()->removeAll();
//breakHandler()->setAllPending();
stackHandler()->removeAll();
threadsHandler()->removeAll();
watchHandler()->cleanup();
DebuggerEngine *sessionTemplate = plugin()->sessionTemplate();
if (sessionTemplate != this) {
BreakHandler *handler = sessionTemplate->breakHandler();
qDebug() << "MOVING BREAKPOINTS TO SESSION";
handler->removeAllBreakpoints();
handler->initializeFromTemplate(breakHandler());
}
breakHandler()->removeAllBreakpoints();
QTC_ASSERT(sessionTemplate != this, /**/);
breakHandler()->storeToTemplate(sessionTemplate->breakHandler());
}
const DebuggerStartParameters &DebuggerEngine::startParameters() const
......
......@@ -128,7 +128,6 @@ public:
void startDebugger(DebuggerRunControl *runControl);
virtual void startDebugger() {}
virtual void exitDebugger() {}
virtual void abortDebugger() { exitDebugger(); }
virtual void detachDebugger() {}
virtual void updateWatchData(const WatchData & /* data */) { }
virtual void executeStep() {}
......@@ -187,8 +186,7 @@ public:
public slots:
// Convenience
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1) const;
void showStatusMessage(const QString &msg, int timeout = -1) const
{ showMessage(msg, StatusBar, timeout); }
void showStatusMessage(const QString &msg, int timeout = -1) const;
public:
DebuggerPlugin *plugin() const;
......@@ -246,6 +244,7 @@ public:
void notifyInferiorPid(qint64 pid);
qint64 inferiorPid() const;
bool isReverseDebugging() const;
void handleCommand(int role, const QVariant &value);
public slots:
void resetLocation();
......
......@@ -1702,13 +1702,7 @@ void GdbEngine::exitDebugger()
{
disconnectDebuggingHelperActions();
shutdown();
}
void GdbEngine::abortDebugger()
{
disconnectDebuggingHelperActions();
shutdown();
gdbProc()->kill();
//gdbProc()->kill();
}
int GdbEngine::currentFrame() const
......
......@@ -105,7 +105,6 @@ private: ////////// General Interface //////////
virtual void startDebugger();
virtual unsigned debuggerCapabilities() const;
virtual void exitDebugger();
virtual void abortDebugger();
virtual void detachDebugger();
virtual void shutdown();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment