diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-02-09 19:13:46 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-02-09 19:13:46 +0000 |
commit | be0a34b132ff3c403bc64a5c895e3f9c24afb326 (patch) | |
tree | e271e86779310fba1acbee06184821e618b8fe0a /gdb/blockframe.c | |
parent | 8c8a4ea65f3e896f6f28656ad40a235323223bdd (diff) | |
download | gdb-be0a34b132ff3c403bc64a5c895e3f9c24afb326.tar.gz |
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.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 00d7d8f13e4..409ec946156 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, |