[7/8,PowerPC] Fix inclusion of dfp pseudoregs in tdep

Message ID 20180510195840.17734-8-pedromfc@linux.vnet.ibm.com
State New, archived
Headers

Commit Message

pedromfc May 10, 2018, 7:58 p.m. UTC
  Previously, decimal floating point pseudoregisters were always included
in the target if it had a floating point unit.

This patch changes this to only include them if the target description
indicates that they are present, i.e. if the FPSCR register has more
than 32 bits.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>

	* rs6000-tdep.c (rs6000_gdbarch_init): Assign 1 to have_dfp only
	if the size of fpscr is larger than 32 bits.
---
 gdb/rs6000-tdep.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 3f0b7f77a1..7e4662b337 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6090,14 +6090,16 @@  rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 	      return NULL;
 	    }
 	  have_fpu = 1;
+
+	  /* The fpscr register was expanded in isa 2.05 to 64 bits
+	     along with the addition of the decimal floating point
+	     facility.  */
+	  if (tdesc_register_size(feature, "fpscr") > 32)
+	    have_dfp = 1;
 	}
       else
 	have_fpu = 0;
 
-      /* The DFP pseudo-registers will be available when there are floating
-         point registers.  */
-      have_dfp = have_fpu;
-
       feature = tdesc_find_feature (tdesc,
 				    "org.gnu.gdb.power.altivec");
       if (feature != NULL)