public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "asmwarrior at gmail dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-15806-4717-eAewOorIOw@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15806-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=15806

--- Comment #10 from asmwarrior <asmwarrior at gmail dot com> ---
(In reply to asmwarrior from comment #9)
> 
> 5, So, we can change the if condition here is like:
>       if (c == '\\' ||  (c == quoter && quoter != 0))
> 	do_fputs ("\\", stream);
> 

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 *, struct
ui_file *),
     }
   else
     {
-      if (c == '\\' || c == quoter)
+      if ( (c == '\\' && quoter != 0) || c == quoter)
     do_fputs ("\\", stream);
       do_fprintf (stream, "%c", c);
     }


But the result is still bad, which lead to some unexpected issue in my comment
4.

-- 
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: <gdb-prs-return-15617-listarch-gdb-prs=sources.redhat.com@sourceware.org>
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: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
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" <sourceware-bugzilla@sourceware.org>
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: <bug-15806-4717-86mt7GWtnw@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-15806-4717@http.sourceware.org/bugzilla/>
References: <bug-15806-4717@http.sourceware.org/bugzilla/>
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\x15806

--- Comment #11 from asmwarrior <asmwarrior at gmail dot com> ---
@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.


  parent reply	other threads:[~2014-04-25  3:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 15:42 [Bug mi/15806] New: file path separator becomes "\\\\" instead of "\\" when GDB report breakpoint-modified in MI mode asmwarrior at gmail dot com
2013-07-31  3:36 ` [Bug mi/15806] " asmwarrior at gmail dot com
2013-07-31 15:29 ` asmwarrior at gmail dot com
2013-12-26 14:54 ` asmwarrior at gmail dot com
2013-12-27  2:30 ` asmwarrior at gmail dot com
2014-04-24 15:28 ` [Bug mi/15806] Some fields in async MI events get escaped twice simon.marchi at ericsson dot com
2014-04-24 15:28 ` simon.marchi at ericsson dot com
2014-04-24 15:32 ` simon.marchi at ericsson dot com
2014-04-24 15:33 ` simon.marchi at ericsson dot com
2014-04-25  0:52 ` asmwarrior at gmail dot com
2014-04-25  2:30 ` asmwarrior at gmail dot com
2014-04-25  3:10 ` asmwarrior at gmail dot com [this message]
2014-04-25 14:16 ` simon.marchi at ericsson dot com
2014-04-25 14:56 ` asmwarrior at gmail dot com
2014-04-25 19:37 ` simon.marchi at ericsson dot com
2014-04-25 19:51 ` marc.khouzam at ericsson dot com
2014-04-26 10:03 ` asmwarrior at gmail dot com
2014-09-25 18:14 ` simon.marchi at ericsson dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15806-4717-eAewOorIOw@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).