From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31394 invoked by alias); 24 Mar 2010 20:33:04 -0000 Received: (qmail 31375 invoked by uid 22791); 24 Mar 2010 20:33:03 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS 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, 24 Mar 2010 20:32:58 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2OKWutX012066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Mar 2010 16:32:56 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2OKWrTM005240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Mar 2010 16:32:56 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o2OKWr6l017515; Wed, 24 Mar 2010 21:32:53 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o2OKWqmT017514; Wed, 24 Mar 2010 21:32:52 +0100 Date: Wed, 24 Mar 2010 20:33:00 -0000 From: Jan Kratochvil To: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [patch] Fix separate-debug with non-unique section names (PR 11409) Message-ID: <20100324203252.GA17319@host0.dyn.jankratochvil.net> References: <20100323205655.GA12124@host0.dyn.jankratochvil.net> <20100324200943.GA12225@host0.dyn.jankratochvil.net> <20100324201825.GA31992@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100324201825.GA31992@caradoc.them.org> User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-03/txt/msg00819.txt.bz2 On Wed, 24 Mar 2010 21:18:31 +0100, Daniel Jacobowitz wrote: > On Wed, Mar 24, 2010 at 09:09:43PM +0100, Jan Kratochvil wrote: > > While the algorithm could be much more clever - if we ever need to resync at > > the point of non-unique section names the files are too different it makes no > > sence to try to match them by addr_info_make_relative at all. > > What if we assume that in a valid separate debug file, the only > sections that will be different will have been totally stripped from > either the before or after file? > > IOW: > > i = 0 // index in main file > j = 0 // index in separate file > for each section in main file: > if (section names match) > good > else if (section i's name is not present in separate file) > i++, continue > else if (section j's name is not present in separate file) or main? > j++, continue > else > complain that the two files do not match > > ? .dynstr is present in both files and on different places from my real prelinked /bin/bash example. #! /usr/bin/perl use strict; use warnings; my @main=qw(.interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .gnu.liblist .gnu.conflict .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .ctors .dtors .jcr .dynamic .got .got.plt .data .dynbss .bss .dynstr .gnu_debuglink .gnu.prelink_undo .shstrtab); my @debug=qw(.interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .ctors .dtors .jcr .dynamic .got .got.plt .data .bss .comment .debug_aranges .debug_pubnames .debug_info .debug_abbrev .debug_line .debug_str .debug_loc .debug_pubtypes .debug_ranges .shstrtab .symtab .strtab); my $i = 0; # index in main file my $j = 0; # index in separate file while ($i < @main || $j < @debug) { $i++,$j++,next if $main[$i] eq $debug[$j]; # section i's name is not present in separate file $i++,next if !grep /^\Q$main[$i]\E$/,@debug; # section j's name is not present in separate file $j++,next if !grep /^\Q$debug[$j]\E$/,@debug; die "complain that the two files do not match: $i=$main[$i] $j=$debug[$j]\n"; } print "OK\n"; -> complain that the two files do not match: 7=.gnu.version 5=.dynstr Not sure how this algorithm could be improved to cope with it. Thanks, Jan