Debbuger: Checking menu action if watchpoint is set

This commit is contained in:
Robert Loehning
2010-05-20 19:35:34 +02:00
parent 466518808c
commit e40c28cc2f
3 changed files with 14 additions and 1 deletions

View File

@@ -37,6 +37,7 @@
#include <texteditor/basetextmark.h>
#include <utils/qtcassert.h>
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
#include <QtCore/QFileInfo>
@@ -416,6 +417,12 @@ BreakpointData *BreakHandler::findWatchPointByAddress(const QByteArray &a) const
return 0;
}
bool BreakHandler::watchPointAt(quint64 address) const
{
const QByteArray addressBA = QByteArray("0x") + QByteArray::number(address, 16);
return findWatchPointByAddress(addressBA);
}
void BreakHandler::saveBreakpoints()
{
QList<QVariant> list;

View File

@@ -71,6 +71,7 @@ public:
BreakpointData *findSimilarBreakpoint(const BreakpointData &needle) const;
BreakpointData *findBreakpointByNumber(int bpNumber) const;
BreakpointData *findWatchPointByAddress(const QByteArray &a) const;
bool watchPointAt(quint64 address) const;
void updateMarkers();
QList<BreakpointData *> insertedBreakpoints() const;

View File

@@ -331,9 +331,14 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
const QString watchPointFormat = tr("Break on Changing Contents of 0x%1");
actSetWatchPointAtVariableAddress =
new QAction(watchPointFormat.arg(address, 0, 16), &menu);
if (createPointerActions)
actSetWatchPointAtVariableAddress->setCheckable(true);
actSetWatchPointAtVariableAddress->setChecked(m_manager->breakHandler()->watchPointAt(address));
if (createPointerActions) {
actSetWatchPointAtPointerValue =
new QAction(watchPointFormat.arg(pointerValue, 0, 16), &menu);
actSetWatchPointAtPointerValue->setCheckable(true);
actSetWatchPointAtPointerValue->setChecked(m_manager->breakHandler()->watchPointAt(pointerValue));
}
} else {
actSetWatchPointAtVariableAddress =
new QAction(tr("Break on Changing Contents"), &menu);