This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix handling of .gdb_index version 7 symbols w/o attributes


Hi.

.gdb_index version 7 has support for symbol attributes, but the producers
aren't required to generate them.  E.g. gold may omit them.

This patches fixes gdb's handling of this case.
I'm committing this.
Regression tested on amd64-linux w/ cc-with-tweaks.sh -i.

2012-09-11  Doug Evans  <dje@google.com>

	* dwarf2read.c (dw2_do_expand_symtabs_matching): Don't examine
	.gdb_index symbol attributes if there are none.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.702
diff -u -p -r1.702 dwarf2read.c
--- dwarf2read.c	27 Aug 2012 16:37:45 -0000	1.702
+++ dwarf2read.c	11 Sep 2012 21:45:09 -0000
@@ -3133,15 +3133,21 @@ dw2_do_expand_symtabs_matching (struct o
 	      int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
 	      gdb_index_symbol_kind symbol_kind =
 		GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
+	      /* Only check the symbol attributes if they're present.
+		 Indices prior to version 7 don't record them,
+		 and indices >= 7 may elide them for certain symbols
+		 (gold does this).  */
+	      int attrs_valid =
+		(index->version >= 7
+		 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
 
-	      if (want_specific_block
-		  && index->version >= 7
+	      if (attrs_valid
+		  && want_specific_block
 		  && want_static != is_static)
 		continue;
 
-	      /* Only check the symbol's kind if it has one.
-		 Indices prior to version 7 don't record it.  */
-	      if (index->version >= 7)
+	      /* Only check the symbol's kind if it has one.  */
+	      if (attrs_valid)
 		{
 		  switch (domain)
 		    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]