From 17841991c3144991e942c6cec8f21527b8cdb51f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 18 Jan 2024 13:27:02 -0700 Subject: [PATCH] Fix latent bug in DW_TAG_entry_point handling A DW_TAG_entry_point symbol inherits its extern/static property from the enclosing subroutine. This is encoded in new_symbol -- but the cooked indexer does not agree. --- gdb/dwarf2/read.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4ac8f346cc9..1cc19b57ba8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16448,6 +16448,13 @@ cooked_indexer::index_dies (cutu_reader *reader, info_ptr, abbrev, &name, &linkage_name, &flags, &sibling, &this_parent_entry, &defer, &is_enum_class, false); + /* A DW_TAG_entry_point inherits its static/extern property from + the enclosing subroutine. */ + if (abbrev->tag == DW_TAG_entry_point) + { + flags &= ~IS_STATIC; + flags |= parent_entry->flags & IS_STATIC; + } if (abbrev->tag == DW_TAG_namespace && m_language == language_cplus -- 2.47.2