From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2543 invoked by alias); 15 Aug 2011 11:51:42 -0000 Received: (qmail 2534 invoked by uid 22791); 15 Aug 2011 11:51:40 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gw0-f41.google.com (HELO mail-gw0-f41.google.com) (74.125.83.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Aug 2011 11:51:12 +0000 Received: by gwaa20 with SMTP id a20so3357588gwa.0 for ; Mon, 15 Aug 2011 04:51:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.176.130 with SMTP id b2mr12018977yhm.140.1313409071980; Mon, 15 Aug 2011 04:51:11 -0700 (PDT) Received: by 10.147.34.4 with HTTP; Mon, 15 Aug 2011 04:51:11 -0700 (PDT) In-Reply-To: <201108151109.56890.pedro@codesourcery.com> References: <54475b.156ef.131ccb300f5.Coremail.yongyong.yang@ia.ac.cn> <201108151109.56890.pedro@codesourcery.com> Date: Mon, 15 Aug 2011 11:51:00 -0000 Message-ID: Subject: Re: What role does gdb/remote.c play? From: Triple Yang To: gdb@sourceware.org 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/msg00040.txt.bz2 Thank you very much. Then, if I want to create a new remote target, should I just modify remote.c or reuse codes in it? How do I map command 'target remote' to the new target I created? It seems I did what those documents told me to, but things don't work. Best wishes. =E5=9C=A8 2011=E5=B9=B48=E6=9C=8815=E6=97=A5 =E4=B8=8B=E5=8D=886:09=EF=BC= =8CPedro Alves =E5=86=99=E9=81=93=EF=BC=9A > On Monday 15 August 2011 10:08:28, yongyong.yang@ia.ac.cn wrote: >> Hey, everyone. >> >> Recently I am trying to port gdb for a remote target. I use remote-m32r-= sdi as start point. >> when I debug it, I find the global variable current_target has the value= specified in remote.c, >> furthermore I find the generated file init.c has both initialize_XXX() a= nd _initialize_remote() , >> where XXX is the target I specified for my target. >> >> So when I run command 'target remote localhost:[port]', it is remote_ope= n() that handles the argument and etc. >> >> Can someone explain what is wrong. Thank you. > > GDB supports more than one method to talk to the remote target. > To connect to a remote target using remote-m32r-sdi.c, you issue > "target m32rsdi". =C2=A0See: > > $ grep "to_shortname =3D " src/gdb/remote*.c > remote.c: =C2=A0remote_ops.to_shortname =3D "remote"; > remote.c: =C2=A0extended_remote_ops.to_shortname =3D "extended-remote"; > remote-m32r-sdi.c: =C2=A0m32r_ops.to_shortname =3D "m32rsdi"; > remote-mips.c: =C2=A0mips_ops.to_shortname =3D "mips"; > remote-mips.c: =C2=A0pmon_ops.to_shortname =3D "pmon"; > remote-mips.c: =C2=A0ddb_ops.to_shortname =3D "ddb"; > remote-mips.c: =C2=A0rockhopper_ops.to_shortname =3D "rockhopper"; > remote-mips.c: =C2=A0lsi_ops.to_shortname =3D "lsi"; > remote-sim.c: =C2=A0gdbsim_ops.to_shortname =3D "sim"; > > "target remote" maps to remote.c, which uses the > GDB Remove Serial Protocol (RSP, see the GDB manual) to control > target. =C2=A0New targets are strongly encouraged to > implement RSP support on the remote end, instead of cooking up a > new gdb remote backend. > > -- > Pedro Alves >