This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Regenerate config/features/rs6000
- From: "Anmol P. Paralkar" <b07584 at freescale dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gdb at sourceware dot org
- Date: Tue, 1 Apr 2008 12:07:16 -0500 (CDT)
- Subject: Re: Regenerate config/features/rs6000
- References: <47F16D39.4040608@eagercon.com> <20080331234135.GA29623@caradoc.them.org> <47F17A97.1000408@eagercon.com> <20080401010823.GA1649@caradoc.them.org>
On Mon, 31 Mar 2008, Daniel Jacobowitz wrote:
On Mon, Mar 31, 2008 at 04:58:15PM -0700, Michael Eager wrote:
Daniel Jacobowitz wrote:
On Mon, Mar 31, 2008 at 04:01:13PM -0700, Michael Eager wrote:
How are the C files generated from the xml files?
It's described in the comments in features/Makefile (you have to set
CFILES and use a specific target).
Apparently, there's a circular dependency: you have to have
build a gdb so you can generate the feature file which is needed
to build gdb.
Yes, there is. You've got to add XML support separately from
requiring the C precompiled features.
--
Daniel Jacobowitz
CodeSourcery
Hello,
I recently tried this out; perhaps the following sketch helps:
Assume that you are adding support for 'newarch' (say under powerpc).
First, "declare" newarch to GDB:
bfd/archures.c
.#define bfd_mach_ppc_newarch newarchval
bfd/bfd-in2.h
#define bfd_mach_ppc_newarch newarchval
bfd/cpu-powerpc.c
const bfd_arch_info_type bfd_powerpc_archs[] =
{
...
&bfd_powerpc_archs[<index of the <newarch> bfd_arch_info_type that you are adding>]
},
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_powerpc,
bfd_mach_ppc_<newarch>,
"powerpc",
"powerpc:<newarch>",
3,
FALSE, /* not the default */
powerpc_compatible,
bfd_default_scan,
NULL
},
}
gdb/rs6000-tdep.c
static struct variant variants[] =
{
...
{"<newarch>", "PowerPC <newarch>", bfd_arch_powerpc,
bfd_mach_ppc_<newarch>, NULL /* For now this is NULL. we'll change this after we generate gdb/features/rs6000/powerpc-<newarch>.c */,
...
}
Build GDB. Create gdb/features/rs6000/<newarch>.xml
We are now ready to generate <newarch>.c from <newarch>.xml
Use the newly built GDB (at this stage you should be able to do a: 'set architecture powerpc:<newarch>' and see the effect with a: 'show architecture').
cd gdb/features
gmake GDB=<prefix>/bin/powerpc-linux-gnu-gdb XMLTOC="./rs6000/powerpc-<newarch>.xml" ./rs6000/powerpc-<newarch>.c
If all goes well, you should have gdb/features/rs6000/powerpc-<newarch>.c now.
Go back to gdb/rs6000-tdep.c
#include "features/rs6000/powerpc-<newarch>.c"
...
static struct variant variants[] =
{
...
{"<newarch>", "PowerPC <newarch>", bfd_arch_powerpc,
bfd_mach_ppc_<newarch>, &tdesc_powerpc_<newarch>, /* Note! */
...
}
...
void
_initialize_rs6000_tdep (void)
{
...
initialize_tdesc_powerpc_<newarch> ();
...
}
That should be it. You should now be able to: 'set tdesc filename <?>/gdb/features/rs6000/<newarch>.xml' ...
Regards,
Anmol.