Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Petr Hluzín" <petr.hluzin@gmail.com>
To: Triple Yang <triple.yang@gmail.com>
Cc: gdb@sourceware.org, Pedro Alves <pedro@codesourcery.com>
Subject: Re: What role does gdb/remote.c play?
Date: Mon, 15 Aug 2011 20:13:00 -0000	[thread overview]
Message-ID: <CAC=yr6Cq2v3cezgErhCQgxtV2__cjCbLu=hfgzNaEw6GzV96Xw@mail.gmail.com> (raw)
In-Reply-To: <CAGxstLQzkq=iotg+crPx_9ROz+PM=XQuZK=0G6Ef7WNC0LSTGg@mail.gmail.com>

On 15 August 2011 20:20, Triple Yang <triple.yang@gmail.com> wrote:
> 2011/8/15 Petr Hluzín <petr.hluzin@gmail.com>:
>> On 15 August 2011 17:09, Triple Yang <triple.yang@gmail.com> wrote:
>>> Yes, because I am trying porting GDB to a new architecture prototype.
>>> Implementing a new target seems to be the only way to achieve the
>>> purpose.
>>
>> If your users want to debug programs running on a remote
>> machine/device then you can either:
>> A: override "target remote" (or other target) implementation in GDB
>> and use custom communication or
>> B: use GDB's remote protocol, modify gdbserver sources and write your
>> own handling or
>> C: use GDB's remote protocol and write your own parsing and handling
>>
>> The option A is not recommended (see Pedro Alves) because it either
>> means you will be distributing your own GDB or be stuck to FSF release
>> schedule. Also users of older gdbs will not be able to connect (plus
>> users will get misleading diagnostic). And there is a lot of code in
>> gdb and many ways to get lost.
>>
>> For options B and C the user would type "target remote" and it will
>> behave the way users expect from other archs (as the case may be),
>> what tutorials describe and what IDEs do well.
>>
>
> So in option B or C, will reusing codes in remote.c be satisfying?
> (Thus I may save some time in writing codes parsing/wrapping RSP
> packets.)

No, you cannot reuse code in [1]. GDB uses the code to format commands
and parse responses.

You can reuse code of gdbserver in [2]. This directory includes the
code for parsing commands from GDB and formatting responses.

However there are many more implementations of a GDB remote
monitor/stub in the world, the gdbserver is just one of them.

[1] http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/remote.c?cvsroot=src
[2] http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbserver/?cvsroot=src

-- 
Petr Hluzin


      reply	other threads:[~2011-08-15 20:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15  9:08 yongyong.yang
2011-08-15 10:10 ` Pedro Alves
2011-08-15 11:51   ` Triple Yang
2011-08-15 13:32     ` Pedro Alves
2011-08-15 15:10       ` Triple Yang
2011-08-15 15:26         ` Andrew Burgess
2011-08-15 17:48           ` Triple Yang
2011-08-15 15:28         ` Pedro Alves
     [not found]           ` <CAGxstLS4BjPZOatfSMMUiVNpOyd9gVzdVXbzqUqBzvb1M9gsjw@mail.gmail.com>
2011-08-15 17:54             ` Triple Yang
2011-08-15 15:46         ` Petr Hluzín
2011-08-15 18:20           ` Triple Yang
2011-08-15 20:13             ` Petr Hluzín [this message]

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='CAC=yr6Cq2v3cezgErhCQgxtV2__cjCbLu=hfgzNaEw6GzV96Xw@mail.gmail.com' \
    --to=petr.hluzin@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=triple.yang@gmail.com \
    /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