MCPcopy Create free account
hub / github.com/Vector35/debugger / data

Method data

ui/threadframes.cpp:72–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72QVariant ThreadFrameModel::data(const QModelIndex& index, int role) const
73{
74 if (!index.isValid())
75 return QVariant();
76
77 if (role != Qt::DisplayRole && role != Qt::SizeHintRole)
78 return QVariant();
79
80 if (index.column() >= columnCount())
81 return QVariant();
82
83 FrameItem* item = static_cast<FrameItem*>(index.internalPointer());
84 if (!item)
85 return QVariant();
86
87 // do not use columns other than thread info & state for thread rows
88 if (!item->isFrame() && index.column() > ThreadFrameModel::ThreadColumn)
89 return QVariant();
90
91 switch (index.column())
92 {
93 case ThreadFrameModel::StateColumn:
94 {
95 if (item->isFrame())
96 return QVariant();
97
98 QString text = item->isFrozen() ? "Frozen" : "Unfrozen";
99 if (role == Qt::SizeHintRole)
100 return QVariant((qulonglong)text.size());
101
102 return QVariant(text);
103 }
104 case ThreadFrameModel::ThreadColumn:
105 {
106 if (item->isFrame())
107 return QVariant();
108
109 auto isActiveThread = m_controller->GetActiveThread().m_tid == item->tid();
110
111 QString text = QString::asprintf("%s0x%x @ 0x%" PRIx64, isActiveThread ? "(*) " : "", item->tid(), item->threadPc());
112 if (role == Qt::SizeHintRole)
113 return QVariant((qulonglong)text.size());
114
115 return QVariant(text);
116 }
117 case ThreadFrameModel::FrameIndexColumn:
118 {
119 QString text = QString::asprintf("%lu", item->frameIndex());
120 if (role == Qt::SizeHintRole)
121 return QVariant((qulonglong)text.size());
122
123 return QVariant(text);
124 }
125 case ThreadFrameModel::ModuleColumn:
126 {
127 QString text = QString::fromStdString(item->module());
128 if (role == Qt::SizeHintRole)
129 return QVariant((qulonglong)text.size());

Callers 2

paintMethod · 0.45
sizeHintMethod · 0.45

Calls 12

isFrameMethod · 0.80
isFrozenMethod · 0.80
sizeMethod · 0.80
tidMethod · 0.80
threadPcMethod · 0.80
frameIndexMethod · 0.80
moduleMethod · 0.80
functionMethod · 0.80
framePcMethod · 0.80
spMethod · 0.80
fpMethod · 0.80
GetActiveThreadMethod · 0.45

Tested by

no test coverage detected