diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-04-15 12:01:58 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-04-15 12:01:58 +0200 |
commit | 4c2f5d1eafc15a108def26eea40bda0eaf011586 (patch) | |
tree | eee0599b5b53fc72245bc9270dbdb8090cf175d4 /src/plugins/debugger/moduleswindow.cpp | |
parent | d11242feba7feeb18979088df1f36f9b0d79f84b (diff) | |
download | qt-creator-4c2f5d1eafc15a108def26eea40bda0eaf011586.tar.gz |
Make the "Show symbols" option of the module window work on Windows.
Introduce API to debug engines and debugger manager to do this.
Reviewed-by: hjk <qtc-commiter@nokia.com>
Diffstat (limited to 'src/plugins/debugger/moduleswindow.cpp')
-rw-r--r-- | src/plugins/debugger/moduleswindow.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp index 8d87709ead..6435e8b65a 100644 --- a/src/plugins/debugger/moduleswindow.cpp +++ b/src/plugins/debugger/moduleswindow.cpp @@ -29,6 +29,7 @@ #include "moduleswindow.h" #include "moduleshandler.h" // for model roles +#include "debuggermanager.h" #include <QtCore/QDebug> #include <QtCore/QProcess> @@ -40,7 +41,7 @@ #include <QtGui/QResizeEvent> #include <QtGui/QToolButton> #include <QtGui/QTreeWidget> - +#include <QtGui/QApplication> /////////////////////////////////////////////////////////////////////////// // @@ -48,10 +49,14 @@ // /////////////////////////////////////////////////////////////////////////// -using Debugger::Internal::ModulesWindow; +namespace Debugger { +namespace Internal { -ModulesWindow::ModulesWindow(QWidget *parent) - : QTreeView(parent), m_alwaysResizeColumnsToContents(false) +ModulesWindow::ModulesWindow(DebuggerManager *debuggerManager, + QWidget *parent) : + QTreeView(parent), + m_alwaysResizeColumnsToContents(false), + m_debuggerManager(debuggerManager) { setWindowTitle(tr("Modules")); setSortingEnabled(true); @@ -88,9 +93,12 @@ void ModulesWindow::resizeEvent(QResizeEvent *event) void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) { + QString name; QModelIndex index = indexAt(ev->pos()); - index = index.sibling(index.row(), 0); - QString name = model()->data(index).toString(); + if (index.isValid()) + index = index.sibling(index.row(), 0); + if (index.isValid()) + name = model()->data(index).toString(); QMenu menu; QAction *act0 = new QAction(tr("Update module list"), &menu); @@ -116,9 +124,6 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) act5->setDisabled(name.isEmpty()); act6->setDisabled(name.isEmpty()); act7->setDisabled(name.isEmpty()); - #ifndef Q_OS_LINUX - act7->setDisabled(true); - #endif menu.addAction(act0); menu.addAction(act4); @@ -178,28 +183,26 @@ void ModulesWindow::showSymbols(const QString &name) { if (name.isEmpty()) return; - QProcess proc; - proc.start("nm", QStringList() << "-D" << name); - proc.waitForFinished(); + QApplication::setOverrideCursor(Qt::WaitCursor); + const QList<Symbol> symbols = m_debuggerManager->moduleSymbols(name); + QApplication::restoreOverrideCursor(); + if (symbols.empty()) + return; QTreeWidget *w = new QTreeWidget; w->setColumnCount(3); w->setRootIsDecorated(false); w->setAlternatingRowColors(true); - //w->header()->hide(); w->setHeaderLabels(QStringList() << tr("Address") << tr("Code") << tr("Symbol")); w->setWindowTitle(tr("Symbols in \"%1\"").arg(name)); - QString contents = QString::fromLocal8Bit(proc.readAllStandardOutput()); - QRegExp re("([0-9a-f]+)?\\s+([^\\s]+)\\s+([^\\s]+)"); - foreach (QString line, contents.split('\n')) { - if (re.indexIn(line) != -1) { - QTreeWidgetItem *it = new QTreeWidgetItem; - it->setData(0, Qt::DisplayRole, re.cap(1)); - it->setData(1, Qt::DisplayRole, re.cap(2)); - it->setData(2, Qt::DisplayRole, re.cap(3)); - w->addTopLevelItem(it); - } else { - qDebug() << "UNHANDLED LINE" << line; - } + foreach (const Symbol &s, symbols) { + QTreeWidgetItem *it = new QTreeWidgetItem; + it->setData(0, Qt::DisplayRole, s.address); + it->setData(1, Qt::DisplayRole, s.state); + it->setData(2, Qt::DisplayRole, s.name); + w->addTopLevelItem(it); } emit newDockRequested(w); } + +} +} |