forked from qt-creator/qt-creator
Debugger: Fix crash toggling Stack/"Derefence Pointers" without project
Enable debugger actions correctly. Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
#include "breakwindow.h"
|
#include "breakwindow.h"
|
||||||
|
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
|
#include "debuggermanager.h"
|
||||||
#include "ui_breakcondition.h"
|
#include "ui_breakcondition.h"
|
||||||
#include "ui_breakbyfunction.h"
|
#include "ui_breakbyfunction.h"
|
||||||
|
|
||||||
@@ -179,6 +180,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
editConditionAction->setEnabled(si.size() > 0);
|
editConditionAction->setEnabled(si.size() > 0);
|
||||||
|
|
||||||
QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu);
|
QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu);
|
||||||
|
synchronizeAction->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled());
|
||||||
|
|
||||||
QModelIndex idx0 = (si.size() ? si.front() : QModelIndex());
|
QModelIndex idx0 = (si.size() ? si.front() : QModelIndex());
|
||||||
QModelIndex idx2 = idx0.sibling(idx0.row(), 2);
|
QModelIndex idx2 = idx0.sibling(idx0.row(), 2);
|
||||||
|
|||||||
@@ -1684,11 +1684,51 @@ void DebuggerManager::setState(DebuggerState state)
|
|||||||
d->m_actions.runToFunctionAction->setEnabled(stopped);
|
d->m_actions.runToFunctionAction->setEnabled(stopped);
|
||||||
d->m_actions.jumpToLineAction->setEnabled(stopped);
|
d->m_actions.jumpToLineAction->setEnabled(stopped);
|
||||||
d->m_actions.nextAction->setEnabled(stopped);
|
d->m_actions.nextAction->setEnabled(stopped);
|
||||||
|
|
||||||
|
const bool actionsEnabled = debuggerActionsEnabled();
|
||||||
|
theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled);
|
||||||
|
theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled && d->m_engine->isGdbEngine());
|
||||||
|
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
|
||||||
|
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
|
||||||
|
|
||||||
emit stateChanged(d->m_state);
|
emit stateChanged(d->m_state);
|
||||||
const bool notbusy = state == InferiorStopped
|
const bool notbusy = state == InferiorStopped
|
||||||
|| state == DebuggerNotReady
|
|| state == DebuggerNotReady
|
||||||
|| state == InferiorUnrunnable;
|
|| state == InferiorUnrunnable;
|
||||||
setBusyCursor(!notbusy);
|
setBusyCursor(!notbusy);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DebuggerManager::debuggerActionsEnabled() const
|
||||||
|
{
|
||||||
|
if (!d->m_engine)
|
||||||
|
return false;
|
||||||
|
switch (state()) {
|
||||||
|
case InferiorPrepared:
|
||||||
|
case InferiorStarting:
|
||||||
|
case InferiorRunningRequested:
|
||||||
|
case InferiorRunning:
|
||||||
|
case InferiorUnrunnable:
|
||||||
|
case InferiorStopping:
|
||||||
|
case InferiorStopped:
|
||||||
|
return true;
|
||||||
|
case DebuggerNotReady:
|
||||||
|
case EngineStarting:
|
||||||
|
case AdapterStarting:
|
||||||
|
case AdapterStarted:
|
||||||
|
case AdapterStartFailed:
|
||||||
|
case InferiorPreparing:
|
||||||
|
case InferiorPreparationFailed:
|
||||||
|
case InferiorStartFailed:
|
||||||
|
case InferiorStopFailed:
|
||||||
|
case InferiorShuttingDown:
|
||||||
|
case InferiorShutDown:
|
||||||
|
case InferiorShutdownFailed:
|
||||||
|
case AdapterShuttingDown:
|
||||||
|
case AdapterShutdownFailed:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug d, DebuggerState state)
|
QDebug operator<<(QDebug d, DebuggerState state)
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ public:
|
|||||||
|
|
||||||
void showMessageBox(int icon, const QString &title, const QString &text);
|
void showMessageBox(int icon, const QString &title, const QString &text);
|
||||||
|
|
||||||
|
bool debuggerActionsEnabled() const;
|
||||||
|
|
||||||
static DebuggerManager *instance();
|
static DebuggerManager *instance();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -105,11 +105,15 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
name = model()->data(index).toString();
|
name = model()->data(index).toString();
|
||||||
|
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
const bool enabled = Debugger::DebuggerManager::instance()->debuggerActionsEnabled();
|
||||||
QAction *act0 = new QAction(tr("Update module list"), &menu);
|
QAction *act0 = new QAction(tr("Update module list"), &menu);
|
||||||
QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name),
|
act0->setEnabled(enabled);
|
||||||
&menu);
|
QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name), &menu);
|
||||||
|
act3->setEnabled(enabled);
|
||||||
QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu);
|
QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu);
|
||||||
|
act4->setEnabled(enabled);
|
||||||
QAction *act5 = 0;
|
QAction *act5 = 0;
|
||||||
QAction *act6 = 0;
|
QAction *act6 = 0;
|
||||||
QAction *act7 = 0;
|
QAction *act7 = 0;
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
} else {
|
} else {
|
||||||
actShowMemory->setText(tr("Open memory editor at %1").arg(address));
|
actShowMemory->setText(tr("Open memory editor at %1").arg(address));
|
||||||
}
|
}
|
||||||
|
actShowMemory->setEnabled(m_manager->debuggerActionsEnabled());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
int base = model()->data(QModelIndex(), RegisterNumberBaseRole).toInt();
|
int base = model()->data(QModelIndex(), RegisterNumberBaseRole).toInt();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "sourcefileswindow.h"
|
#include "sourcefileswindow.h"
|
||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
|
#include "debuggermanager.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
@@ -199,6 +200,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *act1 = new QAction(tr("Reload data"), &menu);
|
QAction *act1 = new QAction(tr("Reload data"), &menu);
|
||||||
|
act1->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled());
|
||||||
//act1->setCheckable(true);
|
//act1->setCheckable(true);
|
||||||
QAction *act2 = 0;
|
QAction *act2 = 0;
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ bool StackHandler::isDebuggingDebuggingHelpers() const
|
|||||||
|
|
||||||
ThreadData::ThreadData(int threadId) :
|
ThreadData::ThreadData(int threadId) :
|
||||||
id(threadId),
|
id(threadId),
|
||||||
|
address(0),
|
||||||
line(-1)
|
line(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,8 +113,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
#if 0 // @TODO: not implemented
|
||||||
menu.addAction(theDebuggerAction(UseToolTipsInStackView));
|
menu.addAction(theDebuggerAction(UseToolTipsInStackView));
|
||||||
|
#endif
|
||||||
menu.addAction(theDebuggerAction(UseAddressInStackView));
|
menu.addAction(theDebuggerAction(UseAddressInStackView));
|
||||||
|
|
||||||
QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents"));
|
QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents"));
|
||||||
|
|||||||
@@ -245,16 +245,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
//QAction *actWatchExpressionInWindow
|
|
||||||
// = theDebuggerAction(WatchExpressionInWindow);
|
|
||||||
//menu.addAction(actWatchExpressionInWindow);
|
|
||||||
|
|
||||||
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item"));
|
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item"));
|
||||||
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch"));
|
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch"));
|
||||||
|
|
||||||
const QString address = model()->data(mi0, AddressRole).toString();
|
const QString address = model()->data(mi0, AddressRole).toString();
|
||||||
QAction *actWatchKnownMemory = 0;
|
QAction *actWatchKnownMemory = 0;
|
||||||
QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu);;
|
QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu);
|
||||||
|
actWatchUnknownMemory->setEnabled(m_manager->debuggerActionsEnabled());
|
||||||
|
|
||||||
if (!address.isEmpty())
|
if (!address.isEmpty())
|
||||||
actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu);
|
actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
@@ -270,6 +269,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addAction(actWatchKnownMemory);
|
menu.addAction(actWatchKnownMemory);
|
||||||
menu.addAction(actWatchUnknownMemory);
|
menu.addAction(actWatchUnknownMemory);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
menu.addAction(theDebuggerAction(RecheckDebuggingHelpers));
|
menu.addAction(theDebuggerAction(RecheckDebuggingHelpers));
|
||||||
menu.addAction(theDebuggerAction(UseDebuggingHelpers));
|
menu.addAction(theDebuggerAction(UseDebuggingHelpers));
|
||||||
|
|
||||||
@@ -277,8 +277,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addAction(theDebuggerAction(UseToolTipsInLocalsView));
|
menu.addAction(theDebuggerAction(UseToolTipsInLocalsView));
|
||||||
|
|
||||||
menu.addAction(theDebuggerAction(AutoDerefPointers));
|
menu.addAction(theDebuggerAction(AutoDerefPointers));
|
||||||
theDebuggerAction(AutoDerefPointers)->
|
|
||||||
setEnabled(m_manager->currentEngine()->isGdbEngine());
|
|
||||||
QAction *actAdjustColumnWidths =
|
QAction *actAdjustColumnWidths =
|
||||||
menu.addAction(tr("Adjust column widths to contents"));
|
menu.addAction(tr("Adjust column widths to contents"));
|
||||||
QAction *actAlwaysAdjustColumnWidth =
|
QAction *actAlwaysAdjustColumnWidth =
|
||||||
|
|||||||
Reference in New Issue
Block a user