Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix has_section_at_zero for separate debug files
@ 2010-01-07 13:09 Tristan Gingold
  2010-01-11 21:29 ` Tom Tromey
  2010-04-28 22:40 ` Kevin Buettner
  0 siblings, 2 replies; 8+ messages in thread
From: Tristan Gingold @ 2010-01-07 13:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: kevinb

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-05-05 18:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 13:09 [RFA] Fix has_section_at_zero for separate debug files Tristan Gingold
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox