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

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