forked from qt-creator/qt-creator
debugger: move showModuleSymbols from DebuggerManager to DebuggerEngine
This commit is contained in:
@@ -1236,7 +1236,7 @@ void CdbDebugEngine::requestModuleSymbols(const QString &moduleName)
|
|||||||
} while (false);
|
} while (false);
|
||||||
if (!success)
|
if (!success)
|
||||||
warning(errorMessage);
|
warning(errorMessage);
|
||||||
manager()->showModuleSymbols(moduleName, rc);
|
m_engine->showModuleSymbols(moduleName, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbDebugEngine::reloadRegisters()
|
void CdbDebugEngine::reloadRegisters()
|
||||||
|
@@ -1171,33 +1171,6 @@ void DebuggerManager::loadSymbols(const QString &module)
|
|||||||
d->m_engine->loadSymbols(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()
|
void DebuggerManager::executeStep()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_engine, return);
|
QTC_ASSERT(d->m_engine, return);
|
||||||
@@ -2029,6 +2002,25 @@ bool IDebuggerEngine::debuggerActionsEnabled() const
|
|||||||
return m_manager->debuggerActionsEnabled();
|
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
|
// Testing
|
||||||
|
@@ -293,13 +293,6 @@ private:
|
|||||||
Q_SLOT void dumpLog();
|
Q_SLOT void dumpLog();
|
||||||
Q_SLOT void fontSettingsChanged(const TextEditor::FontSettings &settings);
|
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:
|
signals:
|
||||||
void debuggingFinished();
|
void debuggingFinished();
|
||||||
void inferiorPidChanged(qint64 pid);
|
void inferiorPidChanged(qint64 pid);
|
||||||
|
@@ -2647,7 +2647,7 @@ void GdbEngine::requestModuleSymbols(const QString &moduleName)
|
|||||||
} while (false);
|
} while (false);
|
||||||
if (!success)
|
if (!success)
|
||||||
qWarning("moduleSymbols: %s\n", qPrintable(errorMessage));
|
qWarning("moduleSymbols: %s\n", qPrintable(errorMessage));
|
||||||
manager()->showModuleSymbols(moduleName, rc);
|
showModuleSymbols(moduleName, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::reloadModules()
|
void GdbEngine::reloadModules()
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#define DEBUGGER_IDEBUGGERENGINE_H
|
#define DEBUGGER_IDEBUGGERENGINE_H
|
||||||
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
#include "moduleshandler.h" // For 'Symbols'.
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
@@ -139,6 +140,7 @@ public slots:
|
|||||||
{ showMessage(msg, StatusBar, timeout); }
|
{ showMessage(msg, StatusBar, timeout); }
|
||||||
DebuggerManager *manager() const { return m_manager; }
|
DebuggerManager *manager() const { return m_manager; }
|
||||||
bool debuggerActionsEnabled() const;
|
bool debuggerActionsEnabled() const;
|
||||||
|
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DebuggerState state() const;
|
DebuggerState state() const;
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
@@ -73,9 +72,9 @@ public:
|
|||||||
void clearModel();
|
void clearModel();
|
||||||
void addModule(const Module &m);
|
void addModule(const Module &m);
|
||||||
void removeModule(const QString &moduleName);
|
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(); }
|
IDebuggerEngine *engine() { return m_runControl->engine(); }
|
||||||
const IDebuggerEngine *engine() const { return m_runControl->engine(); }
|
const IDebuggerEngine *engine() const { return m_runControl->engine(); }
|
||||||
|
|
||||||
@@ -85,7 +84,7 @@ private:
|
|||||||
DebuggerRunControl *m_runControl;
|
DebuggerRunControl *m_runControl;
|
||||||
const QVariant m_yes;
|
const QVariant m_yes;
|
||||||
const QVariant m_no;
|
const QVariant m_no;
|
||||||
QList<Module> m_modules;
|
Modules m_modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
ModulesModel::ModulesModel(ModulesHandler *parent, DebuggerRunControl *runControl)
|
ModulesModel::ModulesModel(ModulesHandler *parent, DebuggerRunControl *runControl)
|
||||||
@@ -175,7 +174,7 @@ void ModulesModel::addModule(const Module &m)
|
|||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesModel::setModules(const QList<Module> &m)
|
void ModulesModel::setModules(const Modules &m)
|
||||||
{
|
{
|
||||||
m_modules = m;
|
m_modules = m;
|
||||||
reset();
|
reset();
|
||||||
@@ -241,12 +240,12 @@ void ModulesHandler::removeModule(const QString &moduleName)
|
|||||||
m_model->removeModule(moduleName);
|
m_model->removeModule(moduleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesHandler::setModules(const QList<Module> &modules)
|
void ModulesHandler::setModules(const Modules &modules)
|
||||||
{
|
{
|
||||||
m_model->setModules(modules);
|
m_model->setModules(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Module> ModulesHandler::modules() const
|
Modules ModulesHandler::modules() const
|
||||||
{
|
{
|
||||||
return m_model->modules();
|
return m_model->modules();
|
||||||
}
|
}
|
||||||
|
@@ -61,6 +61,8 @@ public:
|
|||||||
QString name;
|
QString name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef QList<Symbol> Symbols;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Module
|
// Module
|
||||||
@@ -80,6 +82,8 @@ public:
|
|||||||
QString endAddress;
|
QString endAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef QList<Module> Modules;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -94,11 +98,11 @@ public:
|
|||||||
|
|
||||||
QAbstractItemModel *model() const;
|
QAbstractItemModel *model() const;
|
||||||
|
|
||||||
void setModules(const QList<Module> &modules);
|
void setModules(const Modules &modules);
|
||||||
void addModule(const Module &module);
|
void addModule(const Module &module);
|
||||||
void removeModule(const QString &moduleName);
|
void removeModule(const QString &moduleName);
|
||||||
|
|
||||||
QList<Module> modules() const;
|
Modules modules() const;
|
||||||
void removeAll();
|
void removeAll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -402,7 +402,7 @@ void PdbEngine::handleListModules(const PdbResponse &response)
|
|||||||
{
|
{
|
||||||
GdbMi out;
|
GdbMi out;
|
||||||
out.fromString(response.data.trimmed());
|
out.fromString(response.data.trimmed());
|
||||||
QList<Module> modules;
|
Modules modules;
|
||||||
foreach (const GdbMi &item, out.children()) {
|
foreach (const GdbMi &item, out.children()) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = _(item.findChild("name").data());
|
module.moduleName = _(item.findChild("name").data());
|
||||||
@@ -432,14 +432,14 @@ void PdbEngine::handleListSymbols(const PdbResponse &response)
|
|||||||
{
|
{
|
||||||
GdbMi out;
|
GdbMi out;
|
||||||
out.fromString(response.data.trimmed());
|
out.fromString(response.data.trimmed());
|
||||||
QList<Symbol> symbols;
|
Symbols symbols;
|
||||||
QString moduleName = response.cookie.toString();
|
QString moduleName = response.cookie.toString();
|
||||||
foreach (const GdbMi &item, out.children()) {
|
foreach (const GdbMi &item, out.children()) {
|
||||||
Symbol symbol;
|
Symbol symbol;
|
||||||
symbol.name = _(item.findChild("name").data());
|
symbol.name = _(item.findChild("name").data());
|
||||||
symbols.append(symbol);
|
symbols.append(symbol);
|
||||||
}
|
}
|
||||||
manager()->showModuleSymbols(moduleName, symbols);
|
showModuleSymbols(moduleName, symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@@ -737,7 +737,7 @@ void PdbEngine::handleBacktrace(const PdbResponse &response)
|
|||||||
// "-> def square(a):"
|
// "-> def square(a):"
|
||||||
|
|
||||||
// Populate stack view.
|
// Populate stack view.
|
||||||
QList<StackFrame> stackFrames;
|
StackFrames stackFrames;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int currentIndex = -1;
|
int currentIndex = -1;
|
||||||
foreach (const QByteArray &line, response.data.split('\n')) {
|
foreach (const QByteArray &line, response.data.split('\n')) {
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#define DEBUGGER_STACKFRAME_H
|
#define DEBUGGER_STACKFRAME_H
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QMetaType>
|
#include <QtCore/QMetaType>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -57,7 +58,9 @@ struct StackFrame
|
|||||||
QString address;
|
QString address;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug operator<<(QDebug d, const StackFrame &);
|
QDebug operator<<(QDebug d, const StackFrame &frame);
|
||||||
|
|
||||||
|
typedef QList<StackFrame> StackFrames;
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
Reference in New Issue
Block a user