This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug mi/15806] file path separator becomes "\\\\" instead of "\\" when GDB report breakpoint-modified in MI mode


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]