From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by sourceware.org (Postfix) with ESMTPS id 393323857C45 for ; Tue, 21 Jul 2020 19:34:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 393323857C45 IronPort-SDR: jIo7xdEOSpbxud8g38EkOyOZ7ra7+hocUxtY3uKVlwyd8rpOOMZ3Pd7qHYX8aNA+PhRexqcxYg 9ptYn17/FoLWvbohn/WvAyzxHYjIYxWDR1aSR0hKhl453vUbMuZn4qLImnfMA0KN2O4bwOt5D0 WsN/gxM/bo5qIeJXl9Vdu2Zurh0HPEf8BXBreyzJBivk4fDWAJck88qy7Aex61k5sF7vMLDDj3 8Dvp3X3mar/ES4ddIY6HQDoumtDpPb1X6I30ZcHCPTp+9HKoYuzShy+0vKD+hLj5BBAiCSEo7N qDA= X-IronPort-AV: E=Sophos;i="5.75,379,1589212800"; d="scan'208";a="143139843" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 22 Jul 2020 03:34:34 +0800 IronPort-SDR: nZ1C5kNO7A+ny1hBvMgbiRWuoTqu5OWh9uIbJMnTxpec9sXqDHxUYgD/kcFJ1JwIWlNFSW8Q5v sNQs47d6VRNRy+jPzZ0itTtwA5CygW7mM= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 12:22:16 -0700 IronPort-SDR: +1AWTbr5tzZru9oCqQi/SUCA8iYnocnOl+f3YqcWMfVn9a8pupcwiUmaMg6qAP6o5t7MF9zsLv eYXxEyiSUoNg== WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 12:34:34 -0700 Date: Tue, 21 Jul 2020 20:34:29 +0100 (BST) From: "Maciej W. Rozycki" To: Reuben Thomas cc: Christo Crause , Reuben Thomas via Gdb Subject: Re: Remote protocol question: the documentation says '?' is not required, but maybe it is? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2020 19:34:36 -0000 On Tue, 21 Jul 2020, Reuben Thomas wrote: > > FYI, I do believe `?' is indeed mandatory, as GDB needs to figure out the > > initial state of the remote target as it has connected to it, and there is > > no other way. > > It seems to be more complicated than that. In principle, '?' isn't needed > in principle to figure out the initial state: the T packet, or in my > current case, the S packet tells GDB the signal, and yet GDB still asks for > it again with '?'. The signal that caused the remote to halt is not going > to change until the next 'c', so there's no need for GDB to ask for it > again; and yet it does. I take you mean a `T' or `S' stop reply, right? Well, such replies are only expected by GDB in response to specific packets, which are all listed at the top of Section E.3 "Stop Reply Packets". If you issue an unsolicited stop reply from your debug stub, then at best GDB will ignore it and at worst GDB will get confused. > It looks indeed as if not supporting '?' will mean trouble. Further, around > line 4580, we find: > > /* Ack any packet which the remote side has already sent. */ > remote_serial_write ("+", 1); > > so it looks as though the first packet the stub sends is ignored. Indeed, GDB may have connected to the remote stub, say, over a serial line, so stale data may have already been buffered by serial hardware or the OS and anything on the fly is not considered valid data until both ends have synchronised. HTH, Maciej