diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index d6077bf8e6b1539033bed9d608087b6f20cd67f3..d958246fbf8bc6aa04e7f59dee81259b294db6f1 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -130,6 +130,7 @@ enum DebuggerCapabilities BreakOnThrowAndCatchCapability = 0x200, ReturnFromFunctionCapability = 0x400, CreateFullBacktraceCapability = 0x800, + AddWatcherCapability = 0x1000 }; enum LogChannel diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index f1568171b1d8b76ea496cf59f4b642abd6ba42dc..fec4766adc1bf989880633c90bbc15764660e79e 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1817,7 +1817,8 @@ unsigned GdbEngine::debuggerCapabilities() const | JumpToLineCapability | ReloadModuleCapability | ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability | ReturnFromFunctionCapability - | CreateFullBacktraceCapability; + | CreateFullBacktraceCapability + | AddWatcherCapability; } void GdbEngine::continueInferiorInternal() diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 07c0c13358c7fe2c2890500a940ad084061a6ab1..af071542d1961508bcf7cc7605f1b91dc9cfbdd1 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -273,11 +273,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) QMenu menu; + const bool actionsEnabled = m_manager->debuggerActionsEnabled(); + const unsigned engineCapabilities = m_manager->debuggerCapabilities(); + const bool canHandleWatches = actionsEnabled && (engineCapabilities & AddWatcherCapability); + QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item")); + actInsertNewWatchItem->setEnabled(canHandleWatches); QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch")); + actSelectWidgetToWatch->setEnabled(canHandleWatches); - const bool actionsEnabled = m_manager->debuggerActionsEnabled(); - const unsigned engineCapabilities = m_manager->debuggerCapabilities(); const QString address = model()->data(mi0, AddressRole).toString(); QAction *actWatchKnownMemory = 0; QAction *actWatchUnknownMemory = new QAction(tr("Open Memory Editor..."), &menu); @@ -292,6 +296,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) QAction *actWatchOrRemove; if (m_type == LocalsType) { actWatchOrRemove = theDebuggerAction(WatchExpression)->updatedAction(exp); + actWatchOrRemove->setEnabled(canHandleWatches); } else { actWatchOrRemove = theDebuggerAction(RemoveWatchExpression)->updatedAction(exp); // Also for the case where the user cleared the expression.