From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] Fix separate-debug with non-unique section names (PR 11409)
Date: Wed, 24 Mar 2010 20:33:00 -0000 [thread overview]
Message-ID: <20100324203252.GA17319@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100324201825.GA31992@caradoc.them.org>
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
next prev parent reply other threads:[~2010-03-24 20:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 20:57 Jan Kratochvil
2010-03-24 19:02 ` Tom Tromey
2010-03-24 19:23 ` Mark Kettenis
2010-03-24 20:09 ` Jan Kratochvil
2010-03-24 20:18 ` Daniel Jacobowitz
2010-03-24 20:33 ` Jan Kratochvil [this message]
2010-03-24 20:37 ` Tom Tromey
2010-03-25 14:59 ` Jan Kratochvil
2010-03-25 20:00 ` Tom Tromey
2010-03-25 20:38 ` Jan Kratochvil
2010-04-21 20:03 ` Tom Tromey
2010-04-22 23:22 ` Jan Kratochvil
2010-03-24 20:43 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100324203252.GA17319@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox