[RFC] Allow explicit 16 or 32 char in 'x /s'
Tom Tromey
tromey@redhat.com
Tue Mar 30 20:33:00 GMT 2010
>>>>> "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
More information about the Gdb-patches
mailing list