summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-12 14:07:27 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-19 11:29:29 +0100
commitedd49135732ac7e53edc18c5972a579f8f47dab3 (patch)
tree1bff3061b72dc786f7835fb2c385f31837ce2ecb
parentafc055c088d800b505e1dbdb68f7a0f1b5a6af59 (diff)
downloadserenity-edd49135732ac7e53edc18c5972a579f8f47dab3.zip
LibDebug: Factor out the "looks like embedded resource" condition
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp2
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp5
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/LineProgram.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
index 540e71e95a..67f941806c 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
+++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp
@@ -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
diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
index 55d339100d..698418d33a 100644
--- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
+++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp
@@ -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);
+}
+
}
diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
index 089a909895..a0d7038d25 100644
--- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
+++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
@@ -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();