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]

Overlay handling bug in pc_in_unmapped_range for BSS sections?


Hi,

Our port of GDB was having trouble reading the _novlys symbol when in 'overlay auto' mode.

It turned out to be because it thought that the symbol was in an unmapped part of an overlay, so was trying to read it in from the executable file instead of via the RSP.

Our executable file had a large BSS overlay section preceding the section containing _novlys. symfile.c:pc_in_unmapped_range was returning 1 for the BSS section, which in this case wasn't the correct section.

The following patch seems to fix it:

--- symfile.c.orig	2011-10-26 16:37:38.000000000 +0100
+++ symfile.c	2011-10-26 16:37:17.000000000 +0100
@@ -2954,7 +2954,10 @@ pc_in_unmapped_range (CORE_ADDR pc, stru
       bfd_vma size = bfd_get_section_size (bfd_section);
       CORE_ADDR offset = obj_section_offset (section);
 
-      if (bfd_get_section_lma (abfd, bfd_section) + offset <= pc
+      /* If it's a BSS section then the address probably belongs to a section
+         after this one, and may not be in an overlay. */
+      if (bfd_section->contents 
+          && bfd_get_section_lma (abfd, bfd_section) + offset <= pc
 	  && pc < bfd_get_section_lma (abfd, bfd_section) + offset + size)
 	return 1;
     }

Does that look like the correct thing to do?

Thanks,
Dave.


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