From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19255 invoked by alias); 5 Feb 2014 20:33:28 -0000 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 Received: (qmail 19245 invoked by uid 89); 5 Feb 2014 20:33:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Feb 2014 20:33:27 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s15KXPYt013828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Feb 2014 15:33:25 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s15KXNhH002174; Wed, 5 Feb 2014 15:33:24 -0500 Message-ID: <52F2A013.8000903@redhat.com> Date: Wed, 05 Feb 2014 20:33:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [RFC 2/9] move some rsp bits into rsp-low.h References: <1390245501-1186-1-git-send-email-tromey@redhat.com> <1390245501-1186-3-git-send-email-tromey@redhat.com> In-Reply-To: <1390245501-1186-3-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-02/txt/msg00050.txt.bz2 On 01/20/2014 07:18 PM, Tom Tromey wrote: > This moves various low-level remote serial protocol bits into > common/rsp-low.[ch]. > > This is as close to a pure move as possible. There are some > redundancies remaining but those will be dealt with in a subsequent > patch. > > Note that the two variants of remote_escape_output disagreed on the > treatment of "*". On the theory that quoting cannot hurt but the > absence possibly can, I chose the gdbserver variant to be the > canonical one. Hmm. This makes me a tiny bit nervous. What if some random silly stub out there is checking that the resulting byte after unescaping is one of '#', '$' or '}'? But maybe that's being overzealous... > +int > +remote_unescape_input (const gdb_byte *buffer, int len, > + gdb_byte *out_buf, int out_maxlen) > +{ > + int input_index, output_index; > + int escaped; > + > + output_index = 0; > + escaped = 0; > + for (input_index = 0; input_index < len; input_index++) > + { > + gdb_byte b = buffer[input_index]; > + > + if (output_index + 1 > out_maxlen) > + error ("Received too much data from the target."); Note this loses i18n in GDB. Please add _(). Also, in the GDB this particular error was actually warning, but I think it's fine to make it an error. I also notice that "target" in "from the target" isn't right in the gdbserver case, but that's a preexisting minor issue. > + > + if (escaped) > + { > + out_buf[output_index++] = b ^ 0x20; > + escaped = 0; > + } > + else if (b == '}') > + escaped = 1; > + else > + out_buf[output_index++] = b; > + } > + > + if (escaped) > + error ("Unmatched escape character in target response."); i18n. > + > + return output_index; > +} > + > @@ -163,7 +163,8 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \ > $(srcdir)/common/linux-osdata.c $(srcdir)/common/ptid.c \ > $(srcdir)/common/buffer.c $(srcdir)/common/linux-btrace.c \ > $(srcdir)/common/filestuff.c $(srcdir)/target/waitstatus.c \ > - $(srcdir)/common/mips-linux-watch.c $(srcdir)/common/cells.c > + $(srcdir)/common/mips-linux-watch.c $(srcdir)/common/cells.c \ > + $(srcdir)/common/rsp-low.c Something odd with indentation? Otherwise, this looks fine to me. -- Pedro Alves