This is the mail archive of the
mailing list for the GDB project.
Re: Overlay handling bug in pc_in_unmapped_range for BSS sections?
- From: Doug Evans <dje at google dot com>
- To: David Stubbs <dstubbs at nvidia dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 17 Nov 2011 20:22:04 -0800
- Subject: Re: Overlay handling bug in pc_in_unmapped_range for BSS sections?
- References: <39736C87C7695A4F859B19B67A5081D738A00FCB16@DEMAIL01.nvidia.com>
On Thu, Oct 27, 2011 at 8:56 AM, David Stubbs <email@example.com> wrote:
> 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?
This doesn't feel correct to me.
This code is executed if section_is_overlay (section) returns true.
So I gather in your case it is returning true for .bss, right?
That's odd, I wouldn't expect that to happen.
Is your binary perchance linked wrong?
[Or is there a legit reason why lma != 0 && lma != vma for .bss in your binary?