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

Tom Tromey
2014-05-16T15:42:56Z

>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:

Simon> The quoting in whatever goes in the event_channel of MI is little
Simon> bit broken. Link for the lazy:
Simon> https://sourceware.org/bugzilla/show_bug.cgi?id=15806

Thanks for looking at this.

A long time ago I wrote a somewhat similar patch, but I don't think I
noticed some of the issues you dug up. Mine was here, I don't recall
why it didn't go in:

https://www.sourceware.org/ml/gdb-patches/2011-01/msg00518.html

Simon> In retrospect, there is no way escaping can be done reliably in
Simon> mi_console_raw_packet for data that is already formatted, such as
Simon> event_channel. At this point, there is no way to differentiate
Simon> quotes that delimit field values from those that should be
Simon> escaped. In the case of other MI consoles, it is ok since
Simon> mi_console_raw_packet receives one big string that should be
Simon> quoted and escaped as a whole.

Simon> So, first part of the fix: for the MI channels that specify no
Simon> quoting character, no escaping at all should be done in
Simon> mi_console_raw_packet (that's the change in printchar, thanks to
Simon> Yuanhui Zhang for this).

Seems reasonable.

Did you check the other callers of printchar, even indirect ones?
I did a spot check and didn't see any issues, but it would be reassuring
if you could look.

Simon> 2014-04-26 Simon Marchi <simon.marchi@ericsson.com>
Simon> PR mi/15806
Simon> * utils.c (printchar): Don't escape at all if quoter is NUL.
Simon> * mi/mi-interp.c (mi_solib_loaded): Use ui_out_field_* functions to
Simon> generate the output.
Simon> (mi_solib_unloaded): Same.

Simon> 2014-04-26 Simon Marchi <simon.marchi@ericsson.com>

Simon> * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Fix
Simon> erroneous dprintf expected input.

This is ok. Before putting it in could you, if needed, look into the
printchar thing and then reply? Thank you.

Tom