From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19079 invoked by alias); 10 Oct 2008 14:54:35 -0000 Received: (qmail 19013 invoked by uid 22791); 10 Oct 2008 14:54:33 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 10 Oct 2008 14:53:58 +0000 Received: (qmail 32114 invoked from network); 10 Oct 2008 14:53:56 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Oct 2008 14:53:56 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [commit] remote: make the whole connection setup exception safe Date: Fri, 10 Oct 2008 14:54:00 -0000 User-Agent: KMail/1.9.9 References: <200810090429.45346.pedro@codesourcery.com> In-Reply-To: <200810090429.45346.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Fy27IE7n6TbgBMr" Message-Id: <200810101553.57601.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00321.txt.bz2 --Boundary-00=_Fy27IE7n6TbgBMr Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 659 Sorry, this broke `target extended-remote' if the stub reports that it isn't controlling any process yet (gdbserver --multi). I missed that there's a return statement in the middle of remote_start_remote, which makes us not send '!' in that case. remote_start_remote: if (rs->buf[0] == 'W' || rs->buf[0] == 'X') { if (args->extended_p) { /* We're connected, but not running. Drop out before we call start_remote. */ target_mark_exited (args->target); return; } Fixed by just sending '!' earlier, like below. Checked in. We should have a test for extended/persistent connections. Let me cook something up. -- Pedro Alves --Boundary-00=_Fy27IE7n6TbgBMr Content-Type: text/x-diff; charset="utf-8"; name="extended.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="extended.diff" Content-length: 1325 2008-10-10 Pedro Alves gdb/ * remote.c (remote_start_remote): Always tell the stub if we're in extended-remote. --- gdb/remote.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) Index: src/gdb/remote.c =================================================================== --- src.orig/gdb/remote.c 2008-10-09 15:57:48.000000000 +0100 +++ src/gdb/remote.c 2008-10-10 14:58:30.000000000 +0100 @@ -2419,6 +2419,13 @@ remote_start_remote (struct ui_out *uiou rs->noack_mode = 1; } + if (args->extended_p) + { + /* Tell the remote that we are using the extended protocol. */ + putpkt ("!"); + getpkt (&rs->buf, &rs->buf_size, 0); + } + /* Next, if the target can specify a description, read it. We do this before anything involving memory or registers. */ target_find_description (); @@ -2482,13 +2489,6 @@ remote_start_remote (struct ui_out *uiou immediate_quit--; start_remote (args->from_tty); /* Initialize gdb process mechanisms. */ - if (args->extended_p) - { - /* Tell the remote that we are using the extended protocol. */ - putpkt ("!"); - getpkt (&rs->buf, &rs->buf_size, 0); - } - /* If we connected to a live target, do some additional setup. */ if (target_has_execution) { --Boundary-00=_Fy27IE7n6TbgBMr--