25086096 decode %ccr into individual flags in sparcv9 register output
authorIvo Raisr <ivo.raisr@oracle.com>
Mon, 05 Dec 2016 15:47:44 -0800
changeset 7460 ce0a4dac8adb
parent 7459 f656417cfc7b
child 7461 fae95a5b122f
25086096 decode %ccr into individual flags in sparcv9 register output
components/gdb/patches/gdb.gdb.sparc-tdep.h-1.patch
components/gdb/patches/gdb.gdb.sparc64-tdep.c-1.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gdb/patches/gdb.gdb.sparc-tdep.h-1.patch	Mon Dec 05 15:47:44 2016 -0800
@@ -0,0 +1,14 @@
+Provides support to decode flags of the %ccr register.
+Submitted to upstream as:
+https://sourceware.org/bugzilla/show_bug.cgi?id=20928
+
+--- gdb-7.11/gdb/sparc-tdep.h.orig	2016-11-13 21:53:36.828489462 -0800
++++ gdb-7.11/gdb/sparc-tdep.h	2016-11-13 21:45:25.465272567 -0800
+@@ -76,6 +76,7 @@
+   /* ISA-specific data types.  */
+   struct type *sparc_psr_type;
+   struct type *sparc_fsr_type;
++  struct type *sparc64_ccr_type;
+   struct type *sparc64_pstate_type;
+   struct type *sparc64_fsr_type;
+   struct type *sparc64_fprs_type;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gdb/patches/gdb.gdb.sparc64-tdep.c-1.patch	Mon Dec 05 15:47:44 2016 -0800
@@ -0,0 +1,75 @@
+Provides support to decode flags of the %ccr register.
+Correctly decodes flags of the %fsr register.
+Submitted to upstream as:
+https://sourceware.org/bugzilla/show_bug.cgi?id=20928
+
+--- gdb-7.11/gdb/sparc64-tdep.c.orig	2016-11-13 21:44:55.718592592 -0800
++++ gdb-7.11/gdb/sparc64-tdep.c	2016-11-13 21:45:25.464646189 -0800
+@@ -172,6 +172,31 @@
+ }
+ 
+ static struct type *
++sparc64_ccr_type (struct gdbarch *gdbarch)
++{
++  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++
++  if (tdep->sparc64_ccr_type == NULL)
++    {
++      struct type *type;
++
++      type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 8);
++      append_flags_type_flag (type, 0, "icc.c");
++      append_flags_type_flag (type, 1, "icc.v");
++      append_flags_type_flag (type, 2, "icc.z");
++      append_flags_type_flag (type, 3, "icc.n");
++      append_flags_type_flag (type, 4, "xcc.c");
++      append_flags_type_flag (type, 5, "xcc.v");
++      append_flags_type_flag (type, 6, "xcc.z");
++      append_flags_type_flag (type, 7, "xcc.n");
++
++      tdep->sparc64_ccr_type = type;
++    }
++
++  return tdep->sparc64_ccr_type;
++}
++
++static struct type *
+ sparc64_fsr_type (struct gdbarch *gdbarch)
+ {
+   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+@@ -181,16 +206,16 @@
+       struct type *type;
+ 
+       type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8);
+-      append_flags_type_flag (type, 0, "NXA");
+-      append_flags_type_flag (type, 1, "DZA");
+-      append_flags_type_flag (type, 2, "UFA");
+-      append_flags_type_flag (type, 3, "OFA");
+-      append_flags_type_flag (type, 4, "NVA");
+-      append_flags_type_flag (type, 5, "NXC");
+-      append_flags_type_flag (type, 6, "DZC");
+-      append_flags_type_flag (type, 7, "UFC");
+-      append_flags_type_flag (type, 8, "OFC");
+-      append_flags_type_flag (type, 9, "NVC");
++      append_flags_type_flag (type, 0, "NXC");
++      append_flags_type_flag (type, 1, "DZC");
++      append_flags_type_flag (type, 2, "UFC");
++      append_flags_type_flag (type, 3, "OFC");
++      append_flags_type_flag (type, 4, "NVC");
++      append_flags_type_flag (type, 5, "NXA");
++      append_flags_type_flag (type, 6, "DZA");
++      append_flags_type_flag (type, 7, "UFA");
++      append_flags_type_flag (type, 8, "OFA");
++      append_flags_type_flag (type, 9, "NVA");
+       append_flags_type_flag (type, 22, "NS");
+       append_flags_type_flag (type, 23, "NXM");
+       append_flags_type_flag (type, 24, "DZM");
+@@ -327,7 +352,7 @@
+   if (regnum == SPARC64_ASI_REGNUM)
+     return builtin_type (gdbarch)->builtin_int64;
+   if (regnum == SPARC64_CCR_REGNUM)
+-    return builtin_type (gdbarch)->builtin_int64;
++    return sparc64_ccr_type (gdbarch);
+   if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
+     return builtin_type (gdbarch)->builtin_double;
+   if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)