From fa85bf28502286c4821427c5d0ed91a7ed46f8f6 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 7 Mar 2025 21:36:46 -0500 Subject: [SharedCache] Use DefineAutoUserSymbol instead of DefineAutoSymbol This makes it so that we persist the symbols within the regular symbol list in storage --- view/sharedcache/core/SharedCache.cpp | 62 ++--------------------------------- 1 file changed, 3 insertions(+), 59 deletions(-) (limited to 'view/sharedcache/core/SharedCache.cpp') diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index 4c8c355d..27367a45 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -2362,14 +2362,15 @@ void SharedCache::ApplySymbol(Ref view, Ref typeLib, Re if (typeLib) { auto type = m_dscView->ImportTypeLibraryObject(typeLib, {symbol->GetFullName()}); + // TODO: This is still auto if (type) view->DefineAutoSymbolAndVariableOrFunction(view->GetDefaultPlatform(), symbol, type); else - view->DefineAutoSymbol(symbol); + view->DefineAutoUserSymbol(symbol); } else { - view->DefineAutoSymbol(symbol); + view->DefineAutoUserSymbol(symbol); } if (!func) @@ -3274,59 +3275,6 @@ void Serialize(SerializationContext& context, const std::shared_ptr>>>& value) -{ - auto array = context.doc[name.data()].GetArray(); - for (auto& pair : array) - { - auto symbols_array = pair[1].GetArray(); - std::unordered_map> symbols; - for (auto& symbol_value : symbols_array) - { - auto symbol_array = symbol_value.GetArray(); - std::string symbolName = symbol_array[0].GetString(); - uint64_t address = symbol_array[1].GetUint64(); - BNSymbolType type = (BNSymbolType)symbol_array[2].GetUint(); - - QualifiedName demangledName = {}; - std::string shortName = symbolName; - if (DemangleLLVM(symbolName, demangledName, true)) - shortName = demangledName.GetString(); - Ref sym = new Symbol(type, shortName, shortName, symbolName, address, nullptr); - symbols.insert({address, sym}); - } - value[pair[0].GetUint64()] = std::make_shared>>(std::move(symbols)); - } -} - -void Deserialize(DeserializationContext& context, std::string_view name, - std::unordered_map>>>& value) -{ - auto array = context.doc[name.data()].GetArray(); - for (auto& pair : array) - { - auto symbols_array = pair[1].GetArray(); - std::vector> symbols; - symbols.reserve(symbols_array.Size()); - for (auto& symbol_value : symbols_array) - { - auto symbol_array = symbol_value.GetArray(); - std::string symbolName = symbol_array[0].GetString(); - uint64_t address = symbol_array[1].GetUint64(); - BNSymbolType type = (BNSymbolType)symbol_array[2].GetUint(); - - QualifiedName demangledName = {}; - std::string shortName = symbolName; - if (DemangleLLVM(symbolName, demangledName, true)) - shortName = demangledName.GetString(); - Ref sym = new Symbol(type, shortName, shortName, symbolName, address, nullptr); - symbols.emplace_back(sym); - } - value[pair[0].GetUint64()] = std::make_shared>>(std::move(symbols)); - } -} - void Deserialize(DeserializationContext& context, std::string_view name, std::optional& viewState) { auto& value = context.doc[name.data()]; @@ -3399,8 +3347,6 @@ std::optional SharedCache::CacheInfo::Load(Deserializati void State::Store(SerializationContext& context, std::optional viewState) const { MSS(memoryRegionStatus); - MSS(exportInfos); - MSS(symbolInfos); MSS(viewState); } @@ -3413,8 +3359,6 @@ SharedCache::ModifiedState SharedCache::ModifiedState::Load(DeserializationConte { SharedCache::ModifiedState state; state.MSL(memoryRegionStatus); - state.MSL(exportInfos); - state.MSL(symbolInfos); state.MSL(viewState); return state; } -- cgit v1.3.1