From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix separate-debug with non-unique section names (PR 11409)
Date: Wed, 24 Mar 2010 20:09:00 -0000 [thread overview]
Message-ID: <20100324200943.GA12225@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <m339zpk0gg.fsf@fleche.redhat.com>
On Wed, 24 Mar 2010 20:02:07 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> gdb-7.1 is now broken for example for debugging /usr/bin/emacs due to:
> Jan> http://sourceware.org/bugzilla/show_bug.cgi?id=11409
> Jan> [22] .data PROGBITS 00000000007fe8a0 1fe8a0 215068 00 WA 0 0 32
> Jan> [23] .data PROGBITS 0000000000a13920 413920 68c6e0 00 WA 0 0 32
>
> Jan> 2010-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
> Jan> * symfile.c (addr_info_make_relative): Move sect declaration to the
> Jan> outer block. Initialize it to NULL. Prefer SECT->next more than
> Jan> bfd_get_section_by_name.
>
> This patch seems to assume that all sections of the same name will be
> next to each other in the section_addr_info. Why is it ok to make this
> assumption?
The code generally assumes the sections in .debug file are in the same order
as in the main file. Only if there is some discrepancy it will resync by
bfd_get_section_by_name. The resync should not normally happen. Attached an
illustrative /bin/bash -> /usr/lib/debug/bin/bash.debug section diff. The
only resynchronizations happen there on system part of sections - and these
have unique name.
The problem is I do not know how to match sections main<->.debug file when
their name is not unique. One could check VMAs but - to find the difference
of VMAs is the goal of this function.
Assuming for executables + shared libraries there are never many sections
there. This emacs .data section duplicity is more an exception. The only
cases with many (thousands of) sections I am aware of are object files but
object files should get into addr_info_make_relative at all (I hope the Mach-O
support does not use it for the .o symbols loading).
ld --split-by-file=1 creates section names like .text.0 ... .text.1454 all
unique; by bfd_get_unique_section_name.
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.
I may have forgot about this case, not sure, but I do not find it a problem.
Thanks,
Jan
-------------------
.interp
.note.ABI-tag
.note.gnu.build-id
.gnu.hash
.dynsym
-.gnu.liblist
-.gnu.conflict
+.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
-.dynbss
.bss
-.dynstr
-.gnu_debuglink
-.gnu.prelink_undo
+.comment
+.debug_aranges
+.debug_pubnames
+.debug_info
+.debug_abbrev
+.debug_line
+.debug_str
+.debug_loc
+.debug_pubtypes
+.debug_ranges
.shstrtab
+.symtab
+.strtab
next prev parent reply other threads:[~2010-03-24 20:09 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 [this message]
2010-03-24 20:18 ` Daniel Jacobowitz
2010-03-24 20:33 ` Jan Kratochvil
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=20100324200943.GA12225@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