This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Add support for PPC Altivec registers in gcore
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: cseo at linux dot vnet dot ibm dot com (Carlos Eduardo Seo)
- Cc: Ulrich dot Weigand at de dot ibm dot com (Ulrich Weigand), gdb-patches at sourceware dot org (GDB Patches Mailing List)
- Date: Mon, 26 Nov 2007 17:09:28 +0100 (CET)
- Subject: Re: [RFC] Add support for PPC Altivec registers in gcore
Carlos Eduardo Seo wrote:
> Ulrich Weigand wrote:
> >
> > Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> wrote on 11/06/2007
> > 02:42:43 PM:
> >
> > > I was taking a look at gdbarch.sh. Where's the "right" place to put
> > > the register list?
> >
> > In "function_list". If you want to add a new data symbol, you'll
> > need type "v". Best place is probably after regset_from_core_section.
> Do you think it's better to initialize this new structure with the
> registers names in gdbarch.c, or have it initialized in each
> arch-tdep.c file with the supported registers for that arch?
Maybe there is some misunderstanding: I was not talking about a list
of *register names*, rather a set of core file *section names*.
I'd suggest to define a data structure along the lines of:
struct core_regset_section
{
const char *name;
int len;
};
and then define arrays of those in the -tdep.c files, like:
static struct core_regset_section ppc_regset_sections[] =
{
{ ".reg", ... },
{ ".reg2", ... },
{ ".reg-vmx", ... },
{ NULL, 0 }
};
In gdbarch.sh, you'd then add an entry like:
v:struct core_regset_section *:core_regset_sections
which would generate functions
gdbarch_core_regset_sections and
gdbarch_set_core_regset_sections
In the -tdep.c file, you'd now be able to install the array
defined above:
gdbarch_set_core_regset_sections (gdbarch, ppc_regset_sections);
and in linux-nat.c, you'd be able to call gdbarch_core_regset_sections
to get at that list.
For platforms that do not override that gdbarch routine, you can
fall back to a default along the lines of
struct default_regset_sections[] =
{
{ ".reg", sizeof (gdb_gregset_t) },
{ ".reg2", sizeof (gdb_fpregset_t) },
{ NULL, 0 }
};
Does this make sense?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com