Commit a8ea8d38 authored by hjk's avatar hjk

Debugger: Use TreeModel for ModulesHandler

Change-Id: I831f71e7441330e2a6a7f3ddcf89a29517b3b91b
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 54fda55b
......@@ -1858,8 +1858,8 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
GdbMi value;
value.fromString(reply->reply);
if (value.type() == GdbMi::List) {
Modules modules;
modules.reserve(value.childCount());
ModulesHandler *handler = modulesHandler();
handler->beginUpdateAll();
foreach (const GdbMi &gdbmiModule, value.children()) {
Module module;
module.moduleName = QString::fromLatin1(gdbmiModule["name"].data());
......@@ -1868,9 +1868,9 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
module.endAddress = gdbmiModule["end"].data().toULongLong(0, 0);
if (gdbmiModule["deferred"].type() == GdbMi::Invalid)
module.symbolsRead = Module::ReadOk;
modules.push_back(module);
handler->updateModule(module);
}
modulesHandler()->setModules(modules);
handler->endUpdateAll();
} else {
showMessage(QString::fromLatin1("Parse error in modules response."), LogError);
qWarning("Parse error in modules response:\n%s", reply->reply.constData());
......
......@@ -771,7 +771,8 @@ void LldbEngine::reloadModules()
void LldbEngine::refreshModules(const GdbMi &modules)
{
Modules mods;
ModulesHandler *handler = modulesHandler();
handler->beginUpdateAll();
foreach (const GdbMi &item, modules.children()) {
Module module;
module.modulePath = item["file"].toUtf8();
......@@ -779,9 +780,9 @@ void LldbEngine::refreshModules(const GdbMi &modules)
module.symbolsRead = Module::UnknownReadState;
module.startAddress = item["loaded_addr"].toAddress();
module.endAddress = 0; // FIXME: End address not easily available.
mods.append(module);
handler->updateModule(module);
}
modulesHandler()->setModules(mods);
handler->endUpdateAll();
}
void LldbEngine::requestModuleSymbols(const QString &moduleName)
......
This diff is collapsed.
......@@ -32,6 +32,7 @@
#define DEBUGGER_MODULESHANDLER_H
#include <utils/elfreader.h>
#include <utils/treemodel.h>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
......@@ -42,7 +43,6 @@ namespace Debugger {
namespace Internal {
class DebuggerEngine;
class ModulesModel;
//////////////////////////////////////////////////////////////////
//
......@@ -109,7 +109,6 @@ public:
typedef QVector<Module> Modules;
//////////////////////////////////////////////////////////////////
//
// ModulesHandler
......@@ -125,16 +124,18 @@ public:
QAbstractItemModel *model() const;
void setModules(const Modules &modules);
void removeModule(const QString &modulePath);
void updateModule(const Module &module);
Modules modules() const;
void beginUpdateAll();
void endUpdateAll();
void removeAll();
Modules modules() const;
private:
DebuggerEngine *m_engine;
ModulesModel *m_model;
Utils::TreeModel *m_model;
QSortFilterProxyModel *m_proxyModel;
};
......
......@@ -402,7 +402,8 @@ void PdbEngine::handleListModules(const PdbResponse &response)
{
GdbMi out;
out.fromString(response.data.trimmed());
Modules modules;
ModulesHandler *handler = modulesHandler();
handler->beginUpdateAll();
foreach (const GdbMi &item, out.children()) {
Module module;
module.moduleName = _(item["name"].data());
......@@ -417,9 +418,9 @@ void PdbEngine::handleListModules(const PdbResponse &response)
path = _("(builtin)");
}
module.modulePath = path;
modules.append(module);
handler->updateModule(module);
}
modulesHandler()->setModules(modules);
handler->endUpdateAll();
}
void PdbEngine::requestModuleSymbols(const QString &moduleName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment