MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / generateDisplayString

Method generateDisplayString

pcsx2-qt/Debugger/SymbolTree/SymbolTreeNode.cpp:244–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244QString SymbolTreeNode::generateDisplayString(
245 const ccc::ast::Node& physical_type,
246 DebugInterface& cpu,
247 const ccc::SymbolDatabase& database,
248 const SymbolTreeDisplayOptions& display_options,
249 s32 depth) const
250{
251 s32 max_elements_to_display = 0;
252 switch (depth)
253 {
254 case 0:
255 max_elements_to_display = 8;
256 break;
257 case 1:
258 max_elements_to_display = 2;
259 break;
260 }
261
262 switch (physical_type.descriptor)
263 {
264 case ccc::ast::ARRAY:
265 {
266 const ccc::ast::Array& array = physical_type.as<ccc::ast::Array>();
267 const ccc::ast::Node& element_type = *array.element_type->physical_type(database).first;
268
269 if (element_type.name == "char" && location.type == SymbolTreeLocation::MEMORY)
270 {
271 char* string = cpu.stringFromPointer(location.address);
272 if (string)
273 return QString("\"%1\"").arg(string);
274 }
275
276 QString result;
277 result += "{";
278
279 s32 elements_to_display = std::min(array.element_count, max_elements_to_display);
280 for (s32 i = 0; i < elements_to_display; i++)
281 {
282 SymbolTreeNode node;
283 node.location = location.addOffset(i * array.element_type->size_bytes);
284
285 QString element = node.generateDisplayString(element_type, cpu, database, display_options, depth + 1);
286 if (element.isEmpty())
287 element = QString("(%1)").arg(ccc::ast::node_type_to_string(element_type));
288 result += element;
289
290 if (i + 1 != array.element_count)
291 result += ",";
292 }
293
294 if (elements_to_display != array.element_count)
295 result += "...";
296
297 result += "}";
298 return result;
299 }
300 case ccc::ast::BUILTIN:
301 {

Callers

nothing calls this directly

Calls 15

node_type_to_stringFunction · 0.85
physical_typeMethod · 0.80
stringFromPointerMethod · 0.80
argMethod · 0.80
addOffsetMethod · 0.80
read8Method · 0.80
signedIntegerToStringMethod · 0.80
read16Method · 0.80
read32Method · 0.80
read64Method · 0.80
flatten_fieldsMethod · 0.80

Tested by

no test coverage detected