mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +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:
parent
521217735b
commit
c4437e19bd
9 changed files with 23 additions and 14 deletions
|
@ -419,8 +419,9 @@ MmapRegion const* Emulator::load_library_from_adress(FlatPtr address)
|
|||
if (file_or_error.is_error())
|
||||
return {};
|
||||
|
||||
auto debug_info = make<Debug::DebugInfo>(make<ELF::Image>(file_or_error.value()->bytes()));
|
||||
m_dynamic_library_cache.set(lib_path, CachedELF { file_or_error.release_value(), move(debug_info) });
|
||||
auto image = make<ELF::Image>(file_or_error.value()->bytes());
|
||||
auto debug_info = make<Debug::DebugInfo>(*image);
|
||||
m_dynamic_library_cache.set(lib_path, CachedELF { file_or_error.release_value(), move(debug_info), move(image) });
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
|
|
@ -257,6 +257,7 @@ private:
|
|||
struct CachedELF {
|
||||
NonnullRefPtr<MappedFile> mapped_file;
|
||||
NonnullOwnPtr<Debug::DebugInfo> debug_info;
|
||||
NonnullOwnPtr<ELF::Image> image;
|
||||
};
|
||||
|
||||
HashMap<String, CachedELF> m_dynamic_library_cache;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue