public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch obvious] Fix bug in readelf --debug-dump=gdb_index
@ 2011-06-07 23:39 Cary Coutant
  0 siblings, 0 replies; only message in thread
From: Cary Coutant @ 2011-06-07 23:39 UTC (permalink / raw)
  To: Binutils; +Cc: Doug Evans

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);
 	    }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-07 23:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 23:39 [patch obvious] Fix bug in readelf --debug-dump=gdb_index Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).