From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12373 invoked by alias); 16 May 2014 19:57:18 -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 12355 invoked by uid 89); 16 May 2014 19:57:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 16 May 2014 19:57:17 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 20.A5.07420.F1E16735; Fri, 16 May 2014 16:18:07 +0200 (CEST) Received: from [142.133.110.254] (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.84) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 16 May 2014 15:57:13 -0400 Message-ID: <53766D85.3070402@ericsson.com> Date: Fri, 16 May 2014 19:57:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Tom Tromey CC: Subject: Re: [PATCH] PR mi/15806: Fix quoting of async events References: <1398568091-21253-1-git-send-email-simon.marchi@ericsson.com> <878uq17mrq.fsf@fleche.redhat.com> <537651BA.3020001@ericsson.com> <87ha4p60qg.fsf@fleche.redhat.com> In-Reply-To: <87ha4p60qg.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00312.txt.bz2 On Fri 16 May 2014 02:24:07 PM EDT, Tom Tromey wrote: > Tom> Did you check the other callers of printchar, even indirect ones? > Tom> I did a spot check and didn't see any issues, but it would be reassuring > Tom> if you could look. > > Simon> The only direct callers of printchar are fputstr_filtered, > Simon> fputstr_unfiltered, fputstrn_filtered and fputstrn_unfiltered. To the > Simon> best of my knowledge, the change should not impact the callers of > Simon> those. > > Yeah, by "indirect ones" I meant callers of these as well. > I looked through them. fputstr_unfiltered is safe. fputstrn_filtered > is not used. But for fputstrn_unfiltered, I see in remote.c: > > static char * > escape_buffer (const char *buf, int n) > [...] > fputstrn_unfiltered (buf, n, 0, stb); > > So it seems like this change could impact remote. > To know for sure, you'd have to dig a bit deeper. > > One option might be to make QUOTER==-1 special, then update the call in > mi_console_raw_packet. Indeed, there will be a difference with backslashes in the "set debug remote 1" output. Here is a small test I did. I modified the qxfer threads handler to add to its output. Before: Packet received: l \n\n\n After: Packet received: l \n\n\n So yeah, here, we don't have a quoter, but we want to escape backslashes anyway. As you suggested, quoter == -1 could have a special meaning to modify the behavior of printchar. However, I think we are mixing two things that are not related. Why should the fact that I want to escape the " character influence whether I want to escape \ ? And vice-versa. They seem quite independent to me. And if there are independent, it could mean we need two separate parameters, one saying if we want to escape a quoting character and another saying if we want to escape the backslashes. WDYT? Simon