LibDebug: Factor out the "looks like embedded resource" condition

This commit is contained in:
Tim Schumacher 2023-01-12 14:07:27 +01:00 committed by Jelle Raaijmakers
parent afc055c088
commit edd4913573
Notes: sideshowbarker 2024-07-17 07:20:57 +09:00
3 changed files with 8 additions and 1 deletions

View file

@ -65,7 +65,7 @@ void DwarfInfo::populate_compilation_units()
// Meaning that for graphical applications, some line info data would be unread, triggering the assertion below.
// As a fix, we don't create compilation units for line programs that come from resource files.
#if defined(AK_COMPILER_CLANG)
if (line_program->source_files().size() == 1 && line_program->source_files()[0].name.view().contains("serenity_icon_"sv)) {
if (line_program->looks_like_embedded_resource()) {
debug_info_stream.seek(unit_offset);
} else
#endif

View file

@ -306,4 +306,9 @@ LineProgram::DirectoryAndFile LineProgram::get_directory_and_file(size_t file_in
return { directory_entry, file_entry.name };
}
bool LineProgram::looks_like_embedded_resource() const
{
return source_files().size() == 1 && source_files()[0].name.view().contains("serenity_icon_"sv);
}
}

View file

@ -130,6 +130,8 @@ public:
};
Vector<FileEntry> const& source_files() const { return m_source_files; }
bool looks_like_embedded_resource() const;
private:
void parse_unit_header();
void parse_source_directories();