Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Stefan Heinzmann <stefan_heinzmann@t-online.de>
Cc: gdb@sources.redhat.com
Subject: Re: Porting GDB to a new target processor architecture -- what's  involved?
Date: Thu, 28 Feb 2002 14:38:00 -0000	[thread overview]
Message-ID: <3C7EAF35.6029CBD3@redhat.com> (raw)
In-Reply-To: <000901c1bf78$0e2b3d20$a49afea9@athlon600>

Stefan Heinzmann wrote:
> 
> Hello,
> 
> a potential customer wants me to port GDB to a new processor architecture (a
> 32-bit RISC processor) used in embedded systems. As I'm unfamiliar with the
> GDB internals, I have difficulties estimating the time needed to do this.
> What do I need to know? Has anyone got a reading list?

No reading list, sorry.  Maybe someday someone who is doing a 
first-time port will write up the experience.  You?

I usually start by adding a couple of lines to configure.tgt
to set up my new target (there are plenty of examples to look at).

Then I'll create a subdirectory under gdb/config for my target, 
and populate it with empty or minimal file fragments patterned 
after existing ones (best to pick a recent port as a template).

Finally you'll create a *-tdep.c file which will implement 
your target methods.  One way to start, again, is to begin
with a copy of another recent port's tdep file and strip out
all the code (bodies of the functions), rename the functions
to correspond to your target, and then start filling in the details.

I know I'm making this sound easier than it actually is...

> The GCC (2.95.3) and binutils apparently have been ported already. To which
> extent can I reuse code from those? I remember having read somewhere that
> gas and gdb use common target definition files, is that true?

Not really, but they share the bfd and opcodes libraries, which
will take care of (respectively) reading object files and disassembling.

> The GDB internals document is quite helpful, but it appears to be incomplete
> (stack frame interpretation, compiler characteristics). Is there additional
> information available (other than the source code itself)?

Yeah, it's always been incomplete, and no there isn't much else
(other than the source code, the changelogs, and the newsgroups.)

> How does the development process work assuming that the new target is
> contributed back to the community? Do I have to follow the most up-to-date
> CVS tree closely or is it more useful to work "off-line"?

Best to stay current.  Your eventual submission will have to be a
clean diff against the current tree.

> Is it reasonable to assume that the general gdb code can be used unchanged
> and only a few target-specific files need to be provided,

Yes.

> or is it common
> that such a porting effort brings up issues with gdb in general (or even
> with a graphical frontend) that will have to be addressed, too?

Not too common (knock on wood).  If it seems to you that you can't
do what you want to without changing the rest of gdb, you should
try looking at it from a different angle first.

Best of luck, 
Michael


  reply	other threads:[~2002-02-28 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-27  2:18 Stefan Heinzmann
2002-02-28 14:38 ` Michael Snyder [this message]
2002-02-27 13:29 Salman Khilji

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=3C7EAF35.6029CBD3@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=stefan_heinzmann@t-online.de \
    /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