From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8147 invoked by alias); 25 Apr 2014 03:10:18 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 8042 invoked by uid 48); 25 Apr 2014 03:10:06 -0000 From: "asmwarrior at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug mi/15806] Some fields in async MI events get escaped twice Date: Fri, 25 Apr 2014 03:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: mi X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: asmwarrior at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q2/txt/msg00122.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D15806 --- Comment #10 from asmwarrior --- (In reply to asmwarrior from comment #9) >=20 > 5, So, we can change the if condition here is like: > if (c =3D=3D '\\' || (c =3D=3D quoter && quoter !=3D 0)) > do_fputs ("\\", stream); >=20 Oh, there is a mistake in the above. The correct patch is: gdb/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/utils.c b/gdb/utils.c index a8a7cb3..31bdb7e 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1539,7 +1539,7 @@ printchar (int c, void (*do_fputs) (const char *, str= uct ui_file *), } else { - if (c =3D=3D '\\' || c =3D=3D quoter) + if ( (c =3D=3D '\\' && quoter !=3D 0) || c =3D=3D quoter) do_fputs ("\\", stream); do_fprintf (stream, "%c", c); } But the result is still bad, which lead to some unexpected issue in my comm= ent 4. --=20 You are receiving this mail because: You are on the CC list for the bug. >>From gdb-prs-return-15617-listarch-gdb-prs=sources.redhat.com@sourceware.org Fri Apr 25 03:35:21 2014 Return-Path: Delivered-To: listarch-gdb-prs@sources.redhat.com Received: (qmail 23898 invoked by alias); 25 Apr 2014 03:35:20 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Delivered-To: mailing list gdb-prs@sourceware.org Received: (qmail 23864 invoked by uid 48); 25 Apr 2014 03:35:19 -0000 From: "asmwarrior at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug mi/15806] Some fields in async MI events get escaped twice Date: Fri, 25 Apr 2014 03:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: mi X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: asmwarrior at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q2/txt/msg00123.txt.bz2 Content-length: 1520 https://sourceware.org/bugzilla/show_bug.cgi?id=15806 --- Comment #11 from asmwarrior --- @Simon, I think the patch in comment 10 is a good fix. Look at the issue statement in my comment 4, I think the code below static void mi_solib_loaded (struct so_list *solib) { struct mi_interp *mi = top_level_interpreter_data (); target_terminal_ours (); if (gdbarch_has_global_solist (target_gdbarch ())) fprintf_unfiltered (mi->event_channel, "library-loaded,id=\"%s\",target-name=\"%s\"," "host-name=\"%s\",symbols-loaded=\"%d\"", solib->so_original_name, solib->so_original_name, solib->so_name, solib->symbols_loaded); else fprintf_unfiltered (mi->event_channel, "library-loaded,id=\"%s\",target-name=\"%s\"," "host-name=\"%s\",symbols-loaded=\"%d\"," "thread-group=\"i%d\"", solib->so_original_name, solib->so_original_name, solib->so_name, solib->symbols_loaded, current_inferior ()->num); gdb_flush (mi->event_channel); } should fix itself, not the gdb_flush (mi->event_channel). I mean, since mi->event_channel is created with quoter = 0, which means when user put some text in the mi->event_channel, they should do their escape handling themselves. Once gdb_flush (mi->event_channel) is called, it should not add more backslashes(escape handling). What do you think? -- You are receiving this mail because: You are on the CC list for the bug.