This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR mi/15806: Fix quoting of async events
- From: Tom Tromey <tromey at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Fri, 16 May 2014 12:24:07 -0600
- Subject: Re: [PATCH] PR mi/15806: Fix quoting of async events
- Authentication-results: sourceware.org; auth=none
- References: <1398568091-21253-1-git-send-email-simon dot marchi at ericsson dot com> <878uq17mrq dot fsf at fleche dot redhat dot com> <537651BA dot 3020001 at ericsson dot com>
Tom> Did you check the other callers of printchar, even indirect ones?
Tom> I did a spot check and didn't see any issues, but it would be reassuring
Tom> if you could look.
Simon> The only direct callers of printchar are fputstr_filtered,
Simon> fputstr_unfiltered, fputstrn_filtered and fputstrn_unfiltered. To the
Simon> best of my knowledge, the change should not impact the callers of
Simon> those.
Yeah, by "indirect ones" I meant callers of these as well.
I looked through them. fputstr_unfiltered is safe. fputstrn_filtered
is not used. But for fputstrn_unfiltered, I see in remote.c:
static char *
escape_buffer (const char *buf, int n)
[...]
fputstrn_unfiltered (buf, n, 0, stb);
So it seems like this change could impact remote.
To know for sure, you'd have to dig a bit deeper.
One option might be to make QUOTER==-1 special, then update the call in
mi_console_raw_packet.
Simon> Semi-related: while looking at that, I realized that unlike
Simon> mi_field_string, mi_field_fmt does no escaping at all. It doesn't seem
Simon> like a problem right now, since mi_field_fmt is only used with things
Simon> that don't really need escaping anyway (numbers, or hex
Simon> strings). Still, it makes an inconsistent API and would be nice to
Simon> fix, I think.
Yes, that seems like a bug waiting to happen.
Tom