Changed addresses to hexadecimal, in the JSON response for the monitor target-info machine GDB command

This commit is contained in:
Nav
2022-05-29 23:17:56 +01:00
parent eaa34ef2af
commit 6f9ba1930d

View File

@@ -42,19 +42,19 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
{TargetMemoryType::EEPROM, QString("EEPROM")}, {TargetMemoryType::EEPROM, QString("EEPROM")},
}); });
auto memoryDescriptors = QJsonArray(); auto memoryDescriptorsJson = QJsonArray();
for (const auto& [memoryType, memoryDescriptor] : targetDescriptor.memoryDescriptorsByType) { for (const auto& [memoryType, memoryDescriptor] : targetDescriptor.memoryDescriptorsByType) {
if (!memoryTypeNamesByType.contains(memoryType)) { if (!memoryTypeNamesByType.contains(memoryType)) {
continue; continue;
} }
memoryDescriptors.push_back(QJsonObject({ memoryDescriptorsJson.push_back(QJsonObject({
{"name", memoryTypeNamesByType.at(memoryType)}, {"name", memoryTypeNamesByType.at(memoryType)},
{"size", static_cast<qint64>(memoryDescriptor.size())}, {"size", static_cast<qint64>(memoryDescriptor.size())},
{"addressRange", QJsonObject({ {"addressRange", QJsonObject({
{"startAddress", static_cast<qint64>(memoryDescriptor.addressRange.startAddress)}, {"startAddress", "0x" + QString::number(memoryDescriptor.addressRange.startAddress, 16)},
{"endAddress", static_cast<qint64>(memoryDescriptor.addressRange.endAddress)}, {"endAddress", "0x" + QString::number(memoryDescriptor.addressRange.endAddress, 16)},
})} })}
})); }));
} }
@@ -63,7 +63,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
{"target", QJsonObject({ {"target", QJsonObject({
{"name", QString::fromStdString(targetDescriptor.name)}, {"name", QString::fromStdString(targetDescriptor.name)},
{"id", QString::fromStdString(targetDescriptor.id)}, {"id", QString::fromStdString(targetDescriptor.id)},
{"memoryDescriptors", memoryDescriptors}, {"memoryDescriptors", memoryDescriptorsJson},
})}, })},
}); });
} }