* regset.h (struct core_regset_section): Add HUMAN_NAME.
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:57:44 +0000 (14:57 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:57:44 +0000 (14:57 +0000)
* i386-linux-tdep.c (i386_linux_regset_sections): Fill in HUMAN_NAME.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections): Likewise.
(ppc_linux_vmx_regset_sections): Likewise.
(ppc_linux_fp_regset_sections): Likewise.

* corelow.c (get_core_register_section): Constify arguments.
(get_core_registers): Use gdbarch_core_regset_sections instead
of hard-coded platform-specific register section names.

gdb/ChangeLog
gdb/corelow.c
gdb/i386-linux-tdep.c
gdb/ppc-linux-tdep.c
gdb/regset.h

index 79fe93a2ee754ee926c836ad2336b26d4f9fa943..3d0de4709800c46c101de71b96be3c84bb0af41b 100644 (file)
@@ -1,3 +1,15 @@
+2010-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * regset.h (struct core_regset_section): Add HUMAN_NAME.
+       * i386-linux-tdep.c (i386_linux_regset_sections): Fill in HUMAN_NAME.
+       * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections): Likewise.
+       (ppc_linux_vmx_regset_sections): Likewise.
+       (ppc_linux_fp_regset_sections): Likewise.
+
+       * corelow.c (get_core_register_section): Constify arguments.
+       (get_core_registers): Use gdbarch_core_regset_sections instead
+       of hard-coded platform-specific register section names.
+
 2010-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * dwarf2loc.c (read_pieced_value): If a piece occupies part of
index 1760e40b36392597708655f552f19d3864957009..039573fa1105e04d8c04eadaa33243ab124f8e57 100644 (file)
@@ -508,9 +508,9 @@ deprecated_core_resize_section_table (int num_added)
 
 static void
 get_core_register_section (struct regcache *regcache,
-                          char *name,
+                          const char *name,
                           int which,
-                          char *human_name,
+                          const char *human_name,
                           int required)
 {
   static char *section_name = NULL;
@@ -591,6 +591,7 @@ static void
 get_core_registers (struct target_ops *ops,
                    struct regcache *regcache, int regno)
 {
+  struct core_regset_section *sect_list;
   int i;
 
   if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
@@ -601,16 +602,30 @@ get_core_registers (struct target_ops *ops,
       return;
     }
 
-  get_core_register_section (regcache,
-                            ".reg", 0, "general-purpose", 1);
-  get_core_register_section (regcache,
-                            ".reg2", 2, "floating-point", 0);
-  get_core_register_section (regcache,
-                            ".reg-xfp", 3, "extended floating-point", 0);
-  get_core_register_section (regcache,
-                            ".reg-ppc-vmx", 3, "ppc Altivec", 0);
-  get_core_register_section (regcache,
-                            ".reg-ppc-vsx", 4, "POWER7 VSX", 0);
+  sect_list = gdbarch_core_regset_sections (get_regcache_arch (regcache));
+  if (sect_list)
+    while (sect_list->sect_name != NULL)
+      {
+        if (strcmp (sect_list->sect_name, ".reg") == 0)
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    0, sect_list->human_name, 1);
+        else if (strcmp (sect_list->sect_name, ".reg2") == 0)
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    2, sect_list->human_name, 0);
+       else
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    3, sect_list->human_name, 0);
+
+       sect_list++;
+      }
+
+  else
+    {
+      get_core_register_section (regcache,
+                                ".reg", 0, "general-purpose", 1);
+      get_core_register_section (regcache,
+                                ".reg2", 2, "floating-point", 0);
+    }
 
   /* Supply dummy value for all registers not found in the core.  */
   for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
index 463bc344f726cd9054c86812abc8136f4df54645..5acd229d6123670bab271cb0d88fe2dfdb8a04ac 100644 (file)
@@ -49,9 +49,9 @@
 /* Supported register note sections.  */
 static struct core_regset_section i386_linux_regset_sections[] =
 {
-  { ".reg", 144 },
-  { ".reg2", 108 },
-  { ".reg-xfp", 512 },
+  { ".reg", 144, "general-purpose" },
+  { ".reg2", 108, "floating-point" },
+  { ".reg-xfp", 512, "extended floating-point" },
   { NULL, 0 }
 };
 
index b1a8959d8978ad13db70bbeb3c35cec1c17c3fec..36cedf1a53775724381995d798ae2293111d0d57 100644 (file)
@@ -516,25 +516,25 @@ ppc64_standard_linkage1_target (struct frame_info *frame,
 
 static struct core_regset_section ppc_linux_vsx_regset_sections[] =
 {
-  { ".reg", 268 },
-  { ".reg2", 264 },
-  { ".reg-ppc-vmx", 544 },
-  { ".reg-ppc-vsx", 256 },
+  { ".reg", 268, "general-purpose" },
+  { ".reg2", 264, "floating-point" },
+  { ".reg-ppc-vmx", 544, "ppc Altivec" },
+  { ".reg-ppc-vsx", 256, "POWER7 VSX" },
   { NULL, 0}
 };
 
 static struct core_regset_section ppc_linux_vmx_regset_sections[] =
 {
-  { ".reg", 268 },
-  { ".reg2", 264 },
-  { ".reg-ppc-vmx", 544 },
+  { ".reg", 268, "general-purpose" },
+  { ".reg2", 264, "floating-point" },
+  { ".reg-ppc-vmx", 544, "ppc Altivec" },
   { NULL, 0}
 };
 
 static struct core_regset_section ppc_linux_fp_regset_sections[] =
 {
-  { ".reg", 268 },
-  { ".reg2", 264 },
+  { ".reg", 268, "general-purpose" },
+  { ".reg2", 264, "floating-point" },
   { NULL, 0}
 };
 
index b61758e78c59944ffd0c0598cc6bacfe2c066378..9a21ced768e8864a495724f821fca067c31e74ba 100644 (file)
@@ -29,6 +29,7 @@ struct core_regset_section
 {
   const char *sect_name;
   int size;
+  const char *human_name;
 };
 
 /* Data structure describing a register set.  */