public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event
@ 2014-04-23 19:40 simon.marchi at ericsson dot com
  2014-04-24  3:42 ` [Bug mi/16868] " asmwarrior at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: simon.marchi at ericsson dot com @ 2014-04-23 19:40 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16868
           Summary: Wrong escaping of "script" in breakpoint-created event
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com

When the =breakpoint-created event is emitted following the creation of a
dprintf, the escaping of the script field is wrong.

How to reproduce:

$ gdb -i mi ~/src/a.out
=thread-group-added,id="i1"
=cmd-param-changed,param="debug-file-directory",value="/usr/lib/debug"
=cmd-param-changed,param="auto-load safe-path",value="/"
=cmd-param-changed,param="pagination",value="off"
=cmd-param-changed,param="python print-stack",value="full"
=cmd-param-changed,param="non-stop",value="on"
=cmd-param-changed,param="target-async",value="on"
~"Reading symbols from /home/simark/src/a.out..."
~"done.\n"
(gdb) 
dprintf main, "hello\n"
&"dprintf main, \"hello\\n\"\n"
~"Dprintf 1 at 0x400a29: file test.c, line 55.\n"
=breakpoint-created,bkpt={number="1",type="dprintf",disp="keep",enabled="y",addr="0x0000000000400a29",func="main",file="test.c",fullname="/home/simark/src/test.c",line="55",thread-groups=["i1"],times="0",script={"printf
\\"hello\\\\n\\""},original-location="main"}
^done
(gdb) 

The bad part is: "printf \\"hello\\\\n\\""

It seems like escaping is called twice. A parser trying to read the string will
end think it ends at the " just before hello.

The correct value would be: "printf \"hello\\n\""

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug mi/16868] Wrong escaping of "script" in breakpoint-created event
  2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
@ 2014-04-24  3:42 ` asmwarrior at gmail dot com
  2014-04-24  3:44 ` asmwarrior at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: asmwarrior at gmail dot com @ 2014-04-24  3:42 UTC (permalink / raw)
  To: gdb-prs

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

asmwarrior <asmwarrior at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asmwarrior at gmail dot com

--- Comment #1 from asmwarrior <asmwarrior at gmail dot com> ---
Hi, I have a very similar bug report, see #15806, the doubled backslash issue.
The reason is that some strings were translated twice, once it was translated,
the backslash get doubled.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug mi/16868] Wrong escaping of "script" in breakpoint-created event
  2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
  2014-04-24  3:42 ` [Bug mi/16868] " asmwarrior at gmail dot com
@ 2014-04-24  3:44 ` asmwarrior at gmail dot com
  2014-04-24 14:37 ` simon.marchi at ericsson dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: asmwarrior at gmail dot com @ 2014-04-24  3:44 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from asmwarrior <asmwarrior at gmail dot com> ---
The link of bug 15806 is here:
https://sourceware.org/bugzilla/show_bug.cgi?id=15806

Yuanhui Zhang

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug mi/16868] Wrong escaping of "script" in breakpoint-created event
  2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
  2014-04-24  3:42 ` [Bug mi/16868] " asmwarrior at gmail dot com
  2014-04-24  3:44 ` asmwarrior at gmail dot com
@ 2014-04-24 14:37 ` simon.marchi at ericsson dot com
  2014-04-24 14:48 ` asmwarrior at gmail dot com
  2014-04-24 15:28 ` simon.marchi at ericsson dot com
  4 siblings, 0 replies; 6+ messages in thread
From: simon.marchi at ericsson dot com @ 2014-04-24 14:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Simon Marchi <simon.marchi at ericsson dot com> ---
asmwarrior, you are right, it is the same bug. It happens many times in MI
async events. Is it possible to rename your bug to make it more generic? Then
we can mark this one as duplicate.

Two other examples:

=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000400a29",func="main",file="test.c",fullname="/home/simark/src/test.c",line="55",thread-groups=["i1"],times="0",script={"echo
hey\\"you"},original-location="main"}
=cmd-param-changed,param="prompt",value="\\"tourlou\\""

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug mi/16868] Wrong escaping of "script" in breakpoint-created event
  2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
                   ` (2 preceding siblings ...)
  2014-04-24 14:37 ` simon.marchi at ericsson dot com
@ 2014-04-24 14:48 ` asmwarrior at gmail dot com
  2014-04-24 15:28 ` simon.marchi at ericsson dot com
  4 siblings, 0 replies; 6+ messages in thread
From: asmwarrior at gmail dot com @ 2014-04-24 14:48 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from asmwarrior <asmwarrior at gmail dot com> ---
(In reply to Simon Marchi from comment #3)
> asmwarrior, you are right, it is the same bug. It happens many times in MI
> async events. Is it possible to rename your bug to make it more generic?
> Then we can mark this one as duplicate.
> 
> Two other examples:
> 
> =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",
> enabled="y",addr="0x0000000000400a29",func="main",file="test.c",fullname="/
> home/simark/src/test.c",line="55",thread-groups=["i1"],times="0",
> script={"echo hey\\"you"},original-location="main"}
> =cmd-param-changed,param="prompt",value="\\"tourlou\\""
Hi, Simon, good suggestion.
Every one can change the bug title, so if you have a better name for the
general bug, you can directly edit that bug title. 

I have debugged that bug a little, you can see some of my analysis in that
bug's comments, GDB should have a state variable for the out put stream, so if
it backslash is already doubled, we won't double it for the next stream copy.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug mi/16868] Wrong escaping of "script" in breakpoint-created event
  2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
                   ` (3 preceding siblings ...)
  2014-04-24 14:48 ` asmwarrior at gmail dot com
@ 2014-04-24 15:28 ` simon.marchi at ericsson dot com
  4 siblings, 0 replies; 6+ messages in thread
From: simon.marchi at ericsson dot com @ 2014-04-24 15:28 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Simon Marchi <simon.marchi at ericsson dot com> ---
Marking as dup.

*** This bug has been marked as a duplicate of bug 15806 ***

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-24 15:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23 19:40 [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event simon.marchi at ericsson dot com
2014-04-24  3:42 ` [Bug mi/16868] " asmwarrior at gmail dot com
2014-04-24  3:44 ` asmwarrior at gmail dot com
2014-04-24 14:37 ` simon.marchi at ericsson dot com
2014-04-24 14:48 ` asmwarrior at gmail dot com
2014-04-24 15:28 ` simon.marchi at ericsson dot com

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).