1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +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

@ -35,7 +35,8 @@ ELFObjectInfo const* Backtrace::object_info_for_region(ELF::Core::MemoryRegionIn
return nullptr;
auto image = make<ELF::Image>(file_or_error.value()->bytes());
auto info = make<ELFObjectInfo>(file_or_error.release_value(), make<Debug::DebugInfo>(move(image)));
auto& image_reference = *image;
auto info = make<ELFObjectInfo>(file_or_error.release_value(), make<Debug::DebugInfo>(image_reference), move(image));
auto* info_ptr = info.ptr();
m_debug_info_cache.set(path, move(info));
return info_ptr;

View file

@ -14,14 +14,16 @@
namespace CoreDump {
struct ELFObjectInfo {
ELFObjectInfo(NonnullRefPtr<MappedFile> file, NonnullOwnPtr<Debug::DebugInfo>&& debug_info)
ELFObjectInfo(NonnullRefPtr<MappedFile> file, NonnullOwnPtr<Debug::DebugInfo>&& debug_info, NonnullOwnPtr<ELF::Image> image)
: file(move(file))
, debug_info(move(debug_info))
, image(move(image))
{
}
NonnullRefPtr<MappedFile> file;
NonnullOwnPtr<Debug::DebugInfo> debug_info;
NonnullOwnPtr<ELF::Image> image;
};
class Backtrace {