This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug mi/15806] file path separator becomes "\\\\" instead of "\\" when GDB report breakpoint-modified in MI mode
- From: "asmwarrior at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 31 Jul 2013 03:35:56 +0000
- Subject: [Bug mi/15806] file path separator becomes "\\\\" instead of "\\" when GDB report breakpoint-modified in MI mode
- Auto-submitted: auto-generated
- References: <bug-15806-4717 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=15806
--- Comment #1 from asmwarrior <asmwarrior at gmail dot com> ---
When I debug gdb under gdb, I found that in the first step that gdb translate a
single backslash to to a double backslash, and in the second step, gdb
translate this again, so we finally get a four backslash.
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);
}
First step happens in call gdb_breakpoint_query
Second step happens in gdb_flush function call
which the call stack:
[debug]#0 printchar (c=98, do_fputs=0x60efd2 <fputs_unfiltered>,
do_fprintf=0x60c9cb <fprintf_unfiltered>, stream=0x2940a8, quoter=0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\utils.c:1507
[debug]#1 0x0060ba96 in fputstrn_unfiltered (str=0x2f7b238
"breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00401497\",func=\"main()\",file=\"E:\\\\code\\\\cb\\\\test_code\\\\debug_gdb2011-12-01\\\\main.cpp\",fullname=\"E:\\\\code\\\\cb\\\\tes"...,
n=312, quoter=0, stream=0x2940a8) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\utils.c:1585
[debug]#2 0x004573c3 in mi_console_raw_packet (data=0x2f11980, buf=0x2f7b238
"breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x00401497\",func=\"main()\",file=\"E:\\\\code\\\\cb\\\\test_code\\\\debug_gdb2011-12-01\\\\main.cpp\",fullname=\"E:\\\\code\\\\cb\\\\tes"...,
length_buf=312) at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-console.c:120
[debug]#3 0x0060f4b1 in mem_file_put (file=0x2f119d8, write=0x4572e6
<mi_console_raw_packet>, dest=0x2f11980) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\ui-file.c:451
[debug]#4 0x0060ef40 in ui_file_put (file=0x2f119d8, write=0x4572e6
<mi_console_raw_packet>, dest=0x2f11980) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\ui-file.c:217
[debug]#5 0x00457442 in mi_console_file_flush (file=0x2f11938) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-console.c:136
[debug]#6 0x0060eef0 in gdb_flush (file=0x2f11938) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\ui-file.c:197
[debug]#7 0x0045c986 in mi_breakpoint_modified (b=0x2f93ca8) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-interp.c:707
[debug]#8 0x00562e3c in observer_breakpoint_modified_notification_stub
(data=0x45c8a0 <mi_breakpoint_modified>, args_data=0x29df50c) at
f:\build_gdb\gdb\gdbgit\debugbuild1\gdb\observer.inc:611
[debug]#9 0x005623d0 in generic_observer_notify (subject=0x2f11fe0,
args=0x29df50c) at f:\build_gdb\gdb\gdbgit\gdb\gdb\observer.c:167
[debug]#10 0x00562eba in observer_notify_breakpoint_modified (b=0x2f93ca8) at
f:\build_gdb\gdb\gdbgit\debugbuild1\gdb\observer.inc:636
[debug]#11 0x004ad19c in bpstat_stop_status (aspace=0x2f0bce0, bp_addr=4199575,
ptid=..., ws=0x29df80c) at f:\build_gdb\gdb\gdbgit\gdb\gdb\breakpoint.c:5293
[debug]#12 0x00517e0f in handle_inferior_event (ecs=0x29df7fc) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\infrun.c:4208
[debug]#13 0x005153cc in wait_for_inferior () at
f:\build_gdb\gdb\gdbgit\gdb\gdb\infrun.c:2743
[debug]#14 0x005148cb in proceed (addr=2089816591, siggnal=GDB_SIGNAL_0,
step=0) at f:\build_gdb\gdb\gdbgit\gdb\gdb\infrun.c:2324
[debug]#15 0x0050d9f8 in run_command_1 (args=0x0, from_tty=0, tbreak_at_main=0)
at f:\build_gdb\gdb\gdbgit\gdb\gdb\infcmd.c:607
[debug]#16 0x0050da28 in run_command (args=0x0, from_tty=0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\infcmd.c:617
[debug]#17 0x0044b968 in do_cfunc (c=0x2ee7be8, args=0x0, from_tty=0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\cli\cli-decode.c:113
[debug]#18 0x0044e2ce in cmd_func (cmd=0x2ee7be8, args=0x0, from_tty=0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\cli\cli-decode.c:1888
[debug]#19 0x0060832a in execute_command (p=0x32cc11b "", from_tty=0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\top.c:478
[debug]#20 0x004612b9 in mi_execute_cli_command (cmd=0x7842a4
<__PRETTY_FUNCTION__.23215+297> "run", args_p=0, args=0x0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-main.c:2219
[debug]#21 0x0045df2b in mi_cmd_exec_run (command=0x2f9a8e0 "exec-run",
argv=0x2f16668, argc=0) at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-main.c:406
[debug]#22 0x00461173 in mi_cmd_execute (parse=0x32f8198) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-main.c:2171
[debug]#23 0x004608fd in captured_mi_execute_command (uiout=0x2f11ac0,
context=0x32f8198) at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-main.c:1922
[debug]#24 0x00460ca7 in mi_execute_command (cmd=0x32cc1d0 "-exec-run",
from_tty=1) at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-main.c:2041
[debug]#25 0x0045bf4d in mi_execute_command_wrapper (cmd=0x32cc1d0 "-exec-run")
at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-interp.c:311
[debug]#26 0x0045bf60 in mi_execute_command_input_handler (cmd=0x32cc1d0
"-exec-run") at f:\build_gdb\gdb\gdbgit\gdb\gdb\mi\mi-interp.c:319
[debug]#27 0x00532696 in gdb_readline2 (client_data=0x0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\event-top.c:712
[debug]#28 0x00531f00 in stdin_event_handler (error=0, client_data=0x0) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\event-top.c:373
[debug]#29 0x005310e2 in handle_file_event (data=...) at
f:\build_gdb\gdb\gdbgit\gdb\gdb\event-loop.c:768
[debug](More stack frames follow...)
[debug]>>>>>>cb_gdb:
When you look at the #2, you see that the string is correct, file=\"E:\\\\code,
you can see, there is two backslash after the colon. (Note, GDB show char " as
\", and show char\ as \\ )
but in printchar() function, there have extra "\" added in the code snippet:
if (c == '\\' || c == quoter)
do_fputs ("\\", stream);
do_fprintf (stream, "%c", c);
So, finally, the two backslash become four backslash, that's why I see the
wrong log message.
Anyone can suggest a solution?
--
You are receiving this mail because:
You are on the CC list for the bug.