diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-08-06 00:35:36 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-06 01:14:03 +0200 |
commit | c4437e19bdb28af3dc45c973fa46b4be3e2ab3ee (patch) | |
tree | 8e6be344793d3dd1a5b67ca5ca3350c9b5526ec0 /Userland/DevTools/UserspaceEmulator | |
parent | 521217735bf436c22c9d6cda772b6cd4db46a1f6 (diff) | |
download | serenity-c4437e19bdb28af3dc45c973fa46b4be3e2ab3ee.zip |
LibDebug+Everywhere: Make DebugInfo not own the ELF image
This is required to avoid copying the image where otherwise a reference
would be enough.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 5 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 358a0605df..73daa6d6ff 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -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; } diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index 8b4e7da099..df6bf32dba 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -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; |