Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb@sourceware.org
Subject: Re: What role does gdb/remote.c play?
Date: Mon, 15 Aug 2011 15:26:00 -0000	[thread overview]
Message-ID: <4E493A79.3060002@broadcom.com> (raw)
In-Reply-To: <CAGxstLRqEA0rBjdjDR8wiNYZ7YGY7QN4UTKhYC1tHbiKO9KmOg@mail.gmail.com>

On 15/08/2011 16:09, Triple Yang wrote:

> The Question is, when I created my own "struct target_ops" object and
> initialized it properly, then added it to targetlist, I could expect
> it would respond to commands like target remote and break.

The commands "target remote" and "break" are different, the "target 
remote" is used to pick which "struct target_ops" is used to talk to a 
target, commands like "break" use the functions linked into the "struct 
target_ops" in order to do debugging stuff with your target.

The remote in "target remote" comes from the to_shortname field of the 
struct target_ops. If you have created your own struct target_ops then 
you should fill this field in with a unique target name, say xxx, you 
can then say "target xxx" and gdb will use your struct target_ops to 
talk to the target.

> As I've mentioned in a previous mail, current_target holds the value
> specified in remote.c rather than my own remote-XXX.c. I guess the
> expected value is overrided in init.c (which is a generated file
> during building) since _initialize_remote() is called after calling
> _initialize_remote_XXX(). It is easy to find an ugly and offensive way
> to avoid that situation. But I tend to believe there are some clean
> and pretty means to do that and I don't know yet.

The calls to _initialize_<whatever> build up the total list of all 
possible targets. Just having a target in the list doesn't mean it's 
being used, a target type is selected when you issue the target <type> 
command to gdb.

Andrew


  reply	other threads:[~2011-08-15 15:26 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 [this message]
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

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=4E493A79.3060002@broadcom.com \
    --to=aburgess@broadcom.com \
    --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