forked from qt-creator/qt-creator
Debugger: Add some menu actions.
- Windows: Inspect a module by running depends. - Clear all watches.
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
@@ -84,11 +85,14 @@ void ModulesWindow::moduleActivated(const QModelIndex &index)
|
|||||||
void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
|
QString fileName;
|
||||||
QModelIndex index = indexAt(ev->pos());
|
QModelIndex index = indexAt(ev->pos());
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
if (index.isValid())
|
if (index.isValid()) {
|
||||||
name = index.data().toString();
|
name = index.data().toString();
|
||||||
|
fileName = index.sibling(index.row(), 1).data().toString();
|
||||||
|
}
|
||||||
|
|
||||||
DebuggerEngine *engine = debuggerCore()->currentEngine();
|
DebuggerEngine *engine = debuggerCore()->currentEngine();
|
||||||
QTC_ASSERT(engine, return);
|
QTC_ASSERT(engine, return);
|
||||||
@@ -120,6 +124,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *actLoadSymbolsForModule = 0;
|
QAction *actLoadSymbolsForModule = 0;
|
||||||
QAction *actEditFile = 0;
|
QAction *actEditFile = 0;
|
||||||
QAction *actShowModuleSymbols = 0;
|
QAction *actShowModuleSymbols = 0;
|
||||||
|
QAction *actShowDependencies = 0; // Show dependencies by running 'depends.exe'
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
actLoadSymbolsForModule = new QAction(tr("Load Symbols for Module"), &menu);
|
actLoadSymbolsForModule = new QAction(tr("Load Symbols for Module"), &menu);
|
||||||
actLoadSymbolsForModule->setEnabled(false);
|
actLoadSymbolsForModule->setEnabled(false);
|
||||||
@@ -127,6 +132,10 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
actEditFile->setEnabled(false);
|
actEditFile->setEnabled(false);
|
||||||
actShowModuleSymbols = new QAction(tr("Show Symbols"), &menu);
|
actShowModuleSymbols = new QAction(tr("Show Symbols"), &menu);
|
||||||
actShowModuleSymbols->setEnabled(false);
|
actShowModuleSymbols->setEnabled(false);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
actShowDependencies = new QAction(tr("Show Dependencies"), &menu);
|
||||||
|
actShowDependencies->setEnabled(false);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
actLoadSymbolsForModule
|
actLoadSymbolsForModule
|
||||||
= new QAction(tr("Load Symbols for Module \"%1\"").arg(name), &menu);
|
= new QAction(tr("Load Symbols for Module \"%1\"").arg(name), &menu);
|
||||||
@@ -138,10 +147,16 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
= new QAction(tr("Show Symbols in File \"%1\"").arg(name), &menu);
|
= new QAction(tr("Show Symbols in File \"%1\"").arg(name), &menu);
|
||||||
actShowModuleSymbols
|
actShowModuleSymbols
|
||||||
->setEnabled(capabilities & ShowModuleSymbolsCapability);
|
->setEnabled(capabilities & ShowModuleSymbolsCapability);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu);
|
||||||
|
actShowDependencies->setEnabled(!fileName.isEmpty());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addAction(actUpdateModuleList);
|
menu.addAction(actUpdateModuleList);
|
||||||
//menu.addAction(actShowModuleSources); // FIXME
|
//menu.addAction(actShowModuleSources); // FIXME
|
||||||
|
if (actShowDependencies)
|
||||||
|
menu.addAction(actShowDependencies);
|
||||||
menu.addAction(actLoadSymbolsForAllModules);
|
menu.addAction(actLoadSymbolsForAllModules);
|
||||||
menu.addAction(actExamineAllModules);
|
menu.addAction(actExamineAllModules);
|
||||||
menu.addAction(actLoadSymbolsForModule);
|
menu.addAction(actLoadSymbolsForModule);
|
||||||
@@ -177,6 +192,8 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
engine->gotoLocation(name);
|
engine->gotoLocation(name);
|
||||||
else if (act == actShowModuleSymbols)
|
else if (act == actShowModuleSymbols)
|
||||||
engine->requestModuleSymbols(name);
|
engine->requestModuleSymbols(name);
|
||||||
|
else if (actShowDependencies && act == actShowDependencies)
|
||||||
|
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesWindow::resizeColumnsToContents()
|
void ModulesWindow::resizeColumnsToContents()
|
||||||
|
|||||||
@@ -1326,6 +1326,19 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchHandler::clearWatches()
|
||||||
|
{
|
||||||
|
if (m_watcherNames.isEmpty())
|
||||||
|
return;
|
||||||
|
foreach (WatchItem *item, m_watchers->rootItem()->children)
|
||||||
|
m_watchers->destroyItem(item);
|
||||||
|
m_watcherNames.clear();
|
||||||
|
watcherCounter = 0;
|
||||||
|
updateWatchersWindow();
|
||||||
|
emitAllChanged();
|
||||||
|
saveWatchers();
|
||||||
|
}
|
||||||
|
|
||||||
void WatchHandler::removeWatchExpression(const QString &exp0)
|
void WatchHandler::removeWatchExpression(const QString &exp0)
|
||||||
{
|
{
|
||||||
QByteArray exp = exp0.toLatin1();
|
QByteArray exp = exp0.toLatin1();
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ public:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
void watchExpression(const QString &exp);
|
void watchExpression(const QString &exp);
|
||||||
void removeWatchExpression(const QString &exp);
|
void removeWatchExpression(const QString &exp);
|
||||||
|
Q_SLOT void clearWatches();
|
||||||
Q_SLOT void emitAllChanged();
|
Q_SLOT void emitAllChanged();
|
||||||
|
|
||||||
void beginCycle(bool fullCycle = true); // Called at begin of updateLocals() cycle
|
void beginCycle(bool fullCycle = true); // Called at begin of updateLocals() cycle
|
||||||
|
|||||||
@@ -379,11 +379,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(exp), &menu);
|
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(exp), &menu);
|
||||||
actRemoveWatchExpression->setEnabled(
|
actRemoveWatchExpression->setEnabled(
|
||||||
(canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty());
|
(canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty());
|
||||||
|
QAction *actRemoveWatches = new QAction(tr("Clear Watch Items"), &menu);
|
||||||
|
actRemoveWatches->setEnabled(!WatchHandler::watcherNames().isEmpty());
|
||||||
|
|
||||||
if (m_type == LocalsType)
|
if (m_type == LocalsType)
|
||||||
menu.addAction(actWatchExpression);
|
menu.addAction(actWatchExpression);
|
||||||
else
|
else {
|
||||||
menu.addAction(actRemoveWatchExpression);
|
menu.addAction(actRemoveWatchExpression);
|
||||||
|
menu.addAction(actRemoveWatches);
|
||||||
|
}
|
||||||
|
|
||||||
QMenu memoryMenu;
|
QMenu memoryMenu;
|
||||||
memoryMenu.setTitle(tr("Open Memory Editor..."));
|
memoryMenu.setTitle(tr("Open Memory Editor..."));
|
||||||
@@ -481,6 +485,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
watchExpression(exp);
|
watchExpression(exp);
|
||||||
} else if (act == actRemoveWatchExpression) {
|
} else if (act == actRemoveWatchExpression) {
|
||||||
removeWatchExpression(exp);
|
removeWatchExpression(exp);
|
||||||
|
} else if (act == actRemoveWatches) {
|
||||||
|
currentEngine()->watchHandler()->clearWatches();
|
||||||
} else if (act == actClearCodeModelSnapshot) {
|
} else if (act == actClearCodeModelSnapshot) {
|
||||||
debuggerCore()->clearCppCodeModelSnapshot();
|
debuggerCore()->clearCppCodeModelSnapshot();
|
||||||
} else if (act == clearTypeFormatAction) {
|
} else if (act == clearTypeFormatAction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user