From e40c28cc2f35b0c4891d2bd8dfb8b65c6f899c22 Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@nokia.com> Date: Thu, 20 May 2010 19:35:34 +0200 Subject: [PATCH] Debbuger: Checking menu action if watchpoint is set --- src/plugins/debugger/breakhandler.cpp | 7 +++++++ src/plugins/debugger/breakhandler.h | 1 + src/plugins/debugger/watchwindow.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index e194fbdf462..cb9aef370ba 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -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; diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 77ed135d177..4f800a77ff4 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -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; diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index f1693dcee01..2799a53d825 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -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); -- GitLab