From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31488 invoked by alias); 23 Jul 2004 17:54:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31340 invoked from network); 23 Jul 2004 17:54:17 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 23 Jul 2004 17:54:17 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6NHsHe1009545 for ; Fri, 23 Jul 2004 13:54:17 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6NHsHa24313; Fri, 23 Jul 2004 13:54:17 -0400 Received: from [172.16.50.80] (vpn50-80.rdu.redhat.com [172.16.50.80]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i6NHsD9a028654; Fri, 23 Jul 2004 13:54:14 -0400 Subject: Re: [RFA] dwarf2-frame.c sign extension patch From: "Martin M. Hunt" To: Mark Kettenis Cc: drow@false.org, Kevin Buettner , gdb-patches@sources.redhat.com In-Reply-To: <200407222045.i6MKjk1T003278@elgar.kettenis.dyndns.org> References: <1090350684.3030.10.camel@dragon> <200407212029.i6LKThsR022356@copland.kettenis.dyndns.org> <20040721211723.GA21338@nevyn.them.org> <20040721174136.7eb32412@saguaro> <20040722004621.GA27215@nevyn.them.org> <200407222045.i6MKjk1T003278@elgar.kettenis.dyndns.org> Content-Type: text/plain Organization: Red Hat Inc. Message-Id: <1090605248.3366.8.camel@dragon> Mime-Version: 1.0 Date: Fri, 23 Jul 2004 17:54:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00330.txt.bz2 Mark, Yes, I like your patch and it works fine. Please check it in. Martin On Thu, 2004-07-22 at 13:45, Mark Kettenis wrote: > Date: Wed, 21 Jul 2004 20:46:21 -0400 > From: Daniel Jacobowitz > > On Wed, Jul 21, 2004 at 05:41:36PM -0700, Kevin Buettner wrote: > > > Any use of bits_per_address, IMO, is a bug. Take a look at how this > > > field is set on MIPS; it's based on the architecture, not the ABI or > > > the pointer size or the dwarf address size or anything like that. > > > > I agree. > > > > > TYPE_LENGTH doesn't seem like an ideal replacement. Can we use the > > > value in the compilation unit header here? > > > > I considered doing this, but was told that the information in > > .debug_frame should be independent of the CU header. I really > > don't know what the "right" solution is. > > Oh, right, we're in .debug_frame here. I care very much about being > .able to use .debug_frame without .debug_info. Debian distributes > library images with only .debug_frame, to provide backtraces. > > Ah yes, the standard explicitly says that .debug_frame is > self-contained. > > .debug_frame doesn't provide this information. That's a known defect; > I think that Jim proposed correcting it on the dwarf2 list. > > Hmm, I'm starting to wonder why we set unit->addr_size at all. It's > only used in decode_frame_entry_1(). I suppose it makes sense to > cache this value, although I have no data to support that. > > Does anyone know if .eh_frame solves this problem somehow? > > In many cases it directly encodes the size of pointers. > > Otherwise, I think that using TYPE_LENGTH (with a big comment > explaining the issue) may be the best we can do. > > Actually, it would make things more symmetric if we'd use TYPE_LENGTH. > Even better, avoid the issue completely by initializing the CIE > encoding to DW_EH_PE_absptr. How about the attached patch? Does it > solve your problems Martin? > > Mark > > > Index: ChangeLog > from Mark Kettenis > > * dwarf2-frame.c (struct dwarf2_cie): Delete `addr_size' member. > (decode_frame_entry_1): Use DW_EH_PE_absptr as default for CIE > encoding. > (dwarf2_build_frame_info): Adjust for removal of `addr_size' > member of `struct comp_unit'. > > Index: dwarf2-frame.c > =================================================================== > RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v > retrieving revision 1.36 > diff -u -p -r1.36 dwarf2-frame.c > --- dwarf2-frame.c 15 Jun 2004 01:04:19 -0000 1.36 > +++ dwarf2-frame.c 22 Jul 2004 20:45:28 -0000 > @@ -890,9 +890,6 @@ struct comp_unit > /* Linked list of CIEs for this object. */ > struct dwarf2_cie *cie; > > - /* Address size for this unit - from unit header. */ > - unsigned char addr_size; > - > /* Pointer to the .debug_frame section loaded into memory. */ > char *dwarf_frame_buffer; > > @@ -1284,9 +1281,8 @@ decode_frame_entry_1 (struct comp_unit * > cie->cie_pointer = cie_pointer; > > /* The encoding for FDE's in a normal .debug_frame section > - depends on the target address size as specified in the > - Compilation Unit Header. */ > - cie->encoding = encoding_for_size (unit->addr_size); > + depends on the target address size. */ > + cie->encoding = DW_EH_PE_absptr; > > /* Check version number. */ > cie_version = read_1_byte (unit->abfd, buf); > @@ -1557,7 +1553,6 @@ dwarf2_build_frame_info (struct objfile > /* Build a minimal decoding of the DWARF2 compilation unit. */ > unit.abfd = objfile->obfd; > unit.objfile = objfile; > - unit.addr_size = objfile->obfd->arch_info->bits_per_address / 8; > unit.dbase = 0; > unit.tbase = 0; >