diff --git a/view/sharedcache/CMakeLists.txt b/view/sharedcache/CMakeLists.txt index 63ba602bf4..0f6abea22c 100644 --- a/view/sharedcache/CMakeLists.txt +++ b/view/sharedcache/CMakeLists.txt @@ -30,7 +30,7 @@ endif() set(HARD_FAIL_MODE OFF CACHE BOOL "Enable hard fail mode") set(SLIDEINFO_DEBUG_TAGS OFF CACHE BOOL "Enable debug tags in slideinfo") set(VIEW_NAME "DSCView" CACHE STRING "Name of the view") -set(METADATA_VERSION 2 CACHE STRING "Version of the metadata") +set(METADATA_VERSION 3 CACHE STRING "Version of the metadata") add_subdirectory(core) add_subdirectory(api) diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index 81b5053a0c..e4d4ef11f3 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -3386,6 +3386,27 @@ void SharedCache::Store(SerializationContext& context) const } context.writer.EndArray(); + Serialize(context, "symbolInfos"); + context.writer.StartArray(); + for (const auto& pair1 : State().symbolInfos) + { + context.writer.StartObject(); + Serialize(context, "key", pair1.first); + Serialize(context, "value"); + context.writer.StartArray(); + for (const auto& pair2 : pair1.second) + { + context.writer.StartObject(); + Serialize(context, "key", pair2.first); + Serialize(context, "val1", pair2.second.first); + Serialize(context, "val2", pair2.second.second); + context.writer.EndObject(); + } + context.writer.EndArray(); + context.writer.EndObject(); + } + context.writer.EndArray(); + Serialize(context, "backingCaches", State().backingCaches); Serialize(context, "stubIslands", State().stubIslandRegions); Serialize(context, "images", State().images); @@ -3441,13 +3462,14 @@ void SharedCache::Load(DeserializationContext& context) for (auto& symbolInfo : context.doc["symbolInfos"].GetArray()) { - std::vector>> symbolInfoVec; - for (auto& symbolInfoPair : symbolInfo.GetArray()) + std::vector>> + symbolInfos; + for (auto& si : symbolInfo["value"].GetArray()) { - symbolInfoVec.push_back({symbolInfoPair[0].GetUint64(), - {(BNSymbolType)symbolInfoPair[1].GetUint(), symbolInfoPair[2].GetString()}}); + symbolInfos.push_back({si["key"].GetUint64(), + {static_cast(si["val1"].GetUint64()), si["val2"].GetString()}}); } - MutableState().symbolInfos[symbolInfo[0].GetUint64()] = std::move(symbolInfoVec); + MutableState().symbolInfos[symbolInfo["key"].GetUint64()] = std::move(symbolInfos); } for (auto& bcV : context.doc["backingCaches"].GetArray())