diff options
author | Itamar <itamar8910@gmail.com> | 2020-05-06 17:17:42 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-07 23:32:11 +0200 |
commit | 42b61cfe2c788704693cb1f550f8f80127884ea5 (patch) | |
tree | bb7096d7fa6644a104efe3e8a52df7eba3ab1e3d /Libraries/LibELF | |
parent | dca0483e9a0411e00573de2b00f8f06eafbcd11b (diff) | |
download | serenity-42b61cfe2c788704693cb1f550f8f80127884ea5.zip |
LibELF: Add Image::Section::wrapping_byte_buffer
This can be used to get a ByteBuffer that wrapps the section's data.
Diffstat (limited to 'Libraries/LibELF')
-rw-r--r-- | Libraries/LibELF/Image.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibELF/Image.h b/Libraries/LibELF/Image.h index a4e5497431..1f210544f4 100644 --- a/Libraries/LibELF/Image.h +++ b/Libraries/LibELF/Image.h @@ -26,6 +26,7 @@ #pragma once +#include <AK/ByteBuffer.h> #include <AK/HashMap.h> #include <AK/OwnPtr.h> #include <AK/String.h> @@ -131,6 +132,7 @@ public: unsigned entry_count() const { return !entry_size() ? 0 : size() / entry_size(); } u32 address() const { return m_section_header.sh_addr; } const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); } + ByteBuffer wrapping_byte_buffer() { return ByteBuffer::wrap(reinterpret_cast<const u8*>(raw_data()), size()); } bool is_undefined() const { return m_section_index == SHN_UNDEF; } const RelocationSection relocations() const; u32 flags() const { return m_section_header.sh_flags; } |