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] file path separator becomes "\\\\" instead of "\\" when GDB report breakpoint-modified in MI mode
Date: Wed, 31 Jul 2013 15:29:00 -0000	[thread overview]
Message-ID: <bug-15806-4717-smI5hp4hna@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15806-4717@http.sourceware.org/bugzilla/>

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

--- Comment #2 from asmwarrior <asmwarrior at gmail dot com> ---
Now, I can see the reason:

static void
mi_breakpoint_modified (struct breakpoint *b)
{
  struct mi_interp *mi = top_level_interpreter_data ();
  struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
  volatile struct gdb_exception e;

  if (mi_suppress_notification.breakpoint)
    return;

  if (b->number <= 0)
    return;

  target_terminal_ours ();
  fprintf_unfiltered (mi->event_channel,
              "breakpoint-modified");
  /* We want the output from gdb_breakpoint_query to go to
     mi->event_channel.  One approach would be to just call
     gdb_breakpoint_query, and then use mi_out_put to send the current
     content of mi_outout into mi->event_channel.  However, that will
     break if anything is output to mi_uiout prior to calling the
     breakpoint_created notifications.  So, we use
     ui_out_redirect.  */
  ui_out_redirect (mi_uiout, mi->event_channel);
  TRY_CATCH (e, RETURN_MASK_ERROR)
    gdb_breakpoint_query (mi_uiout, b->number, NULL);
  ui_out_redirect (mi_uiout, NULL);

  gdb_flush (mi->event_channel);
}

Look at the comment, there is a redirection of the output stream.
In the first step, gdb_breakpoint_query (mi_uiout, b->number, NULL); GDB just
output the message for the first time, so one backslash becomes two backslash.
Now, after the ui_out_redirect (mi_uiout, NULL);, in gdb_flush, GDB did again,
so two backslash becomes four backslash.

My solution is: we should let the doubling feature only happens in one step.

I just look at other GDB mi messages mechanism, I see that: "gdb_flush
(mi->event_channel);" always does a "doubling backslash", so I suggest disable
this feature in "gdb_breakpoint_query (mi_uiout, b->number, NULL);".

Any ideas?

Thanks.
Yuanhui Zhang

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2013-07-31 15:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 15:42 [Bug mi/15806] New: " 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 [this message]
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
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-smI5hp4hna@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).