This is the mail archive of the
mailing list for the GDB project.
Overlay handling bug in pc_in_unmapped_range for BSS sections?
- From: David Stubbs <dstubbs at nvidia dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 27 Oct 2011 17:56:53 +0200
- Subject: Overlay handling bug in pc_in_unmapped_range for BSS sections?
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)
Does that look like the correct thing to do?