From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19934 invoked by alias); 17 Apr 2008 16:15:56 -0000 Received: (qmail 19926 invoked by uid 22791); 17 Apr 2008 16:15:55 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Apr 2008 16:15:29 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 86F5E983D6; Thu, 17 Apr 2008 16:15:27 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 50A83982C4; Thu, 17 Apr 2008 16:15:27 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JmWli-0006E8-M8; Thu, 17 Apr 2008 12:15:26 -0400 Date: Thu, 17 Apr 2008 16:24:00 -0000 From: Daniel Jacobowitz To: Craig Silverstein Cc: bauerman@br.ibm.com, gdb-patches@sourceware.org Subject: Re: Patch to handle compressed sections Message-ID: <20080417161526.GF17488@caradoc.them.org> Mail-Followup-To: Craig Silverstein , bauerman@br.ibm.com, gdb-patches@sourceware.org References: <1206547779.29533.43.camel@localhost.localdomain> <20080326173918.E6D063F25E8@localhost> <20080326180132.GB10127@caradoc.them.org> <20080326183538.346243F25E8@localhost> <20080401140953.GD12753@caradoc.them.org> <20080402000638.1BD1B3F25EF@localhost> <20080402001637.GA18178@caradoc.them.org> <20080403054128.A45A43F25F0@localhost> <20080403064309.5454D3F25F0@localhost> <20080414234559.A3AA03F23CF@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080414234559.A3AA03F23CF@localhost> User-Agent: Mutt/1.5.17 (2007-12-11) 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: 2008-04/txt/msg00343.txt.bz2 Just a general comment - I've been seeing a lot of gold patches lately where gold doesn't have a certain piece of data available at a certain point... that seems like a really underwhelming reason to use a big endian size in an otherwise little endian file. But as I said earlier, the choice of header format is pretty arbitrary, and anyone prepared to read DWARF ought to be able to cope with a simple big endian integer! So that's fine. On Mon, Apr 14, 2008 at 04:45:59PM -0700, Craig Silverstein wrote: > +/* When loading sections, we can either look for ".", or for > + * ".z", which indicates a compressed section. */ > + > +static int > +section_is_p(asection *sectp, const char *name) Space before parenthesis. > + /* Read the zlib header. In this case, it should be "ZLIB" followed > + by the uncompressed section size, 8 bytes in big-endian order. */ > + if (compressed_size < header_size > + || strncmp (compressed_buffer, "ZLIB", 4) != 0) > + error (_("Dwarf Error: Corrupt DWARF ZLIB header from '%s'"), > + bfd_get_filename (abfd)); > + uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; > + uncompressed_size += compressed_buffer[11]; You can use bfd_getb64. > buf = obstack_alloc (&objfile->objfile_obstack, size); > + /* When debugging .o files, we may need to apply relocations; see > + http://www.cygwin.com/ml/gdb-patches/2002-04/msg00136.html . > + We never compress sections in .o files, so we only need to > + try this when the section is not compressed. */ Use the sourceware.org URL instead, please. Actually, it'd make me happy if you couldn't get at these archives via cygwin.com. It confuses search results... Aside from that, this is fine to commit. Do you have write access? If not, request it using the sourceware form - if you have write access to binutils then you already do. Then add yourself to write after approval in MAINTAINERS and check in the final patch. The other things needed for this feature are, IMO: - A NEWS entry. - An entry in the manual. I'm not sure where, but the format of the sections should probably be described in the GDB manual somewhere. - An addition to the "Requirements" section of the GDB manual, explaining why you should have zlib. Could you follow up with those, please? The other thing I very much want is an objcopy option to compress DWARF sections, but that's clearly beyond the call of duty. That will let GNU ld users take advantage of this and is probably easier than teaching GNU ld to compress .debug_info (though that would be nice, too). Other tools that would benefit from reading such sections include readelf and addr2line (bfd/dwarf2.c). -- Daniel Jacobowitz CodeSourcery