Debugger: Make updateThreads() a setThreads()

(and keep updateThread() for the single-thread case)

All backends create full lists, making that explicit allows to
simplify the interface.

Change-Id: I717cfcf3ec9f8e81df8a5dfc71ae84855bc3beae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-08-30 11:52:37 +02:00
parent 7125f6853d
commit 06f3d2bf10
5 changed files with 11 additions and 18 deletions

View File

@@ -282,12 +282,6 @@ Thread ThreadsHandler::currentThread() const
return m_currentThread;
}
Thread ThreadsHandler::threadAt(int index) const
{
QTC_ASSERT(index >= 0 && index < rootItem()->childCount(), return Thread());
return rootItem()->childAt(index);
}
void ThreadsHandler::setCurrentThread(const Thread &thread)
{
if (thread == m_currentThread)
@@ -368,8 +362,10 @@ void ThreadsHandler::notifyStopped(const QString &id)
thread->notifyStopped();
}
void ThreadsHandler::updateThreads(const GdbMi &data)
void ThreadsHandler::setThreads(const GdbMi &data)
{
rootItem()->removeChildren();
// ^done,threads=[{id="1",target-id="Thread 0xb7fdc710 (LWP 4264)",
// frame={level="0",addr="0x080530bf",func="testQString",args=[],
// file="/.../app.cpp",fullname="/../app.cpp",line="1175"},
@@ -396,6 +392,9 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
const QString &currentId = data["current-thread-id"].data();
m_currentThread = threadForId(currentId);
if (!m_currentThread && !items.isEmpty())
m_currentThread = rootItem()->childAt(0);
}
QAbstractItemModel *ThreadsHandler::model()