This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[patch obvious] Fix bug in readelf --debug-dump=gdb_index


I'm checking in the following obvious fix to binutils/dwarf.c. When
converting an index that refers to a type unit (TU), the code didn't
take into account that "cu_list_elements" is 2x the number of entries
in the CU list.

-cary


binutils/ChangeLog:

2011-06-07  Cary Coutant  <ccoutant@google.com>

	* dwarf.c: Fix conversion to TU number.


Index: dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.94
diff -u -p -r1.94 dwarf.c
--- dwarf.c	25 May 2011 15:10:56 -0000	1.94
+++ dwarf.c	7 Jun 2011 23:30:55 -0000
@@ -5266,8 +5266,8 @@ display_gdb_index (struct dwarf_section
 	    {
 	      cu = byte_get_little_endian (constant_pool + cu_vector_offset
+ 4 + j * 4, 4);
 	      /* Convert to TU number if it's for a type unit.  */
-	      if (cu >= cu_list_elements)
-		printf (" T%lu", (unsigned long) (cu - cu_list_elements));
+	      if (cu >= cu_list_elements / 2)
+		printf (" T%lu", (unsigned long) (cu - cu_list_elements / 2));
 	      else
 		printf (" %lu", (unsigned long) cu);
 	    }


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