From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12532 invoked by alias); 15 Aug 2011 15:10:00 -0000 Received: (qmail 12402 invoked by uid 22791); 15 Aug 2011 15:09:58 -0000 X-SWARE-Spam-Status: No, hits=0.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Aug 2011 15:09:45 +0000 Received: by gyg10 with SMTP id 10so3468687gyg.0 for ; Mon, 15 Aug 2011 08:09:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.73.233 with SMTP id v69mr6685989yhd.242.1313420984514; Mon, 15 Aug 2011 08:09:44 -0700 (PDT) Received: by 10.147.34.4 with HTTP; Mon, 15 Aug 2011 08:09:44 -0700 (PDT) In-Reply-To: <201108151432.33454.pedro@codesourcery.com> References: <54475b.156ef.131ccb300f5.Coremail.yongyong.yang@ia.ac.cn> <201108151109.56890.pedro@codesourcery.com> <201108151432.33454.pedro@codesourcery.com> Date: Mon, 15 Aug 2011 15:10:00 -0000 Message-ID: Subject: Re: What role does gdb/remote.c play? From: Triple Yang To: gdb@sourceware.org Cc: Pedro Alves Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00049.txt.bz2 2011/8/15 Pedro Alves : > On Monday 15 August 2011 12:51:11, Triple Yang wrote: > >> Then, if I want to create a new remote target, should I just modify >> remote.c or reuse codes in it? > > I don't know what your new target does, so I can't answer that for you. > >> How do I map command 'target remote' to the new target I created? > > You don't. =C2=A0Do you _really_ need to implement a new target in gdb? > Why not teach the remote end the RSP instead? =C2=A0Then you can > use "target remote", without adding new code to gdb. > 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. To "teach the remote end the RSP instead", what needs to be done? >> It seems I did what those documents told me to, but things don't work. > > I'm confused. =C2=A0What documents? =C2=A0I only pointed you at the GDB m= anual, > to check the RSP documentation. =C2=A0Here: > > http://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html > I have already read about those related codes and official documents. I barely grasp the main points. Maybe I should dive into gdb source codes. But I am not sure. 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. 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. Best wishes. > -- > Pedro Alves >