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/16868] New: Wrong escaping of "script" in breakpoint-created event


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.


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