mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibDebug: Don't create compilation units for embedded resources
Our implementation (naively) assumes that there is a one-to-one correspondence between compilation units and line programs, and that their orders are identical. This is not the case for embedded resources, as Clang only creates line programs for it, but not compilation units. This mismatch caused an assertion failure, which made generating backtraces for GUI applications impossible. This commit introduces a hack that skips creating CompilationUnit objects for LinePrograms that come from embedded resources.
This commit is contained in:
parent
622d408d82
commit
a60d960420
Notes:
sideshowbarker
2024-07-18 02:14:52 +09:00
Author: https://github.com/BertalanD
Commit: a60d960420
Pull-request: https://github.com/SerenityOS/serenity/pull/9378
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/itamar8910
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/nico
Reviewed-by: https://github.com/timschumi
2 changed files with 18 additions and 7 deletions
|
@ -57,8 +57,18 @@ void DwarfInfo::populate_compilation_units()
|
|||
|
||||
auto line_program = make<LineProgram>(*this, line_info_stream);
|
||||
|
||||
m_compilation_units.append(make<CompilationUnit>(*this, unit_offset, compilation_unit_header, move(line_program)));
|
||||
debug_info_stream.discard_or_error(length_after_header);
|
||||
// HACK: Clang generates line programs for embedded resource assembly files, but not compile 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.
|
||||
#ifdef __clang__
|
||||
if (line_program->source_files().size() == 1 && line_program->source_files()[0].name.view().contains("serenity_icon_"sv)) {
|
||||
debug_info_stream.seek(unit_offset);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
m_compilation_units.append(make<CompilationUnit>(*this, unit_offset, compilation_unit_header, move(line_program)));
|
||||
debug_info_stream.discard_or_error(length_after_header);
|
||||
}
|
||||
}
|
||||
|
||||
VERIFY(line_info_stream.eof());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue