This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed/darwin]: Set section size of dsymfile bfd


Hi,

contrary to ELF .gnu_debuglink files, the section size of dsymfile are set to 0 (because there is no
notion of filesize vs memsize in a section).  As a consequence no obj_section was created for these sections
and there was no offset for them.  But offsets are required for shared libraries.

This patch simply copy section size from the bfd to the dsym bfd.

Tristan.

2009-12-14  Tristan Gingold  <gingold@adacore.com>

	* machoread.c (macho_symfile_read): Set section size of dsym bfd
	from main bfd.
---
 gdb/machoread.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/gdb/machoread.c b/gdb/machoread.c
index 0194ee5..12fefaf 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -626,6 +626,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
 	{
 	  int ix;
 	  oso_el *oso;
+          struct bfd_section *asect, *dsect;
 
 	  if (mach_o_debug_level > 0)
 	    printf_unfiltered (_("dsym file found\n"));
@@ -639,6 +640,17 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
 	  VEC_free (oso_el, oso_vector);
 	  oso_vector = NULL;
 
+          /* Set dsym section size.  */
+          for (asect = objfile->obfd->sections, dsect = dsym_bfd->sections;
+               asect && dsect;
+               asect = asect->next, dsect = dsect->next)
+            {
+              if (strcmp (asect->name, dsect->name) != 0)
+                break;
+              bfd_set_section_size (dsym_bfd, dsect,
+                                    bfd_get_section_size (asect));
+            }
+
 	  /* Add the dsym file as a separate file.  */
           symbol_file_add_separate (dsym_bfd, symfile_flags, objfile);
       
-- 
1.6.2



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]