1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

LibELF: Add Symbol::is_undefined()

This commit is contained in:
Itamar 2021-01-06 21:44:47 +02:00 committed by Andreas Kling
parent f95f15e0bd
commit bb90d961b8
2 changed files with 3 additions and 0 deletions

View file

@ -312,6 +312,8 @@ Optional<Image::Symbol> Image::find_demangled_function(const String& name) const
for_each_symbol([&](const Image::Symbol symbol) { for_each_symbol([&](const Image::Symbol symbol) {
if (symbol.type() != STT_FUNC) if (symbol.type() != STT_FUNC)
return IterationDecision::Continue; return IterationDecision::Continue;
if (symbol.is_undefined())
return IterationDecision::Continue;
auto demangled = demangle(symbol.name()); auto demangled = demangle(symbol.name());
auto index_of_paren = demangled.index_of("("); auto index_of_paren = demangled.index_of("(");
if (index_of_paren.has_value()) { if (index_of_paren.has_value()) {

View file

@ -76,6 +76,7 @@ public:
unsigned type() const { return ELF32_ST_TYPE(m_sym.st_info); } unsigned type() const { return ELF32_ST_TYPE(m_sym.st_info); }
unsigned bind() const { return ELF32_ST_BIND(m_sym.st_info); } unsigned bind() const { return ELF32_ST_BIND(m_sym.st_info); }
const Section section() const { return m_image.section(section_index()); } const Section section() const { return m_image.section(section_index()); }
bool is_undefined() const { return section_index() == 0; }
StringView raw_data() const; StringView raw_data() const;
private: private: