From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26826 invoked by alias); 7 Jun 2011 23:39:54 -0000 Received: (qmail 26818 invoked by uid 22791); 7 Jun 2011 23:39:53 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 23:39:40 +0000 Received: from hpaq2.eem.corp.google.com (hpaq2.eem.corp.google.com [172.25.149.2]) by smtp-out.google.com with ESMTP id p57NddlL008531 for ; Tue, 7 Jun 2011 16:39:39 -0700 Received: from yib12 (yib12.prod.google.com [10.243.65.76]) by hpaq2.eem.corp.google.com with ESMTP id p57NdamT023155 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 7 Jun 2011 16:39:37 -0700 Received: by yib12 with SMTP id 12so2048yib.21 for ; Tue, 07 Jun 2011 16:39:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.55.32 with SMTP id d32mr5527666ana.42.1307489976525; Tue, 07 Jun 2011 16:39:36 -0700 (PDT) Received: by 10.100.131.8 with HTTP; Tue, 7 Jun 2011 16:39:36 -0700 (PDT) Date: Tue, 07 Jun 2011 23:39:00 -0000 Message-ID: Subject: [patch obvious] Fix bug in readelf --debug-dump=gdb_index From: Cary Coutant To: Binutils Cc: Doug Evans Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00073.txt.bz2 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 * 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); }