29 lines
1022 B
Diff
29 lines
1022 B
Diff
|
2004-11-24 Andrew Cagney <cagney@gnu.org>
|
||
|
|
||
|
* printcmd.c (build_address_symbolic): Find a section for the
|
||
|
address.
|
||
|
|
||
|
--- ./gdb/printcmd.c.1 2004-11-24 17:54:27.316295608 -0500
|
||
|
+++ ./gdb/printcmd.c 2004-11-24 17:59:20.069790312 -0500
|
||
|
@@ -615,6 +615,20 @@
|
||
|
addr = overlay_mapped_address (addr, 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). */
|
||
|
+ section = find_pc_overlay (addr);
|
||
|
+ if (section == NULL)
|
||
|
+ {
|
||
|
+ struct obj_section *obj_section = find_pc_section (addr);
|
||
|
+ if (obj_section == NULL)
|
||
|
+ section = NULL;
|
||
|
+ else
|
||
|
+ section = obj_section->the_bfd_section;
|
||
|
+ }
|
||
|
|
||
|
/* First try to find the address in the symbol table, then
|
||
|
in the minsyms. Take the closest one. */
|