1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

LibDebug: Tolerate missing debug information

We previously crashed when programs were missing certain debug information.
This commit is contained in:
Itamar 2020-05-23 14:55:39 +03:00 committed by Andreas Kling
parent 58480a510f
commit 2686957836
2 changed files with 11 additions and 3 deletions

View file

@ -41,12 +41,15 @@ DwarfInfo::DwarfInfo(NonnullRefPtr<const ELF::Loader> elf)
ByteBuffer DwarfInfo::section_data(const String& section_name)
{
auto section = m_elf->image().lookup_section(section_name);
ASSERT(!section.is_undefined());
if (section.is_undefined())
return {};
return section.wrapping_byte_buffer();
}
void DwarfInfo::populate_compilation_units()
{
if (m_debug_info_data.is_null())
return;
// We have to const_cast here because there isn't a version of
// BufferStream that accepts a const ByteStream
// We take care not to use BufferStream operations that modify the underlying buffer