Corrected regression from previous refactor where the data type and endianness of focused memory regions were not being persisted through debug sessions
This commit is contained in:
@@ -15,8 +15,25 @@ namespace Bloom
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
using Exceptions::Exception;
|
||||
|
||||
if (this->type != MemoryRegionType::FOCUSED) {
|
||||
throw Exceptions::Exception("Invalid memory region type");
|
||||
throw Exception("Invalid memory region type");
|
||||
}
|
||||
|
||||
if (!jsonObject.contains("dataType") || !jsonObject.contains("endianness")) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->dataType = FocusedMemoryRegion::regionDataTypesByName.at(jsonObject.find("dataType")->toString());
|
||||
this->endianness = FocusedMemoryRegion::regionEndiannessByName.at(jsonObject.find("endianness")->toString());
|
||||
}
|
||||
|
||||
QJsonObject FocusedMemoryRegion::toJson() const {
|
||||
auto jsonObject = MemoryRegion::toJson();
|
||||
jsonObject.insert("dataType", FocusedMemoryRegion::regionDataTypesByName.at(this->dataType));
|
||||
jsonObject.insert("endianness", FocusedMemoryRegion::regionEndiannessByName.at(this->endianness));
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
#include "src/Helpers/BiMap.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
@@ -27,5 +29,20 @@ namespace Bloom
|
||||
);
|
||||
|
||||
FocusedMemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionDataType, QString> regionDataTypesByName = {
|
||||
{MemoryRegionDataType::UNKNOWN, "other"},
|
||||
{MemoryRegionDataType::UNSIGNED_INTEGER, "unsigned_int"},
|
||||
{MemoryRegionDataType::SIGNED_INTEGER, "signed_int"},
|
||||
{MemoryRegionDataType::ASCII_STRING, "ascii_string"},
|
||||
};
|
||||
|
||||
static const inline BiMap<Targets::TargetMemoryEndianness, QString> regionEndiannessByName = {
|
||||
{Targets::TargetMemoryEndianness::LITTLE, "little"},
|
||||
{Targets::TargetMemoryEndianness::BIG, "big"},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user