Commit 5f75e597 authored by Arvid Ephraim Picciani's avatar Arvid Ephraim Picciani
Browse files

Asynchronous breakpoint handling

parent 17f39388
......@@ -60,7 +60,7 @@ static quint64 nextBPId() {
}
BreakpointData::BreakpointData() :
id(nextBPId()), enabled(true),
id(nextBPId()), uiDirty(false), enabled(true),
pending(true), type(BreakpointByFileAndLine),
ignoreCount(0), lineNumber(0), address(0),
useFullPath(false),
......@@ -102,6 +102,7 @@ BreakpointData::~BreakpointData()
void BreakpointData::clear()
{
uiDirty = false;
pending = true;
bpNumber.clear();
bpCondition.clear();
......
......@@ -97,6 +97,8 @@ private:
public:
quint64 id;
BreakpointState state;
bool uiDirty; // ui has changed stuff
bool enabled; // Should we talk to the debugger engine?
bool pending; // Does the debugger engine know about us already?
......
......@@ -519,6 +519,7 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list)
data->condition = newCondition.toLatin1();
data->ignoreCount = newIgnoreCount.toInt();
data->threadSpec = newThreadSpec.toLatin1();
data->uiDirty = true;
}
synchronizeBreakpoints();
}
......
......@@ -1220,6 +1220,27 @@ void DebuggerEngine::updateAll()
void DebuggerEngine::attemptBreakpointSynchronization()
{
for (int i = 0; i < breakHandler()->size(); i++) {
BreakpointData *bp = breakHandler()->at(i);
if (!m_breakpoints.contains(bp->id)) {
m_breakpoints.insert(bp->id, bp);
}
QTC_ASSERT(m_breakpoints[bp->id] == bp, qDebug() << "corrupted breakpoint map");
if (bp->uiDirty) {
bp->uiDirty = false;
bp->state = BreakpointChangeRequested;
changeBreakpoint(*bp);
}
}
Breakpoints bps = breakHandler()->takeRemovedBreakpoints();
foreach (BreakpointData *bp, bps) {
if (m_breakpoints.contains(bp->id)) {
bp->state = BreakpointRemovalRequested;
removeBreakpoint(bp->id);
} else
delete bp;
}
}
bool DebuggerEngine::acceptsBreakpoint(const BreakpointData *)
......@@ -1227,6 +1248,86 @@ bool DebuggerEngine::acceptsBreakpoint(const BreakpointData *)
return true;
}
void DebuggerEngine::addBreakpoint(const BreakpointData &)
{
}
void DebuggerEngine::notifyAddBreakpointOk(quint64 id)
{
BreakpointData *bp = m_breakpoints[id];
if (!bp)
return;
bp->state = BreakpointOk;
}
void DebuggerEngine::notifyAddBreakpointFailed(quint64 id)
{
BreakpointData *bp = m_breakpoints[id];
if (!bp)
return;
bp->state = BreakpointDead;
}
void DebuggerEngine::removeBreakpoint(quint64)
{
}
void DebuggerEngine::notifyRemoveBreakpointOk(quint64 id)
{
BreakpointData *bp = m_breakpoints.take(id);
if (!bp)
return;
bp->state = BreakpointDead;
delete bp;
}
void DebuggerEngine::notifyRemoveBreakpointFailed(quint64 id)
{
BreakpointData *bp = m_breakpoints[id];
if (!bp)
return;
bp->state = BreakpointOk;
}
void DebuggerEngine::changeBreakpoint(const BreakpointData &)
{
}
void DebuggerEngine::notifyChangeBreakpointOk(quint64 id)
{
BreakpointData *bp = m_breakpoints[id];
if (!bp)
return;
bp->state = BreakpointOk;
}
void DebuggerEngine::notifyChangeBreakpointFailed(quint64 id)
{
BreakpointData *bp = m_breakpoints[id];
if (!bp)
return;
bp->state = BreakpointDead;
}
void DebuggerEngine::notifyBreakpointAdjusted(const BreakpointData & rbp)
{
BreakpointData *bp = m_breakpoints[rbp.id];
if (!bp)
return;
bp->bpNumber = rbp.bpNumber;
bp->bpCondition = rbp.bpCondition;
bp->bpIgnoreCount = rbp.bpIgnoreCount;
bp->bpFileName = rbp.bpFileName;
bp->bpFullName = rbp.bpFullName;
bp->bpLineNumber = rbp.bpLineNumber;
bp->bpCorrectedLineNumber = rbp.bpCorrectedLineNumber;
bp->bpThreadSpec = rbp.bpThreadSpec;
bp->bpFuncName = rbp.bpFuncName;
bp->bpAddress = rbp.bpAddress;
bp->bpMultiple = rbp.bpMultiple;
bp->bpEnabled = rbp.bpEnabled;
}
void DebuggerEngine::selectThread(int)
{
}
......
......@@ -186,6 +186,18 @@ public:
virtual void attemptBreakpointSynchronization();
virtual bool acceptsBreakpoint(const Internal::BreakpointData *);
virtual void addBreakpoint(const Internal::BreakpointData &bp);
virtual void notifyAddBreakpointOk(quint64 id);
virtual void notifyAddBreakpointFailed(quint64 id);
virtual void removeBreakpoint(quint64 id);
virtual void notifyRemoveBreakpointOk(quint64 id);
virtual void notifyRemoveBreakpointFailed(quint64 id);
virtual void changeBreakpoint(const Internal::BreakpointData &bp);
virtual void notifyChangeBreakpointOk(quint64 id);
virtual void notifyChangeBreakpointFailed(quint64 id);
virtual void notifyBreakpointAdjusted(const Internal::BreakpointData &bp);
virtual void selectThread(int index);
virtual void assignValueInDebugger(const Internal::WatchData *data,
......@@ -342,6 +354,7 @@ private:
friend class DebuggerEnginePrivate;
DebuggerEnginePrivate *d;
QHash<quint64, Internal::BreakpointData *> m_breakpoints;
};
} // namespace Debugger
......
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