From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17672 invoked by alias); 7 Mar 2012 17:10:30 -0000 Received: (qmail 17662 invoked by uid 22791); 7 Mar 2012 17:10:27 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_GD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Mar 2012 17:10:07 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q27H9jdp018674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 7 Mar 2012 12:09:45 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q27H9fBI023095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 7 Mar 2012 12:09:43 -0500 Date: Wed, 07 Mar 2012 17:10:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: [patch] Fix CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback] Message-ID: <20120307170940.GA22619@host2.jankratochvil.net> References: <20120305223429.GM2867@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120305223429.GM2867@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00227.txt.bz2 On Mon, 05 Mar 2012 23:34:29 +0100, Joel Brobecker wrote: > I tested the change, and lo and behold, on x86_64-linux, I get the > following fixes: > > * gdb.arch: > +------------+------------+----------------------------------------------------+ > | FAIL | PASS | amd64-entry-value.exp: entry: bt | I do not understand how it can happen. amd64-entry-value.exp uses precompiled amd64-entry-value.s (unless you use runtest COMPILE=1) and sure it fully PASSed+PASSes for me. There are more issues of this kind. I will re-review the patch later but it seems to me these fixes are needed. No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu and with -gdwarf-4 -fdebug-types-section. It looks as if some of the GDB features have never worked in real world - just in the testcase which have single CU. :-) Thanks, Jan 2012-03-07 Jan Kratochvil Fix CU relative vs. absolute DIE offsets. * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter offset to offset_in_cu. * dwarf2read.c (process_enumeration_scope): Add CU offset to TYPE_OFFSET. (dwarf2_fetch_die_location_block): Rename parameter offset to offset_in_cu. New variable offset, add CU offset to OFFSET_IN_CU. --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -61,7 +61,7 @@ const gdb_byte *dwarf2_find_location_expression CORE_ADDR pc); struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block - (unsigned int offset, struct dwarf2_per_cu_data *per_cu, + (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu, CORE_ADDR (*get_frame_pc) (void *baton), void *baton); --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -8031,7 +8031,8 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile, cu->per_cu->debug_types_section, cu->per_cu->offset); - if (type_sig->type_offset != die->offset) + if (type_sig->per_cu.offset + type_sig->type_offset + != die->offset) return; } @@ -14202,11 +14203,12 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr, dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE. */ struct dwarf2_locexpr_baton -dwarf2_fetch_die_location_block (unsigned int offset, +dwarf2_fetch_die_location_block (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu, CORE_ADDR (*get_frame_pc) (void *baton), void *baton) { + unsigned int offset = per_cu->offset + offset_in_cu; struct dwarf2_cu *cu; struct die_info *die; struct attribute *attr;