This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Allow explicit 16 or 32 char in 'x /s'
- From: Tom Tromey <tromey at redhat dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: "'Eli Zaretskii'" <eliz at gnu dot org>, <gdb-patches at sourceware dot org>
- Date: Tue, 30 Mar 2010 14:33:03 -0600
- Subject: Re: [RFC] Allow explicit 16 or 32 char in 'x /s'
- References: <11484.4708740295$1268865815@news.gmane.org> <m3mxy5z3j8.fsf@fleche.redhat.com> <83r5ngix6d.fsf@gnu.org> <15103.6087111153$1269298497@news.gmane.org>
- Reply-to: tromey at redhat dot com
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> But I don't know exactly for other languages and I would like
Pierre> to be sure about what you want me to add to the docs...
I think no other language has been updated to deal with wide characters.
Pierre> Furthermore if you look into charset_for_string_type
Pierre> function in c-lang.c source, you will see that there are two FIXME
Pierre> just right at the position of these charset name settings.
Yeah ... those are actually pedantic FIXMEs, in that (IIRC) nothing
guarantees that char16_t==UTF-16, even though that is the common
meaning.
Pierre> To answer Tom's concern about the change in classify_type function,
Pierre> I modified my patch to change the elttype in do_examine to match exactly
Pierre> what is expected by charset_for_string_type function.
Pierre> Thus this new version has no modification in c-lang.c file.
Suppose the inferior does not define char16_t. Won't this new code
allocate a new type each time the user uses x/hs? That seems bad.
What about passing the desired encoding to LA_PRINT_STRING, via a new
argument to val_print_string? That makes the patch a lot bigger, though
it is mostly mechanical.
Pierre> I also added a very basic check for string display using 'x
Pierre> /hs' and 'x /ws'.
Thanks.
Pierre> + case 's':
Pierre> + /* Display strings with byte size chars unless explicitly specified.
Pierre> */
Pierre> + val.size = 'b';
Pierre> + break;
I think x/hs followed by x should probably print another wide string.
I couldn't tell offhand if it does this or not.
Tom