public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cary Coutant <ccoutant@google.com>
To: Binutils <binutils@sourceware.org>
Cc: Doug Evans <dje@google.com>
Subject: [patch obvious] Fix bug in readelf --debug-dump=gdb_index
Date: Tue, 07 Jun 2011 23:39:00 -0000	[thread overview]
Message-ID: <BANLkTikWdfprSOwZ6TwY9jgWw0n8Jz8bRR2fQHhGWn1FqoYfnw@mail.gmail.com> (raw)

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

                 reply	other threads:[~2011-06-07 23:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTikWdfprSOwZ6TwY9jgWw0n8Jz8bRR2fQHhGWn1FqoYfnw@mail.gmail.com \
    --to=ccoutant@google.com \
    --cc=binutils@sourceware.org \
    --cc=dje@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).