From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: RFA: correctly detect overlapping overlays
Date: Sun, 12 Aug 2001 11:42:00 -0000 [thread overview]
Message-ID: <20010812184312.C90245E9DA@zwingli.cygnus.com> (raw)
Same here.
2001-08-12 Jim Blandy <jimb@redhat.com>
* symfile.c (sections_overlap): New function.
(map_overlay_command): Call sections_overlap, instead of using
incorrect logic to recognize overlapping sections.
Index: gdb/symfile.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/symfile.c,v
retrieving revision 1.237
diff -c -r1.237 symfile.c
*** gdb/symfile.c 2001/06/14 21:03:18 1.237
--- gdb/symfile.c 2001/08/12 17:28:35
***************
*** 2486,2491 ****
--- 2486,2492 ----
section_is_overlay(sect): true if section's VMA != LMA
pc_in_mapped_range(pc,sec): true if pc belongs to section's VMA
pc_in_unmapped_range(...): true if pc belongs to section's LMA
+ sections_overlap(sec1, sec2): true if mapped sec1 and sec2 ranges overlap
overlay_mapped_address(...): map an address from section's LMA to VMA
overlay_unmapped_address(...): map an address from section's VMA to LMA
symbol_overlayed_address(...): Return a "current" address for symbol:
***************
*** 2625,2630 ****
--- 2626,2645 ----
return 0;
}
+
+ /* Return true if the mapped ranges of sections A and B overlap, false
+ otherwise. */
+ int
+ sections_overlap (asection *a, asection *b)
+ {
+ CORE_ADDR a_start = a->vma;
+ CORE_ADDR a_end = a->vma + bfd_get_section_size_before_reloc (a);
+ CORE_ADDR b_start = b->vma;
+ CORE_ADDR b_end = b->vma + bfd_get_section_size_before_reloc (b);
+
+ return (a_start < b_end && b_start < a_end);
+ }
+
/* Function: overlay_unmapped_address (PC, SECTION)
Returns the address corresponding to PC in the unmapped (load) range.
May be the same as PC. */
***************
*** 2803,2813 ****
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
ALL_OBJSECTIONS (objfile2, sec2)
! if (sec2->ovly_mapped &&
! sec != sec2 &&
! sec->the_bfd_section != sec2->the_bfd_section &&
! (pc_in_mapped_range (sec2->addr, sec->the_bfd_section) ||
! pc_in_mapped_range (sec2->endaddr, sec->the_bfd_section)))
{
if (info_verbose)
printf_filtered ("Note: section %s unmapped by overlap\n",
--- 2818,2828 ----
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
ALL_OBJSECTIONS (objfile2, sec2)
! if (sec2->ovly_mapped
! && sec != sec2
! && sec->the_bfd_section != sec2->the_bfd_section
! && sections_overlap (sec->the_bfd_section,
! sec2->the_bfd_section))
{
if (info_verbose)
printf_filtered ("Note: section %s unmapped by overlap\n",
next reply other threads:[~2001-08-12 11:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-12 11:42 Jim Blandy [this message]
2001-08-12 19:13 ` Andrew Cagney
2001-08-13 7:39 ` Jim Blandy
2001-08-13 9:07 ` Andrew Cagney
2001-08-13 11:25 ` Michael Snyder
2001-08-24 10:44 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010812184312.C90245E9DA@zwingli.cygnus.com \
--to=jimb@zwingli.cygnus.com \
--cc=gdb-patches@sources.redhat.com \
--cc=msnyder@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox