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]

Re: Overlay handling bug in pc_in_unmapped_range for BSS sections?


On Thu, Oct 27, 2011 at 8:56 AM, David Stubbs <dstubbs@nvidia.com> wrote:
> 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?

Hi.
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?
See section_is_overlay.]


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