From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32329 invoked by alias); 27 Jul 2012 16:36:32 -0000 Received: (qmail 32174 invoked by uid 22791); 27 Jul 2012 16:36:30 -0000 X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Jul 2012 16:36:09 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6RGa5Mo020457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Jul 2012 12:36:05 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6RGa3d1003200; Fri, 27 Jul 2012 12:36:04 -0400 Message-ID: <5012C373.4050006@redhat.com> Date: Fri, 27 Jul 2012 16:36:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: 7.4->7.5 Regression gdb.base/pending.exp with gdbserver [Re: [PATCH] Dynamic printf for a target agent] References: <4FC57340.6070306@earthlink.net> <4FF1E5FA.2010801@earthlink.net> <20120718191741.GA13886@host2.jankratochvil.net> <2625393.59PdMiRRzQ@qiyao.dyndns.org> In-Reply-To: <2625393.59PdMiRRzQ@qiyao.dyndns.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: 2012-07/txt/msg00698.txt.bz2 On 07/20/2012 03:27 AM, Yao Qi wrote: >> /* Skip tokens until we find one that we recognize. */ >> - while (*dataptr && *dataptr != 'X' && *dataptr != ';') >> + while (*dataptr && *dataptr != ';') > > It seems incorrect to remove "*dataptr != 'X'" out of this condition checking. > > With the breakpoint commands added, the Z packet becomes > > "Z0xxxxXxxxx,Xxxxx;cmds:xxxxx" > > When parsing this packet, in current (wrong) GDBserver, only the first > condition ('Xxxxx') in packet is added, and the rest of conditions are skipped, > which is a mistake. > > The fix is just to revert this change. Regression tested on x86_64/gdbserver, > and these fails are fixed. The original intent of this (before "cmds:" was added) was to skip all the way to the next ';', in case in the future GDB sends some newer component (the things in between ';'s.) We now have "X" and "cmds:". It seems a little better to not try to always skip unknown characters and hard code X, but instead skip characters only when we find we didn't recognize one. Does this look correct to you? No regressions on x86_64 Fedora 17. 2012-07-27 Pedro Alves * server.c (process_point_options): Only skip tokens if we find one that is unrecognized. Don't treat 'X' specially while skipping unrecognized tokens. --- gdb/gdbserver/server.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4e15b3c..547552f 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2938,14 +2938,12 @@ process_point_options (CORE_ADDR point_addr, char **packet) } else { - /* Unrecognized token, just skip it. */ fprintf (stderr, "Unknown token %c, ignoring.\n", *dataptr); + /* Skip tokens until we find one that we recognize. */ + while (*dataptr && *dataptr != ';') + dataptr++; } - - /* Skip tokens until we find one that we recognize. */ - while (*dataptr && *dataptr != 'X' && *dataptr != ';') - dataptr++; } *packet = dataptr; } -- Pedro Alves