From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30481 invoked by alias); 22 Jul 2004 20:46:35 -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 30457 invoked from network); 22 Jul 2004 20:46:31 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.77.109) by sourceware.org with SMTP; 22 Jul 2004 20:46:31 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i6MKjkPL000398; Thu, 22 Jul 2004 22:45:46 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i6MKjkAA003281; Thu, 22 Jul 2004 22:45:46 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i6MKjk1T003278; Thu, 22 Jul 2004 22:45:46 +0200 (CEST) Date: Thu, 22 Jul 2004 20:46:00 -0000 Message-Id: <200407222045.i6MKjk1T003278@elgar.kettenis.dyndns.org> From: Mark Kettenis To: drow@false.org CC: kevinb@redhat.com, gdb-patches@sources.redhat.com, hunt@redhat.com In-reply-to: <20040722004621.GA27215@nevyn.them.org> (message from Daniel Jacobowitz on Wed, 21 Jul 2004 20:46:21 -0400) Subject: Re: [RFA] dwarf2-frame.c sign extension patch 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> X-SW-Source: 2004-07/txt/msg00313.txt.bz2 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;