MCPcopy Create free account
hub / github.com/KDE/kdevelop / handleThreadInfo

Method handleThreadInfo

plugins/debuggercommon/miframestackmodel.cpp:58–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void MIFrameStackModel::handleThreadInfo(const ResultRecord& r)
59{
60 const Value& threads = r[QStringLiteral("threads")];
61
62 QVector<FrameStackModel::ThreadItem> threadsList;
63 threadsList.reserve(threads.size());
64 for (int i = 0; i!= threads.size(); ++i) {
65 const auto &threadMI = threads[i];
66 FrameStackModel::ThreadItem threadItem;
67 threadItem.nr = threadMI[QStringLiteral("id")].toInt();
68 if (threadMI[QStringLiteral("state")].literal() == QLatin1String("stopped")) {
69 threadItem.name = getFunctionOrAddress(threadMI[QStringLiteral("frame")]);
70 } else {
71 threadItem.name = i18n("(running)");
72 }
73 threadsList << threadItem;
74 }
75 // Sort the list by id, some old version of GDB
76 // reports them in backward order. We want UI to
77 // show thread IDs in the natural order.
78 std::sort(threadsList.begin(), threadsList.end(),
79 [](const FrameStackModel::ThreadItem &a, const FrameStackModel::ThreadItem &b){
80 return a.nr < b.nr;
81 });
82
83 setThreads(threadsList);
84 if (r.hasField(QStringLiteral("current-thread-id"))) {
85 int currentThreadId = r[QStringLiteral("current-thread-id")].toInt();
86
87 setCurrentThread(currentThreadId);
88
89 if (session()->hasCrashed()) {
90 setCrashedThreadIndex(currentThreadId);
91 }
92 }
93}
94
95struct FrameListHandler : public MICommandHandler
96{

Callers

nothing calls this directly

Calls 10

sortFunction · 0.85
toIntMethod · 0.80
literalMethod · 0.80
hasFieldMethod · 0.80
hasCrashedMethod · 0.80
getFunctionOrAddressFunction · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected