forked from qt-creator/qt-creator
DAP: Add locals lazy loading
Change-Id: I49c6d9fce8c6f45f1ec4cb3b6c1733d93202bc0f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -47,7 +47,11 @@ public:
|
||||
void start() override { m_socket.connectToServer(m_socketName, QIODevice::ReadWrite); }
|
||||
|
||||
bool isRunning() const override { return m_socket.isOpen(); }
|
||||
void writeRaw(const QByteArray &data) override { m_socket.write(data); }
|
||||
void writeRaw(const QByteArray &data) override
|
||||
{
|
||||
if (m_socket.isOpen())
|
||||
m_socket.write(data);
|
||||
}
|
||||
void kill() override
|
||||
{
|
||||
if (m_socket.isOpen())
|
||||
|
@@ -413,8 +413,9 @@ void DapEngine::assignValueInDebugger(WatchItem *, const QString &/*expression*/
|
||||
|
||||
void DapEngine::updateItem(const QString &iname)
|
||||
{
|
||||
Q_UNUSED(iname)
|
||||
updateAll();
|
||||
WatchItem *item = watchHandler()->findItem(iname);
|
||||
m_currentWatchItem = item;
|
||||
m_dapClient->variables(item->variablesReference);
|
||||
}
|
||||
|
||||
QString DapEngine::errorMessage(QProcess::ProcessError error) const
|
||||
@@ -554,6 +555,9 @@ void DapEngine::handleScopesResponse(const QJsonObject &response)
|
||||
if (name == "Locals") { // Fix for several scopes
|
||||
watchHandler()->removeAllData();
|
||||
watchHandler()->notifyUpdateStarted();
|
||||
|
||||
m_watchItems.clear();
|
||||
watchHandler()->cleanup();
|
||||
m_dapClient->variables(variablesReference);
|
||||
}
|
||||
}
|
||||
@@ -707,31 +711,25 @@ void DapEngine::refreshLocals(const QJsonArray &variables)
|
||||
item->address = variable.toObject().value("address").toInt();
|
||||
item->type = variable.toObject().value("type").toString();
|
||||
|
||||
const int variablesReference = variable.toObject().value("variablesReference").toInt();
|
||||
item->variablesReference = variablesReference;
|
||||
if (variablesReference > 0)
|
||||
item->wantsChildren = true;
|
||||
|
||||
qCDebug(dapEngineLog) << "variable" << name << item->hexAddress();
|
||||
if (isFirstLayer)
|
||||
m_watchItems.append(item);
|
||||
else
|
||||
m_currentWatchItem->appendChild(item);
|
||||
|
||||
const int variablesReference = variable.toObject().value("variablesReference").toInt();
|
||||
if (variablesReference > 0)
|
||||
m_variablesReferenceQueue.push({variablesReference, item});
|
||||
}
|
||||
|
||||
if (m_variablesReferenceQueue.empty()) {
|
||||
if (isFirstLayer) {
|
||||
for (auto item : m_watchItems)
|
||||
watchHandler()->insertItem(item);
|
||||
m_watchItems.clear();
|
||||
} else
|
||||
watchHandler()->updateWatchExpression(m_currentWatchItem, "");
|
||||
|
||||
watchHandler()->notifyUpdateFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto front = m_variablesReferenceQueue.front();
|
||||
m_variablesReferenceQueue.pop();
|
||||
|
||||
m_dapClient->variables(front.first);
|
||||
m_currentWatchItem = front.second;
|
||||
}
|
||||
|
||||
void DapEngine::refreshStack(const QJsonArray &stackFrames)
|
||||
|
@@ -113,7 +113,6 @@ protected:
|
||||
int m_nextBreakpointId = 1;
|
||||
int m_currentThreadId = -1;
|
||||
|
||||
std::queue<std::pair<int, WatchItem *>> m_variablesReferenceQueue;
|
||||
WatchItem *m_currentWatchItem = nullptr;
|
||||
QList<WatchItem *> m_watchItems;
|
||||
};
|
||||
|
@@ -63,7 +63,11 @@ public:
|
||||
}
|
||||
|
||||
bool isRunning() const override { return m_proc.isRunning(); }
|
||||
void writeRaw(const QByteArray &data) override { m_proc.writeRaw(data); }
|
||||
void writeRaw(const QByteArray &data) override
|
||||
{
|
||||
if (m_proc.state() == QProcess::Running)
|
||||
m_proc.writeRaw(data);
|
||||
}
|
||||
void kill() override { m_proc.kill(); }
|
||||
QByteArray readAllStandardOutput() override { return m_proc.readAllStandardOutput().toUtf8(); }
|
||||
QString readAllStandardError() override { return m_proc.readAllStandardError(); }
|
||||
|
@@ -78,7 +78,11 @@ public:
|
||||
}
|
||||
|
||||
bool isRunning() const override { return m_socket.isOpen(); }
|
||||
void writeRaw(const QByteArray &data) override { m_socket.write(data); }
|
||||
void writeRaw(const QByteArray &data) override
|
||||
{
|
||||
if (m_socket.isOpen())
|
||||
m_socket.write(data);
|
||||
}
|
||||
void kill() override
|
||||
{
|
||||
m_timer->stop();
|
||||
@@ -100,7 +104,7 @@ public:
|
||||
QProcess::ExitStatus exitStatus() const override { return QProcess::NormalExit; }
|
||||
QProcess::ProcessError error() const override { return QProcess::UnknownError; }
|
||||
Utils::ProcessResult result() const override { return ProcessResult::FinishedWithSuccess; }
|
||||
QString exitMessage() const override { return QString(); };
|
||||
QString exitMessage() const override { return QString(); }
|
||||
|
||||
private:
|
||||
Utils::Process m_proc;
|
||||
|
@@ -71,6 +71,7 @@ public:
|
||||
uint bitpos = 0; // Position within bit fields
|
||||
uint bitsize = 0; // Size in case of bit fields
|
||||
uint autoDerefCount = 0; // number of levels of automatic dereferencing that has taken place (for pointer types)
|
||||
uint variablesReference = 0;// reference to the variable in the variables request DAP related
|
||||
int elided = 0; // Full size if value was cut off, -1 if cut on unknown size, 0 otherwise
|
||||
int arrayIndex = -1; // -1 if not an array member
|
||||
uchar sortGroup = 0; // 0 - ordinary member, 1 - vptr, 2 - base class
|
||||
|
Reference in New Issue
Block a user