[v2,03/30] Fix latent bug in DW_TAG_entry_point handling

Message ID 20240118-submit-domain-hacks-2-v2-3-aecab29fa104@tromey.com
State New
Headers
Series Restructure symbol domains |

Commit Message

Tom Tromey Jan. 18, 2024, 8:32 p.m. UTC
  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(+)
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b55b208ff4b..a4b8a855e24 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16526,6 +16526,13 @@  cooked_indexer::index_dies (cutu_reader *reader,
 				  info_ptr, abbrev, &name, &linkage_name,
 				  &flags, &sibling, &this_parent_entry,
 				  &defer, 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