summaryrefslogtreecommitdiff
path: root/gdb/blockframe.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-02-09 19:13:46 +0000
committerAndrew Cagney <cagney@redhat.com>2004-02-09 19:13:46 +0000
commit43b54b88e73a74b1505df5eb4de6d6885bd4c3b4 (patch)
treec9d7b39690363d30e7d6767a74c50cc9023aa7c5 /gdb/blockframe.c
parentf38069161116907b870668f979f81c8dc5bba0d9 (diff)
2004-02-09 Andrew Cagney <cagney@redhat.com>
* blockframe.c (find_pc_partial_function): If find_pc_overlay fails, try find_pc_section. Fix PR c++/1267. * minsyms.c (lookup_minimal_symbol_by_pc): Use find_pc_section instead of find_pc_mapped_section. (lookup_minimal_symbol_by_pc_section): If the SECTION is NULL, do not default to the section containing PC. Fix PR symtab/1519.
Diffstat (limited to 'gdb/blockframe.c')
-rw-r--r--gdb/blockframe.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 00d7d8f13e..409ec94615 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -507,10 +507,24 @@ int
find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
CORE_ADDR *endaddr)
{
- asection *section;
-
- section = find_pc_overlay (pc);
- return find_pc_sect_partial_function (pc, section, name, address, endaddr);
+ struct bfd_section *bfd_section;
+
+ /* To ensure that the symbol returned belongs to the correct setion
+ (and that the last [random] symbol from the previous section
+ isn't returned) try to find the section containing PC. First try
+ the overlay code (which by default returns NULL); and second try
+ the normal section code (which almost always succeeds). */
+ bfd_section = find_pc_overlay (pc);
+ if (bfd_section == NULL)
+ {
+ struct obj_section *obj_section = find_pc_section (pc);
+ if (obj_section == NULL)
+ bfd_section = NULL;
+ else
+ bfd_section = obj_section->the_bfd_section;
+ }
+ return find_pc_sect_partial_function (pc, bfd_section, name, address,
+ endaddr);
}
/* Return the innermost stack frame executing inside of BLOCK,