Blame SOURCES/gdb-6.3-ppc64displaysymbol-20041124.patch

4c2ad1
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
4c2ad1
From: Andrew Cagney <cagney@gnu.org>
4c2ad1
Date: Fri, 27 Oct 2017 21:07:50 +0200
4c2ad1
Subject: gdb-6.3-ppc64displaysymbol-20041124.patch
4c2ad1
4c2ad1
;; Include the pc's section when doing a symbol lookup so that the
4c2ad1
;; correct symbol is found.
4c2ad1
;;=push: Write new testcase.
4c2ad1
4c2ad1
2004-11-24  Andrew Cagney  <cagney@gnu.org>
4c2ad1
4c2ad1
	* printcmd.c (build_address_symbolic): Find a section for the
4c2ad1
	address.
4c2ad1
4c2ad1
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
4c2ad1
--- a/gdb/printcmd.c
4c2ad1
+++ b/gdb/printcmd.c
4c2ad1
@@ -587,6 +587,14 @@ build_address_symbolic (struct gdbarch *gdbarch,
4c2ad1
 	  addr = overlay_mapped_address (addr, section);
4c2ad1
 	}
4c2ad1
     }
4c2ad1
+  /* To ensure that the symbol returned belongs to the correct setion
4c2ad1
+     (and that the last [random] symbol from the previous section
4c2ad1
+     isn't returned) try to find the section containing PC.  First try
4c2ad1
+     the overlay code (which by default returns NULL); and second try
4c2ad1
+     the normal section code (which almost always succeeds).  */
4c2ad1
+  section = find_pc_overlay (addr);
4c2ad1
+  if (section == NULL)
4c2ad1
+    section = find_pc_section (addr);
4c2ad1
 
4c2ad1
   /* First try to find the address in the symbol table, then
4c2ad1
      in the minsyms.  Take the closest one.  */