* [PATCH-ppc 2/5] Add VSX support for core-files
@ 2008-07-25 20:16 Luis Machado
2008-08-08 15:18 ` Luis Machado
2008-08-14 19:52 ` Ulrich Weigand
0 siblings, 2 replies; 11+ messages in thread
From: Luis Machado @ 2008-07-25 20:16 UTC (permalink / raw)
To: gdb-patches
This patch adds the required support to dump VSX registers and read them
them back from a specific VSX notes section. This is in sync with the
format used by the Kernel.
---
2008-07-25 Luis Machado <luisgpm@br.ibm.com>
* ppc-linux-tdep.c (ppc_linux_regset_sections): Add new ".reg-ppc-vsx" field.
(ppc32_linux_vsxregset): New 32-bit VSX-enabled regset.
(ppc_linux_regset_from_core_section): Handle VSX core section.
(ppc_linux_core_read_description): Support VSX-enabled core files.
* corelow.c (get_core_register_section): Support VSX-enabled
core files.
Index: gdb/ppc-linux-tdep.c
===================================================================
--- gdb.orig/ppc-linux-tdep.c 2008-07-23 09:28:09.000000000 -0700
+++ gdb/ppc-linux-tdep.c 2008-07-23 09:31:44.000000000 -0700
@@ -496,6 +496,7 @@
{ ".reg", 268 },
{ ".reg2", 264 },
{ ".reg-ppc-vmx", 544 },
+ { ".reg-ppc-vsx", 256 },
{ NULL, 0}
};
@@ -743,6 +744,13 @@
NULL
};
+static const struct regset ppc32_linux_vsxregset = {
+ &ppc32_linux_reg_offsets,
+ ppc_supply_vsxregset,
+ ppc_collect_vsxregset,
+ NULL
+};
+
const struct regset *
ppc_linux_gregset (int wordsize)
{
@@ -771,6 +779,8 @@
return &ppc32_linux_fpregset;
if (strcmp (sect_name, ".reg-ppc-vmx") == 0)
return &ppc32_linux_vrregset;
+ if (strcmp (sect_name, ".reg-ppc-vsx") == 0)
+ return &ppc32_linux_vsxregset;
return NULL;
}
@@ -974,6 +984,7 @@
bfd *abfd)
{
asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
+ asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx");
asection *section = bfd_get_section_by_name (abfd, ".reg");
if (! section)
return NULL;
@@ -981,10 +992,20 @@
switch (bfd_section_size (abfd, section))
{
case 48 * 4:
- return altivec? tdesc_powerpc_altivec32l : tdesc_powerpc_32l;
+ if (vsx)
+ return tdesc_powerpc_vsx32l;
+ else if (altivec)
+ return tdesc_powerpc_altivec32l;
+ else
+ return tdesc_powerpc_32l;
case 48 * 8:
- return altivec? tdesc_powerpc_altivec64l : tdesc_powerpc_64l;
+ if (vsx)
+ return tdesc_powerpc_vsx64l;
+ else if (altivec)
+ return tdesc_powerpc_altivec64l;
+ else
+ return tdesc_powerpc_64l;
default:
return NULL;
Index: gdb/corelow.c
===================================================================
--- gdb.orig/corelow.c 2008-07-23 09:28:09.000000000 -0700
+++ gdb/corelow.c 2008-07-23 09:31:44.000000000 -0700
@@ -499,6 +499,8 @@
".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);
/* Supply dummy value for all registers not found in the core. */
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-07-25 20:16 [PATCH-ppc 2/5] Add VSX support for core-files Luis Machado
@ 2008-08-08 15:18 ` Luis Machado
2008-08-21 19:53 ` Ulrich Weigand
2008-08-14 19:52 ` Ulrich Weigand
1 sibling, 1 reply; 11+ messages in thread
From: Luis Machado @ 2008-08-08 15:18 UTC (permalink / raw)
To: gdb-patches
Ping?
On Fri, 2008-07-25 at 17:15 -0300, Luis Machado wrote:
> This patch adds the required support to dump VSX registers and read them
> them back from a specific VSX notes section. This is in sync with the
> format used by the Kernel.
>
> ---
> 2008-07-25 Luis Machado <luisgpm@br.ibm.com>
>
> * ppc-linux-tdep.c (ppc_linux_regset_sections): Add new ".reg-ppc-vsx" field.
> (ppc32_linux_vsxregset): New 32-bit VSX-enabled regset.
> (ppc_linux_regset_from_core_section): Handle VSX core section.
> (ppc_linux_core_read_description): Support VSX-enabled core files.
>
> * corelow.c (get_core_register_section): Support VSX-enabled
> core files.
>
>
> Index: gdb/ppc-linux-tdep.c
> ===================================================================
> --- gdb.orig/ppc-linux-tdep.c 2008-07-23 09:28:09.000000000 -0700
> +++ gdb/ppc-linux-tdep.c 2008-07-23 09:31:44.000000000 -0700
> @@ -496,6 +496,7 @@
> { ".reg", 268 },
> { ".reg2", 264 },
> { ".reg-ppc-vmx", 544 },
> + { ".reg-ppc-vsx", 256 },
> { NULL, 0}
> };
>
> @@ -743,6 +744,13 @@
> NULL
> };
>
> +static const struct regset ppc32_linux_vsxregset = {
> + &ppc32_linux_reg_offsets,
> + ppc_supply_vsxregset,
> + ppc_collect_vsxregset,
> + NULL
> +};
> +
> const struct regset *
> ppc_linux_gregset (int wordsize)
> {
> @@ -771,6 +779,8 @@
> return &ppc32_linux_fpregset;
> if (strcmp (sect_name, ".reg-ppc-vmx") == 0)
> return &ppc32_linux_vrregset;
> + if (strcmp (sect_name, ".reg-ppc-vsx") == 0)
> + return &ppc32_linux_vsxregset;
> return NULL;
> }
>
> @@ -974,6 +984,7 @@
> bfd *abfd)
> {
> asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
> + asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx");
> asection *section = bfd_get_section_by_name (abfd, ".reg");
> if (! section)
> return NULL;
> @@ -981,10 +992,20 @@
> switch (bfd_section_size (abfd, section))
> {
> case 48 * 4:
> - return altivec? tdesc_powerpc_altivec32l : tdesc_powerpc_32l;
> + if (vsx)
> + return tdesc_powerpc_vsx32l;
> + else if (altivec)
> + return tdesc_powerpc_altivec32l;
> + else
> + return tdesc_powerpc_32l;
>
> case 48 * 8:
> - return altivec? tdesc_powerpc_altivec64l : tdesc_powerpc_64l;
> + if (vsx)
> + return tdesc_powerpc_vsx64l;
> + else if (altivec)
> + return tdesc_powerpc_altivec64l;
> + else
> + return tdesc_powerpc_64l;
>
> default:
> return NULL;
> Index: gdb/corelow.c
> ===================================================================
> --- gdb.orig/corelow.c 2008-07-23 09:28:09.000000000 -0700
> +++ gdb/corelow.c 2008-07-23 09:31:44.000000000 -0700
> @@ -499,6 +499,8 @@
> ".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);
>
> /* Supply dummy value for all registers not found in the core. */
> for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-08 15:18 ` Luis Machado
@ 2008-08-21 19:53 ` Ulrich Weigand
2008-08-21 21:10 ` Luis Machado
0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2008-08-21 19:53 UTC (permalink / raw)
To: luisgpm; +Cc: gdb-patches
Luis Machado wrote:
> > { ".reg", 268 },
> > { ".reg2", 264 },
> > { ".reg-ppc-vmx", 544 },
> > + { ".reg-ppc-vsx", 256 },
> > { NULL, 0}
This patch seems to cause a testsuite regression: generate-core-file
will now *always* add a VSX section, even if the current target does
not actually support VSX registers. Therefore, on reading the core
file back in, the output of "info all-registers" is different than
before.
I think you should install different versions of ppc_linux_regset_sections
depending on the target properties (which you can inspect via
tdesc_find_feature (info.target_desc, ...) in ppc_linux_init_abi.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-21 19:53 ` Ulrich Weigand
@ 2008-08-21 21:10 ` Luis Machado
2008-08-21 21:14 ` Ulrich Weigand
0 siblings, 1 reply; 11+ messages in thread
From: Luis Machado @ 2008-08-21 21:10 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Thu, 2008-08-21 at 21:52 +0200, Ulrich Weigand wrote:
> Luis Machado wrote:
>
> > > { ".reg", 268 },
> > > { ".reg2", 264 },
> > > { ".reg-ppc-vmx", 544 },
> > > + { ".reg-ppc-vsx", 256 },
> > > { NULL, 0}
>
> This patch seems to cause a testsuite regression: generate-core-file
> will now *always* add a VSX section, even if the current target does
> not actually support VSX registers. Therefore, on reading the core
> file back in, the output of "info all-registers" is different than
> before.
>
> I think you should install different versions of ppc_linux_regset_sections
> depending on the target properties (which you can inspect via
> tdesc_find_feature (info.target_desc, ...) in ppc_linux_init_abi.
>
> Bye,
> Ulrich
Yes. I think this is currently expected given the current code.
For example, the core file generated with "gcore" on a 440 system will
dump VMX registers as well, and that target doesn't even have VMX
registers there.
A new check should suffice for that. We will need three kinds of sets
then: VSX-able, VMX-able and neither VSX or VMX. How does it sound?
Regards,
Luis
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-21 21:10 ` Luis Machado
@ 2008-08-21 21:14 ` Ulrich Weigand
2008-08-22 22:32 ` Luis Machado
0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2008-08-21 21:14 UTC (permalink / raw)
To: luisgpm; +Cc: gdb-patches
Luis Machado wrote:
> A new check should suffice for that. We will need three kinds of sets
> then: VSX-able, VMX-able and neither VSX or VMX. How does it sound?
That sounds right.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-21 21:14 ` Ulrich Weigand
@ 2008-08-22 22:32 ` Luis Machado
2008-08-25 18:27 ` Ulrich Weigand
0 siblings, 1 reply; 11+ messages in thread
From: Luis Machado @ 2008-08-22 22:32 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
Hi,
Attached is a patch that fixes the seen regression. OK?
Thanks,
Luis
On Thu, 2008-08-21 at 23:13 +0200, Ulrich Weigand wrote:
> Luis Machado wrote:
>
> > A new check should suffice for that. We will need three kinds of sets
> > then: VSX-able, VMX-able and neither VSX or VMX. How does it sound?
>
> That sounds right.
>
> Thanks,
> Ulrich
>
---
2008-08-22 Luis Machado <luisgpm@br.ibm.com>
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) New structure.
(ppc_linux_vmx_regset_sections): New structure.
(ppc_linux_fp_regset_sections): New structure.
(ppc_linux_init_abi): Select core-file regset based on target
features.
Index: gdb/ppc-linux-tdep.c
===================================================================
--- gdb.orig/ppc-linux-tdep.c 2008-08-22 15:12:04.000000000 -0700
+++ gdb/ppc-linux-tdep.c 2008-08-22 15:22:42.000000000 -0700
@@ -491,7 +491,7 @@
return ppc64_desc_entry_point (desc);
}
-static struct core_regset_section ppc_linux_regset_sections[] =
+static struct core_regset_section ppc_linux_vsx_regset_sections[] =
{
{ ".reg", 268 },
{ ".reg2", 264 },
@@ -500,6 +500,21 @@
{ NULL, 0}
};
+static struct core_regset_section ppc_linux_vmx_regset_sections[] =
+{
+ { ".reg", 268 },
+ { ".reg2", 264 },
+ { ".reg-ppc-vmx", 544 },
+ { NULL, 0}
+};
+
+static struct core_regset_section ppc_linux_fp_regset_sections[] =
+{
+ { ".reg", 268 },
+ { ".reg2", 264 },
+ { NULL, 0}
+};
+
static CORE_ADDR
ppc64_standard_linkage2_target (struct frame_info *frame,
CORE_ADDR pc, unsigned int *insn)
@@ -1103,7 +1118,14 @@
set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
/* Supported register sections. */
- set_gdbarch_core_regset_sections (gdbarch, ppc_linux_regset_sections);
+ if (tdesc_find_feature (info.target_desc,
+ "org.gnu.gdb.power.vsx"))
+ set_gdbarch_core_regset_sections (gdbarch, ppc_linux_vsx_regset_sections);
+ else if (tdesc_find_feature (info.target_desc,
+ "org.gnu.gdb.power.altivec"))
+ set_gdbarch_core_regset_sections (gdbarch, ppc_linux_vmx_regset_sections);
+ else
+ set_gdbarch_core_regset_sections (gdbarch, ppc_linux_fp_regset_sections);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-22 22:32 ` Luis Machado
@ 2008-08-25 18:27 ` Ulrich Weigand
2008-08-26 15:32 ` Luis Machado
0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2008-08-25 18:27 UTC (permalink / raw)
To: luisgpm; +Cc: gdb-patches
Luis Machado wrote:
> * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) New structure.
> (ppc_linux_vmx_regset_sections): New structure.
> (ppc_linux_fp_regset_sections): New structure.
> (ppc_linux_init_abi): Select core-file regset based on target
> features.
This is OK.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-25 18:27 ` Ulrich Weigand
@ 2008-08-26 15:32 ` Luis Machado
0 siblings, 0 replies; 11+ messages in thread
From: Luis Machado @ 2008-08-26 15:32 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Mon, 2008-08-25 at 20:26 +0200, Ulrich Weigand wrote:
> Luis Machado wrote:
>
> > * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) New structure.
> > (ppc_linux_vmx_regset_sections): New structure.
> > (ppc_linux_fp_regset_sections): New structure.
> > (ppc_linux_init_abi): Select core-file regset based on target
> > features.
>
> This is OK.
>
> Thanks,
> Ulrich
I've checked this in now.
Thanks,
Luis
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-07-25 20:16 [PATCH-ppc 2/5] Add VSX support for core-files Luis Machado
2008-08-08 15:18 ` Luis Machado
@ 2008-08-14 19:52 ` Ulrich Weigand
2008-08-15 5:14 ` Luis Machado
2008-08-15 15:27 ` Luis Machado
1 sibling, 2 replies; 11+ messages in thread
From: Ulrich Weigand @ 2008-08-14 19:52 UTC (permalink / raw)
To: luisgpm; +Cc: gdb-patches
Luis Machado wrote:
> 2008-07-25 Luis Machado <luisgpm@br.ibm.com>
>
> * ppc-linux-tdep.c (ppc_linux_regset_sections): Add new ".reg-ppc-vsx" field.
> (ppc32_linux_vsxregset): New 32-bit VSX-enabled regset.
> (ppc_linux_regset_from_core_section): Handle VSX core section.
> (ppc_linux_core_read_description): Support VSX-enabled core files.
>
> * corelow.c (get_core_register_section): Support VSX-enabled
> core files.
This is OK.
> Index: gdb/corelow.c
> ===================================================================
> --- gdb.orig/corelow.c 2008-07-23 09:28:09.000000000 -0700
> +++ gdb/corelow.c 2008-07-23 09:31:44.000000000 -0700
> @@ -499,6 +499,8 @@
> ".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);
It would be nice if we could convert this to a loop using the
gdbarch_core_regset_sections list at some point ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-14 19:52 ` Ulrich Weigand
@ 2008-08-15 5:14 ` Luis Machado
2008-08-15 15:27 ` Luis Machado
1 sibling, 0 replies; 11+ messages in thread
From: Luis Machado @ 2008-08-15 5:14 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Thu, 2008-08-14 at 21:51 +0200, Ulrich Weigand wrote:
> > Index: gdb/corelow.c
> > ===================================================================
> > --- gdb.orig/corelow.c 2008-07-23 09:28:09.000000000 -0700
> > +++ gdb/corelow.c 2008-07-23 09:31:44.000000000 -0700
> > @@ -499,6 +499,8 @@
> > ".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);
>
> It would be nice if we could convert this to a loop using the
> gdbarch_core_regset_sections list at some point ...
Agreed. I'll write a separate patch to cover this change.
Thanks,
Luis
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-ppc 2/5] Add VSX support for core-files
2008-08-14 19:52 ` Ulrich Weigand
2008-08-15 5:14 ` Luis Machado
@ 2008-08-15 15:27 ` Luis Machado
1 sibling, 0 replies; 11+ messages in thread
From: Luis Machado @ 2008-08-15 15:27 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Thu, 2008-08-14 at 21:51 +0200, Ulrich Weigand wrote:
> Luis Machado wrote:
>
> > 2008-07-25 Luis Machado <luisgpm@br.ibm.com>
> >
> > * ppc-linux-tdep.c (ppc_linux_regset_sections): Add new ".reg-ppc-vsx" field.
> > (ppc32_linux_vsxregset): New 32-bit VSX-enabled regset.
> > (ppc_linux_regset_from_core_section): Handle VSX core section.
> > (ppc_linux_core_read_description): Support VSX-enabled core files.
> >
> > * corelow.c (get_core_register_section): Support VSX-enabled
> > core files.
>
> This is OK.
>
> > Index: gdb/corelow.c
> > ===================================================================
> > --- gdb.orig/corelow.c 2008-07-23 09:28:09.000000000 -0700
> > +++ gdb/corelow.c 2008-07-23 09:31:44.000000000 -0700
> > @@ -499,6 +499,8 @@
> > ".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);
>
> It would be nice if we could convert this to a loop using the
> gdbarch_core_regset_sections list at some point ...
>
> Bye,
> Ulrich
Checked in.
Luis
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-08-26 15:32 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 20:16 [PATCH-ppc 2/5] Add VSX support for core-files Luis Machado
2008-08-08 15:18 ` Luis Machado
2008-08-21 19:53 ` Ulrich Weigand
2008-08-21 21:10 ` Luis Machado
2008-08-21 21:14 ` Ulrich Weigand
2008-08-22 22:32 ` Luis Machado
2008-08-25 18:27 ` Ulrich Weigand
2008-08-26 15:32 ` Luis Machado
2008-08-14 19:52 ` Ulrich Weigand
2008-08-15 5:14 ` Luis Machado
2008-08-15 15:27 ` Luis Machado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox