Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Anmol P. Paralkar" <b07584@freescale.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sourceware.org
Subject: Re: Regenerate config/features/rs6000
Date: Tue, 01 Apr 2008 17:07:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0804011000470.19389@ld0159-tx32.am.freescale.net> (raw)
In-Reply-To: <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.


  reply	other threads:[~2008-04-01 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-31 23:58 Michael Eager
     [not found] ` <20080331234135.GA29623@caradoc.them.org>
     [not found]   ` <47F17A97.1000408@eagercon.com>
2008-04-01  1:09     ` Daniel Jacobowitz
2008-04-01 17:07       ` Anmol P. Paralkar [this message]
2008-04-01 17:13         ` Daniel Jacobowitz
2008-04-01 20:23           ` Anmol P. Paralkar
2008-04-01 20:36             ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0804011000470.19389@ld0159-tx32.am.freescale.net \
    --to=b07584@freescale.com \
    --cc=drow@false.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox