public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simon.marchi at ericsson dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug mi/16868] New: Wrong escaping of "script" in breakpoint-created event
Date: Wed, 23 Apr 2014 19:40:00 -0000	[thread overview]
Message-ID: <bug-16868-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-04-23 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 19:40 simon.marchi at ericsson dot com [this message]
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

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-16868-4717@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).