diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 946ef23a5c85d4673e10bfa0eb7bc3bf4c998415..7ee4fde49c1f8594240b26c5d4241139b5f56b2e 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -1236,7 +1236,7 @@ void CdbDebugEngine::requestModuleSymbols(const QString &moduleName) } while (false); if (!success) warning(errorMessage); - manager()->showModuleSymbols(moduleName, rc); + m_engine->showModuleSymbols(moduleName, rc); } void CdbDebugEngine::reloadRegisters() diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 30b6a1e584dd753cd7c05a1aaf505900d2e7f604..71d495ebf952422779f9a16a72662a9d7dfa5b88 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1171,33 +1171,6 @@ void DebuggerManager::loadSymbols(const QString &module) d->m_engine->loadSymbols(module); } -void DebuggerManager::requestModuleSymbols(const QString &moduleName) -{ - QTC_ASSERT(d->m_engine, return); - d->m_engine->requestModuleSymbols(moduleName); -} - -void DebuggerManager::showModuleSymbols(const QString &moduleName, - const QList<Symbol> &symbols) -{ - QTC_ASSERT(d->m_engine, return); - QTreeWidget *w = new QTreeWidget; - w->setColumnCount(3); - w->setRootIsDecorated(false); - w->setAlternatingRowColors(true); - w->setSortingEnabled(true); - w->setHeaderLabels(QStringList() << tr("Symbol") << tr("Address") << tr("Code")); - w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName)); - foreach (const Symbol &s, symbols) { - QTreeWidgetItem *it = new QTreeWidgetItem; - it->setData(0, Qt::DisplayRole, s.name); - it->setData(1, Qt::DisplayRole, s.address); - it->setData(2, Qt::DisplayRole, s.state); - w->addTopLevelItem(it); - } - createNewDock(w); -} - void DebuggerManager::executeStep() { QTC_ASSERT(d->m_engine, return); @@ -1538,7 +1511,7 @@ void DebuggerManager::showMessage(const QString &msg, int channel) { if (runControl()) runControl()->showMessage(msg, channel); - //else + //else // qDebug() << "OUTPUT: " << channel << msg; } @@ -2029,6 +2002,25 @@ bool IDebuggerEngine::debuggerActionsEnabled() const return m_manager->debuggerActionsEnabled(); } +void IDebuggerEngine::showModuleSymbols + (const QString &moduleName, const Symbols &symbols) +{ + QTreeWidget *w = new QTreeWidget; + w->setColumnCount(3); + w->setRootIsDecorated(false); + w->setAlternatingRowColors(true); + w->setSortingEnabled(true); + w->setHeaderLabels(QStringList() << tr("Symbol") << tr("Address") << tr("Code")); + w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName)); + foreach (const Symbol &s, symbols) { + QTreeWidgetItem *it = new QTreeWidgetItem; + it->setData(0, Qt::DisplayRole, s.name); + it->setData(1, Qt::DisplayRole, s.address); + it->setData(2, Qt::DisplayRole, s.state); + w->addTopLevelItem(it); + } + manager()->createNewDock(w); +} ////////////////////////////////////////////////////////////////////// // // Testing diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index a3b09ab6663c6898e17eb2978c9abdde1c80dfde..5cd5f7d298333e15abb823a66eef1f6e3c2e6515 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -293,13 +293,6 @@ private: Q_SLOT void dumpLog(); Q_SLOT void fontSettingsChanged(const TextEditor::FontSettings &settings); -public: - // stuff in this block should be made private by moving it to - // one of the interfaces - void requestModuleSymbols(const QString &moduleName); - void showModuleSymbols(const QString &moduleName, - const QList<Internal::Symbol> &symbols); - signals: void debuggingFinished(); void inferiorPidChanged(qint64 pid); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 85923d54151c5331d6219ac2592a0d39a78979da..834f19c22076c9dabd47b8fef3e36749b02dbcea 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -485,7 +485,7 @@ void GdbEngine::handleResponse(const QByteArray &buff) // new_bp="1",pended_bp="1",new_expr="\"gdbengine.cpp\":1584", // bkpt={number="1",type="breakpoint",disp="keep",enabled="y", // addr="0x0000000115cc3ddf",func="foo()",file="../foo.cpp", - // line="1584",shlib="/../libFoo_debug.dylib",times="0"} + // line="1584",shlib="/../libFoo_debug.dylib",times="0"} const GdbMi bkpt = result.findChild("bkpt"); const int number = bkpt.findChild("number").data().toInt(); BreakHandler *handler = manager()->breakHandler(); @@ -1409,7 +1409,7 @@ void GdbEngine::handleStop1(const GdbMi &data) // value={old="1",new="0"},frame={addr="0x00451e1b", // func="QScopedPointer",args=[{name="this",value="0xbfffed40"}, // {name="p",value="0x0"}],file="x.h",fullname="/home/.../x.h",line="95"}, - // thread-id="1",stopped-threads="all",core="2" + // thread-id="1",stopped-threads="all",core="2" GdbMi wpt = data.findChild("wpt"); QByteArray bpNumber = wpt.findChild("number").data(); QByteArray bpAddress = wpt.findChild("exp").data(); @@ -1783,7 +1783,7 @@ void GdbEngine::startDebugger() m_progress->setProgressRange(0, 100); Core::FutureProgress *fp = Core::ICore::instance()->progressManager() ->addTask(m_progress->future(), tr("Launching"), _("Debugger.Launcher")); - fp->setKeepOnFinish(false); + fp->setKeepOnFinish(false); m_progress->reportStarted(); delete m_gdbAdapter; @@ -1804,7 +1804,7 @@ unsigned GdbEngine::debuggerCapabilities() const | RegisterCapability | ShowMemoryCapability | JumpToLineCapability | ReloadModuleCapability | ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability - | ReturnFromFunctionCapability + | ReturnFromFunctionCapability | CreateFullBacktraceCapability | WatchpointCapability | AddWatcherCapability; @@ -2219,7 +2219,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response) setBreakpointDataFromOutput(data, bkpt); } else { // Some versions of gdb like "GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)" - // know how to do pending breakpoints using CLI but not MI. So try + // know how to do pending breakpoints using CLI but not MI. So try // again with MI. QByteArray cmd = "break " + breakpointLocation(data); postCommand(cmd, NeedsStop | RebuildBreakpointModel, @@ -2647,7 +2647,7 @@ void GdbEngine::requestModuleSymbols(const QString &moduleName) } while (false); if (!success) qWarning("moduleSymbols: %s\n", qPrintable(errorMessage)); - manager()->showModuleSymbols(moduleName, rc); + showModuleSymbols(moduleName, rc); } void GdbEngine::reloadModules() diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 79b737d35ea6a72893e2ccbcae85e9cca70c438b..1bb2101c0048ab93bbc34e935fe38beaf62ff5e1 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -31,6 +31,7 @@ #define DEBUGGER_IDEBUGGERENGINE_H #include "debuggerconstants.h" +#include "moduleshandler.h" // For 'Symbols'. #include <QtCore/QObject> #include <QtCore/QList> @@ -139,6 +140,7 @@ public slots: { showMessage(msg, StatusBar, timeout); } DebuggerManager *manager() const { return m_manager; } bool debuggerActionsEnabled() const; + void showModuleSymbols(const QString &moduleName, const Symbols &symbols); protected: DebuggerState state() const; diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index 5bb6210f30d15ed045dc05a01adfab6e9da52489..a243c2da0ac716e76b6d97d0b73592542a2f15b3 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -35,7 +35,6 @@ #include <QtCore/QDebug> #include <QtCore/QDir> -#include <QtCore/QList> #include <QtCore/QTextStream> #include <QtGui/QAction> @@ -73,9 +72,9 @@ public: void clearModel(); void addModule(const Module &m); void removeModule(const QString &moduleName); - void setModules(const QList<Module> &m); + void setModules(const Modules &m); - const QList<Module> &modules() const { return m_modules; } + const Modules &modules() const { return m_modules; } IDebuggerEngine *engine() { return m_runControl->engine(); } const IDebuggerEngine *engine() const { return m_runControl->engine(); } @@ -85,7 +84,7 @@ private: DebuggerRunControl *m_runControl; const QVariant m_yes; const QVariant m_no; - QList<Module> m_modules; + Modules m_modules; }; ModulesModel::ModulesModel(ModulesHandler *parent, DebuggerRunControl *runControl) @@ -175,7 +174,7 @@ void ModulesModel::addModule(const Module &m) endInsertRows(); } -void ModulesModel::setModules(const QList<Module> &m) +void ModulesModel::setModules(const Modules &m) { m_modules = m; reset(); @@ -241,12 +240,12 @@ void ModulesHandler::removeModule(const QString &moduleName) m_model->removeModule(moduleName); } -void ModulesHandler::setModules(const QList<Module> &modules) +void ModulesHandler::setModules(const Modules &modules) { m_model->setModules(modules); } -QList<Module> ModulesHandler::modules() const +Modules ModulesHandler::modules() const { return m_model->modules(); } diff --git a/src/plugins/debugger/moduleshandler.h b/src/plugins/debugger/moduleshandler.h index 4b83ae35fe7096a9df2678a680c0adb75a1d34bb..e1310fa5441bb47bb8cddd2bf5e26e4e24bfb528 100644 --- a/src/plugins/debugger/moduleshandler.h +++ b/src/plugins/debugger/moduleshandler.h @@ -61,6 +61,8 @@ public: QString name; }; +typedef QList<Symbol> Symbols; + ////////////////////////////////////////////////////////////////// // // Module @@ -80,6 +82,8 @@ public: QString endAddress; }; +typedef QList<Module> Modules; + ////////////////////////////////////////////////////////////////// // @@ -94,11 +98,11 @@ public: QAbstractItemModel *model() const; - void setModules(const QList<Module> &modules); + void setModules(const Modules &modules); void addModule(const Module &module); void removeModule(const QString &moduleName); - QList<Module> modules() const; + Modules modules() const; void removeAll(); private: diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 2257d87d140eb873e3631e50203374a1f5040ac8..ec34f9c42a40dc7c7e85527f081800c542db9ad3 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -402,7 +402,7 @@ void PdbEngine::handleListModules(const PdbResponse &response) { GdbMi out; out.fromString(response.data.trimmed()); - QList<Module> modules; + Modules modules; foreach (const GdbMi &item, out.children()) { Module module; module.moduleName = _(item.findChild("name").data()); @@ -432,14 +432,14 @@ void PdbEngine::handleListSymbols(const PdbResponse &response) { GdbMi out; out.fromString(response.data.trimmed()); - QList<Symbol> symbols; + Symbols symbols; QString moduleName = response.cookie.toString(); foreach (const GdbMi &item, out.children()) { Symbol symbol; symbol.name = _(item.findChild("name").data()); symbols.append(symbol); } - manager()->showModuleSymbols(moduleName, symbols); + showModuleSymbols(moduleName, symbols); } ////////////////////////////////////////////////////////////////////// @@ -737,7 +737,7 @@ void PdbEngine::handleBacktrace(const PdbResponse &response) // "-> def square(a):" // Populate stack view. - QList<StackFrame> stackFrames; + StackFrames stackFrames; int level = 0; int currentIndex = -1; foreach (const QByteArray &line, response.data.split('\n')) { diff --git a/src/plugins/debugger/stackframe.h b/src/plugins/debugger/stackframe.h index eacd03fa5937e48bf147b17146337f31d657a5fe..2d7076f8614b1c9d622edcec121078e514bf980f 100644 --- a/src/plugins/debugger/stackframe.h +++ b/src/plugins/debugger/stackframe.h @@ -31,6 +31,7 @@ #define DEBUGGER_STACKFRAME_H #include <QtCore/QString> +#include <QtCore/QList> #include <QtCore/QMetaType> QT_BEGIN_NAMESPACE @@ -57,7 +58,9 @@ struct StackFrame QString address; }; -QDebug operator<<(QDebug d, const StackFrame &); +QDebug operator<<(QDebug d, const StackFrame &frame); + +typedef QList<StackFrame> StackFrames; } // namespace Internal } // namespace Debugger