debugger: move watchpoint convenience functions to breakhandler

Change-Id: I7f214ff5fe6d996c4dd14c6ac181a482ad00c94e
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-06-03 21:59:21 +02:00
parent 0394699a4c
commit 48fcfe0b8d
4 changed files with 34 additions and 32 deletions

View File

@@ -1569,5 +1569,32 @@ QString BreakHandler::BreakpointItem::toToolTip() const
return rc; return rc;
} }
void BreakHandler::setWatchpointAtAddress(quint64 address, unsigned size)
{
BreakpointParameters data(WatchpointAtAddress);
data.address = address;
data.size = size;
BreakpointModelId id = findWatchpoint(data);
if (id) {
qDebug() << "WATCHPOINT EXISTS";
// removeBreakpoint(index);
return;
}
appendBreakpoint(data);
}
void BreakHandler::setWatchpointAtExpression(const QString &exp)
{
BreakpointParameters data(WatchpointAtExpression);
data.expression = exp;
BreakpointModelId id = findWatchpoint(data);
if (id) {
qDebug() << "WATCHPOINT EXISTS";
// removeBreakpoint(index);
return;
}
appendBreakpoint(data);
}
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -168,6 +168,10 @@ public:
static QString displayFromThreadSpec(int spec); static QString displayFromThreadSpec(int spec);
static int threadSpecFromDisplay(const QString &str); static int threadSpecFromDisplay(const QString &str);
// Convenience.
void setWatchpointAtAddress(quint64 address, unsigned size);
void setWatchpointAtExpression(const QString &exp);
private: private:
// QAbstractItemModel implementation. // QAbstractItemModel implementation.
int columnCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const;

View File

@@ -912,11 +912,11 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == actOpenMemoryEditorStackLayout) { } else if (act == actOpenMemoryEditorStackLayout) {
addStackLayoutMemoryView(currentEngine(), false, model(), ev->globalPos(), this); addStackLayoutMemoryView(currentEngine(), false, model(), ev->globalPos(), this);
} else if (act == actSetWatchpointAtVariableAddress) { } else if (act == actSetWatchpointAtVariableAddress) {
setWatchpointAtAddress(address, size); breakHandler()->setWatchpointAtAddress(address, size);
} else if (act == actSetWatchpointAtPointerValue) { } else if (act == actSetWatchpointAtPointerValue) {
setWatchpointAtAddress(pointerValue, sizeof(void *)); // FIXME: an approximation.. breakHandler()->setWatchpointAtAddress(pointerValue, sizeof(void *)); // FIXME: an approximation..
} else if (act == actSetWatchpointAtExpression) { } else if (act == actSetWatchpointAtExpression) {
setWatchpointAtExpression(name); breakHandler()->setWatchpointAtExpression(name);
} else if (act == actSelectWidgetToWatch) { } else if (act == actSelectWidgetToWatch) {
grabMouse(Qt::CrossCursor); grabMouse(Qt::CrossCursor);
m_grabbing = true; m_grabbing = true;
@@ -1047,32 +1047,5 @@ void WatchTreeView::setModelData
model()->setData(index, value, role); model()->setData(index, value, role);
} }
void WatchTreeView::setWatchpointAtAddress(quint64 address, unsigned size)
{
BreakpointParameters data(WatchpointAtAddress);
data.address = address;
data.size = size;
BreakpointModelId id = breakHandler()->findWatchpoint(data);
if (id) {
qDebug() << "WATCHPOINT EXISTS";
// removeBreakpoint(index);
return;
}
breakHandler()->appendBreakpoint(data);
}
void WatchTreeView::setWatchpointAtExpression(const QString &exp)
{
BreakpointParameters data(WatchpointAtExpression);
data.expression = exp;
BreakpointModelId id = breakHandler()->findWatchpoint(data);
if (id) {
qDebug() << "WATCHPOINT EXISTS";
// removeBreakpoint(index);
return;
}
breakHandler()->appendBreakpoint(data);
}
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -75,8 +75,6 @@ private:
void editItem(const QModelIndex &idx); void editItem(const QModelIndex &idx);
void resetHelper(const QModelIndex &idx); void resetHelper(const QModelIndex &idx);
void setWatchpointAtAddress(quint64 address, unsigned size);
void setWatchpointAtExpression(const QString &exp);
void setModelData(int role, const QVariant &value = QVariant(), void setModelData(int role, const QVariant &value = QVariant(),
const QModelIndex &index = QModelIndex()); const QModelIndex &index = QModelIndex());