mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:57:45 +00:00
LibELF: Remove sketchy use of "undefined" ELF::Image::Section
We were using ELF::Image::section(0) to indicate the "undefined" section, when what we really wanted was just Optional<Section>. So let's use Optional instead. :^)
This commit is contained in:
parent
f70d0f03de
commit
16221305ad
6 changed files with 18 additions and 19 deletions
|
@ -79,10 +79,10 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
|
|||
void DebugInfo::prepare_lines()
|
||||
{
|
||||
auto section = elf().lookup_section(".debug_line");
|
||||
if (section.is_undefined())
|
||||
if (!section.has_value())
|
||||
return;
|
||||
|
||||
InputMemoryStream stream { section.bytes() };
|
||||
InputMemoryStream stream { section->bytes() };
|
||||
|
||||
Vector<Dwarf::LineProgram::LineInfo> all_lines;
|
||||
while (!stream.eof()) {
|
||||
|
|
|
@ -24,9 +24,9 @@ DwarfInfo::DwarfInfo(const ELF::Image& elf)
|
|||
ReadonlyBytes DwarfInfo::section_data(const String& section_name) const
|
||||
{
|
||||
auto section = m_elf.lookup_section(section_name);
|
||||
if (section.is_undefined())
|
||||
if (!section.has_value())
|
||||
return {};
|
||||
return section.bytes();
|
||||
return section->bytes();
|
||||
}
|
||||
|
||||
void DwarfInfo::populate_compilation_units()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue