RE: [PATCH] PR mi/15806: Fix quoting of async events

Marc Khouzam
2014-04-28T18:36:18Z

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Simon Marchi
> Sent: Saturday, April 26, 2014 11:08 PM
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi
> Subject: [PATCH] PR mi/15806: Fix quoting of async events
>
> The quoting in whatever goes in the event_channel of MI is little bit broken.
>
> Link for the lazy:
> https://sourceware.org/bugzilla/show_bug.cgi?id=15806
>
> Here is an example of a =library-loaded event with an ill-named directory,
> /tmp/how"are\you (the problem is present with every directory on
> Windows since it uses backslashes as a path separator). The result will be the
> following:
>
> =library-loaded,id="/tmp/how"are\\you/libexpat.so.1",...
>
> The " between 'how' and 'are' should be escaped.
>
> Another bad behavior is double escaping in =breakpoint-created, for
> example:
>
> =breakpoint-
> created,bkpt={...,fullname="/tmp/how\\"are\\\\you/test.c",...}

Another impact of this bug is that a frontend cannot properly obtain
the string used in a dprintf that was created from the console. If a
user manually creates a dprintf, the frontend would use
=breakpoint-created to show this new dprintf. With this bug
it becomes problematic to extract the printf string to be used.

I am not familiar with the intricacies of MI output escaping but I can
confirm that the patch proposed by Simon fixes the issue I am seeing
with Eclipse and dprintf.

I don't know if it is too late for the maintenance release, but in case
it is not, let me add my vote to have it included in 7.7.1.

Thanks

Marc