forked from qt-creator/qt-creator
DAP: Add thread list
Change-Id: Ide9305e246f4e0dbe687e37a96b20e99b197ea3f Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -211,6 +211,13 @@ void DapEngine::dabStackTrace()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DapEngine::threads()
|
||||||
|
{
|
||||||
|
postDirectCommand(
|
||||||
|
{{"command", "threads"},
|
||||||
|
{"type", "request"}});
|
||||||
|
}
|
||||||
|
|
||||||
void DapEngine::executeStepIn(bool)
|
void DapEngine::executeStepIn(bool)
|
||||||
{
|
{
|
||||||
if (m_currentThreadId == -1)
|
if (m_currentThreadId == -1)
|
||||||
@@ -226,7 +233,6 @@ void DapEngine::executeStepIn(bool)
|
|||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyInferiorRunOk();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DapEngine::executeStepOut()
|
void DapEngine::executeStepOut()
|
||||||
@@ -244,7 +250,6 @@ void DapEngine::executeStepOut()
|
|||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyInferiorRunOk();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DapEngine::executeStepOver(bool)
|
void DapEngine::executeStepOver(bool)
|
||||||
@@ -262,7 +267,6 @@ void DapEngine::executeStepOver(bool)
|
|||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyInferiorRunOk();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DapEngine::continueInferior()
|
void DapEngine::continueInferior()
|
||||||
@@ -648,6 +652,37 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
gotoLocation(Location(file, line));
|
gotoLocation(Location(file, line));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command == "stepIn" || command == "stepOut" || command == "next") {
|
||||||
|
if (ob.value("success").toBool()) {
|
||||||
|
showMessage(command, LogDebug);
|
||||||
|
notifyInferiorRunOk();
|
||||||
|
} else {
|
||||||
|
notifyInferiorRunFailed();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command == "threads") {
|
||||||
|
QJsonArray threads = ob.value("body").toObject().value("threads").toArray();
|
||||||
|
if (threads.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ThreadsHandler *handler = threadsHandler();
|
||||||
|
for (auto thread : threads) {
|
||||||
|
ThreadData threadData;
|
||||||
|
threadData.id = QString::number(thread.toObject().value("id").toInt());
|
||||||
|
threadData.name = thread.toObject().value("name").toString();
|
||||||
|
handler->updateThread(threadData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_currentThreadId)
|
||||||
|
handler->setCurrentThread(
|
||||||
|
threadsHandler()->threadForId(QString::number(m_currentThreadId)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == "event") {
|
if (type == "event") {
|
||||||
@@ -682,12 +717,8 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == "initialized") {
|
|
||||||
showMessage(event, LogDebug);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event == "stopped") {
|
if (event == "stopped") {
|
||||||
|
ThreadsHandler *handler = threadsHandler();
|
||||||
m_currentThreadId = body.value("threadId").toInt();
|
m_currentThreadId = body.value("threadId").toInt();
|
||||||
showMessage(event, LogDebug);
|
showMessage(event, LogDebug);
|
||||||
if (body.value("reason").toString() == "breakpoint") {
|
if (body.value("reason").toString() == "breakpoint") {
|
||||||
@@ -707,10 +738,13 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
else
|
else
|
||||||
notifyInferiorSpontaneousStop();
|
notifyInferiorSpontaneousStop();
|
||||||
|
threads();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event == "thread") {
|
if (event == "thread") {
|
||||||
|
threads();
|
||||||
|
|
||||||
showMessage(event, LogDebug);
|
showMessage(event, LogDebug);
|
||||||
if (body.value("reason").toString() == "started" && body.value("threadId").toInt() == 1)
|
if (body.value("reason").toString() == "started" && body.value("threadId").toInt() == 1)
|
||||||
claimInitialBreakpoints();
|
claimInitialBreakpoints();
|
||||||
|
@@ -83,6 +83,7 @@ private:
|
|||||||
void handleDabConfigurationDone();
|
void handleDabConfigurationDone();
|
||||||
|
|
||||||
void dabStackTrace();
|
void dabStackTrace();
|
||||||
|
void threads();
|
||||||
|
|
||||||
void handleDapDone();
|
void handleDapDone();
|
||||||
void readDapStandardOutput();
|
void readDapStandardOutput();
|
||||||
|
Reference in New Issue
Block a user