From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102565 invoked by alias); 9 Aug 2016 19:15:31 -0000 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 Received: (qmail 102531 invoked by uid 89); 9 Aug 2016 19:15:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Black, H*F:D*nz, Magic, H*F:D*co.nz X-HELO: mail-wm0-f50.google.com Received: from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 09 Aug 2016 19:15:16 +0000 Received: by mail-wm0-f50.google.com with SMTP id o80so55852066wme.1 for ; Tue, 09 Aug 2016 12:15:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BozV2eF0ginCWY0MF3SaQu+lWY5OBrz/9kr01qkylJs=; b=iG9tdCUfZR2zNagFDn0+WXjpJZ9XlQq74/CXwMFHVL0n5VmBtgs3RDcK0UVj45JSzY Q6JgSgLBLDBU7wjJ7jiMeOkIqQC62E++bMeetqcSbqDoQRB1rCtDoBhoeUXFA4TmmhfA FwiN824DrXPK09gdVxy87aw+CAeorSt1uTaReQcJ6lo0Kz05PFcUyg2F5ptjHNmrQwX3 95DBit1Kpk4uCLT27hfXIFddWwPdkfYQ15pKrxQLNX4dqBjEwRqhr2qwGvkF/wac+nFR 7P0e/upKpebbWObX+VC6d2Z0EePj34xKhkQEtID0EW0T9Ts+bbNwvfxqBuwmy/58NSka kExQ== X-Gm-Message-State: AEkooutoDUQ6Y4F94/UjzGaKE3uahE2Z1XSz6zlY4JWskEQh5q0AGzO02uWkc59NC+HQTY52gsXEZkIAYLexKQ== X-Received: by 10.194.110.162 with SMTP id ib2mr90614859wjb.163.1470770113627; Tue, 09 Aug 2016 12:15:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.134.102 with HTTP; Tue, 9 Aug 2016 12:14:52 -0700 (PDT) In-Reply-To: <57AA13FC.2000707@eagerm.com> References: <57AA13FC.2000707@eagerm.com> From: Gareth McMullin Date: Tue, 09 Aug 2016 19:15:00 -0000 Message-ID: Subject: Re: Remote Serial Protocol -- reply to '?' when target running To: Michael Eager Cc: "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00009.txt.bz2 On Wed, Aug 10, 2016 at 5:33 AM, Michael Eager wrote: > > When gdb connects to a remote target, it asks about > features, and then sends a '?' packet, asking why the > target is stopped. When the target connection is through > a JTAG pod, the pod may be able to respond to the feature > request, but not be able to determine what the current state of > the target is, likely because it is not stopped. What should a > JTAG pod reply in this case? > > The GDB Remote Protocol doc doesn't seem to be entirely consistent. > > The description for '?' is > Indicate the reason the target halted. The reply is the > same as for step and continue. > > The description for Stop Reply Packet says the following: > The =E2=80=98C=E2=80=99, =E2=80=98c=E2=80=99, =E2=80=98S=E2=80=99, =E2= =80=98s=E2=80=99, =E2=80=98vCont=E2=80=99, =E2=80=98vAttach=E2=80=99, =E2= =80=98vRun=E2=80=99, =E2=80=98vStopped=E2=80=99, > and =E2=80=98?=E2=80=99 packets can receive any of the below as a reply= . Except > for =E2=80=98?=E2=80=99 and =E2=80=98vStopped=E2=80=99, that reply is o= nly returned when the > target halts. > > This suggests that the target can reply to '?' even if it is not > stopped, which seems to contradict the description for '?'. But > none of the listed replies seem to be appropriate. None of the > replies look like "Don't bother me, I'm busy". > > How should the JTAG pod respond? What do most do in this situation? I can't comment on others, but the Black Magic debug project that I maintai= n [1] implements the extended-remote prototcol, and initially responds to '?' with 'W00' indicating the target exited (there is no attached target). The user initiates a scan for connected targets with 'monitor jtag_scan' from GDB, and then uses the GDB 'attach' command to connect, sending the 'vAttach' packet. This interrupts the target and the reply comes back as 'T05'. [1] https://github.com/blacksphere/blackmagic