From: Tristan Gingold <gingold@ACT-Europe.FR>
To: gdb-patches@sourceware.org
Cc: kevinb@redhat.com
Subject: [RFA] Fix has_section_at_zero for separate debug files
Date: Thu, 07 Jan 2010 13:09:00 -0000 [thread overview]
Message-ID: <20100107130918.GA11037@chinon.act-europe.fr> (raw)
Hi,
this patch reconsiders the approach taken in
http://sourceware.org/ml/gdb-patches/2009-06/msg00116.html
The new problem is that has_section_at_zero is now wrongly cleared. This
happens when the separate debug file is a relocatable file (such as on
Darwin) which may have a function at address 0. If its backlink (ie the
executable) has no section at 0 (which is the rule), one or more symbols
disappear in the symtab.
Because a separate debug file may be completely unrelated (in terms of
mapping) from its backlink, we shouldn't try to copy the has_section_at_zero.
Instead, we also consider SEC_ALLOC sections to set has_section_at_zero. This
makes sense because you may perfectly have the bss at zero.
No regression on GNU Linux i386.
I have also checked this patch which a tiny program having a section at 0
and run in qemu.
(I cc: Kevin Buettner, the author of the previous approach).
Tristan.
2010-01-07 Tristan Gingold <gingold@adacore.com>
* dwarf2read.c (dwarf2_locate_sections): Also consider SEC_ALLOC
sections to set has_section_at_zero.
(dwarf2_psymtab_to_symtab): Do not copy has_section_at_zero from
backlink for separate debug file.
---
gdb/dwarf2read.c | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 7623035..7dbe02f 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1258,7 +1258,7 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
dwarf2_per_objfile->types.size = bfd_get_section_size (sectp);
}
- if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
+ if ((bfd_get_section_flags (abfd, sectp) & (SEC_LOAD | SEC_ALLOC))
&& bfd_section_vma (abfd, sectp) == 0)
dwarf2_per_objfile->has_section_at_zero = 1;
}
@@ -2994,19 +2994,6 @@ dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
dwarf2_per_objfile = objfile_data (pst->objfile,
dwarf2_objfile_data_key);
- /* If this psymtab is constructed from a debug-only objfile, the
- has_section_at_zero flag will not necessarily be correct. We
- can get the correct value for this flag by looking at the data
- associated with the (presumably stripped) associated objfile. */
- if (pst->objfile->separate_debug_objfile_backlink)
- {
- struct dwarf2_per_objfile *dpo_backlink
- = objfile_data (pst->objfile->separate_debug_objfile_backlink,
- dwarf2_objfile_data_key);
- dwarf2_per_objfile->has_section_at_zero
- = dpo_backlink->has_section_at_zero;
- }
-
psymtab_to_symtab_1 (pst);
/* Finish up the debug error message. */
--
1.6.5.rc2
next reply other threads:[~2010-01-07 13:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-07 13:09 Tristan Gingold [this message]
2010-01-11 21:29 ` Tom Tromey
2010-01-12 5:01 ` Kevin Buettner
2010-01-12 8:56 ` Tristan Gingold
2010-04-19 20:27 ` Joel Brobecker
2010-01-12 8:55 ` Tristan Gingold
2010-04-28 22:40 ` Kevin Buettner
2010-05-05 18:43 ` Joel Brobecker
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=20100107130918.GA11037@chinon.act-europe.fr \
--to=gingold@act-europe.fr \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@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