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

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