Commit 89a97120 authored by hjk's avatar hjk

debugger: fix initial display of register view in trk adapter

parent 238f5be0
......@@ -2819,6 +2819,9 @@ void GdbEngine::reloadRegisters()
if (!m_registerNamesListed) {
postCommand("-data-list-register-names", CB(handleRegisterListNames));
m_registerNamesListed = true;
// FIXME: Maybe better completely re-do this logic in TRK adapter.
if (m_gdbAdapter->isTrkAdapter())
return;
}
if (m_gdbAdapter->isTrkAdapter()) {
......@@ -2850,11 +2853,14 @@ void GdbEngine::handleRegisterListNames(const GdbResponse &response)
return;
}
QList<Register> registers;
Registers registers;
foreach (const GdbMi &item, response.data.findChild("register-names").children())
registers.append(Register(item.data()));
manager()->registerHandler()->setRegisters(registers);
if (m_gdbAdapter->isTrkAdapter())
m_gdbAdapter->trkReloadRegisters();
}
void GdbEngine::handleRegisterListValues(const GdbResponse &response)
......@@ -2862,7 +2868,7 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
if (response.resultClass != GdbResultDone)
return;
QList<Register> registers = manager()->registerHandler()->registers();
Registers registers = manager()->registerHandler()->registers();
// 24^done,register-values=[{number="0",value="0xf423f"},...]
foreach (const GdbMi &item, response.data.findChild("register-values").children()) {
......
......@@ -2113,8 +2113,9 @@ void TrkGdbAdapter::trkReloadRegisters()
// Take advantage of direct access to cached register values.
QTC_ASSERT(m_snapshot.registerValid, /**/);
RegisterHandler *handler = m_engine->manager()->registerHandler();
QList<Register> registers = handler->registers();
QTC_ASSERT(registers.size() >= 25,
Registers registers = handler->registers();
QTC_ASSERT(registers.size() >= 26,
qDebug() << "HAVE: " << registers.size(); return);
for (int i = 0; i < 16; ++i) {
Register &reg = registers[i];
......@@ -2123,7 +2124,7 @@ void TrkGdbAdapter::trkReloadRegisters()
if (reg.changed)
reg.value = value;
}
Register &reg = registers[24];
Register &reg = registers[25];
QString value = hexxNumber(m_snapshot.registers[16]);
reg.changed = (value != reg.value);
if (reg.changed)
......
......@@ -147,13 +147,13 @@ bool RegisterHandler::isEmpty() const
return m_registers.isEmpty();
}
void RegisterHandler::setRegisters(const QList<Register> &registers)
void RegisterHandler::setRegisters(const Registers &registers)
{
m_registers = registers;
reset();
}
QList<Register> RegisterHandler::registers() const
Registers RegisterHandler::registers() const
{
return m_registers;
}
......
......@@ -31,6 +31,7 @@
#define DEBUGGER_REGISTERHANDLER_H
#include <QtCore/QAbstractTableModel>
#include <QtCore/QVector>
namespace Debugger {
namespace Internal {
......@@ -54,6 +55,8 @@ public:
bool changed;
};
typedef QVector<Register> Registers;
class RegisterHandler : public QAbstractTableModel
{
Q_OBJECT
......@@ -64,8 +67,8 @@ public:
QAbstractItemModel *model() { return this; }
bool isEmpty() const; // nothing known so far?
void setRegisters(const QList<Register> &registers);
QList<Register> registers() const;
void setRegisters(const Registers &registers);
Registers registers() const;
void removeAll();
Q_SLOT void setNumberBase(int base);
......@@ -77,7 +80,7 @@ private:
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &idx) const;
QList<Register> m_registers;
Registers m_registers;
int m_base;
int m_strlen; // approximate width of an value in chars
};
......
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