1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibDebug+Everywhere: Make DebugInfo not own the ELF image

This is required to avoid copying the image where otherwise a reference
would be enough.
This commit is contained in:
Ali Mohammad Pur 2021-08-06 00:35:36 +04:30 committed by Andreas Kling
parent 521217735b
commit c4437e19bd
9 changed files with 23 additions and 14 deletions

View file

@ -18,6 +18,7 @@ namespace Symbolication {
struct CachedELF {
NonnullRefPtr<MappedFile> mapped_file;
NonnullOwnPtr<Debug::DebugInfo> debug_info;
NonnullOwnPtr<ELF::Image> image;
};
static HashMap<String, OwnPtr<CachedELF>> s_cache;
@ -73,7 +74,7 @@ Optional<Symbol> symbolicate(String const& path, FlatPtr address)
s_cache.set(path, {});
{};
}
auto cached_elf = make<CachedELF>(mapped_file.release_value(), make<Debug::DebugInfo>(move(elf)));
auto cached_elf = make<CachedELF>(mapped_file.release_value(), make<Debug::DebugInfo>(*elf), move(elf));
s_cache.set(path, move(cached_elf));
}