From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27944 invoked by alias); 16 May 2014 17:58:48 -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 27931 invoked by uid 89); 16 May 2014 17:58:48 -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: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 16 May 2014 17:58:46 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 5A.DE.02831.AEFF5735; Fri, 16 May 2014 14:09:14 +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 13:58:39 -0400 Message-ID: <537651BA.3020001@ericsson.com> Date: Fri, 16 May 2014 17:58: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> In-Reply-To: <878uq17mrq.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00306.txt.bz2 On 14-05-16 11:42 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> The quoting in whatever goes in the event_channel of MI is little > Simon> bit broken. Link for the lazy: > Simon> https://sourceware.org/bugzilla/show_bug.cgi?id=15806 > > Thanks for looking at this. > > A long time ago I wrote a somewhat similar patch, but I don't think I > noticed some of the issues you dug up. Mine was here, I don't recall > why it didn't go in: > > https://www.sourceware.org/ml/gdb-patches/2011-01/msg00518.html > > Simon> In retrospect, there is no way escaping can be done reliably in > Simon> mi_console_raw_packet for data that is already formatted, such as > Simon> event_channel. At this point, there is no way to differentiate > Simon> quotes that delimit field values from those that should be > Simon> escaped. In the case of other MI consoles, it is ok since > Simon> mi_console_raw_packet receives one big string that should be > Simon> quoted and escaped as a whole. > > Simon> So, first part of the fix: for the MI channels that specify no > Simon> quoting character, no escaping at all should be done in > Simon> mi_console_raw_packet (that's the change in printchar, thanks to > Simon> Yuanhui Zhang for this). > > Seems reasonable. > > Did you check the other callers of printchar, even indirect ones? > I did a spot check and didn't see any issues, but it would be reassuring > if you could look. The only direct callers of printchar are fputstr_filtered, fputstr_unfiltered, fputstrn_filtered and fputstrn_unfiltered. To the best of my knowledge, the change should not impact the callers of those. Semi-related: while looking at that, I realized that unlike mi_field_string, mi_field_fmt does no escaping at all. It doesn't seem like a problem right now, since mi_field_fmt is only used with things that don't really need escaping anyway (numbers, or hex strings). Still, it makes an inconsistent API and would be nice to fix, I think. > Simon> 2014-04-26 Simon Marchi > Simon> PR mi/15806 > Simon> * utils.c (printchar): Don't escape at all if quoter is NUL. > Simon> * mi/mi-interp.c (mi_solib_loaded): Use ui_out_field_* functions to > Simon> generate the output. > Simon> (mi_solib_unloaded): Same. > > Simon> 2014-04-26 Simon Marchi > > Simon> * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix > Simon> erroneous dprintf expected input. > > This is ok. Before putting it in could you, if needed, look into the > printchar thing and then reply? Thank you. Like I said, I think it is ok. I will wait a few days so that other people can take a look and see if they find some problems. Thanks, Simon